From 8e1fc605504253f86fddaeee89a3c712be0ba2c2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 12 Dec 2023 23:10:18 +1100 Subject: [PATCH] AP_Vehicle: correct compilation when AP_Vehicle not available --- libraries/AP_Vehicle/AP_Vehicle.cpp | 5 +++++ libraries/AP_Vehicle/AP_Vehicle.h | 6 ++++++ libraries/AP_Vehicle/AP_Vehicle_config.h | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 libraries/AP_Vehicle/AP_Vehicle_config.h diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index 7a1595b7e5..9908cf767d 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -1,3 +1,7 @@ +#include "AP_Vehicle_config.h" + +#if AP_VEHICLE_ENABLED + #include "AP_Vehicle.h" #include @@ -1029,3 +1033,4 @@ AP_Vehicle *vehicle() }; +#endif // AP_VEHICLE_ENABLED diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index 38e65f071f..1ccbe4d550 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -14,6 +14,10 @@ */ #pragma once +#include "AP_Vehicle_config.h" + +#if AP_VEHICLE_ENABLED + /* this header holds a parameter structure for each vehicle type for parameters needed by multiple libraries @@ -490,3 +494,5 @@ extern const AP_HAL::HAL& hal; extern const AP_Param::Info vehicle_var_info[]; #include "AP_Vehicle_Type.h" + +#endif // AP_VEHICLE_ENABLED diff --git a/libraries/AP_Vehicle/AP_Vehicle_config.h b/libraries/AP_Vehicle/AP_Vehicle_config.h new file mode 100644 index 0000000000..8cdfa764a0 --- /dev/null +++ b/libraries/AP_Vehicle/AP_Vehicle_config.h @@ -0,0 +1,5 @@ +#pragma once + +#ifndef AP_VEHICLE_ENABLED +#define AP_VEHICLE_ENABLED 1 +#endif