From 90f8cbde138c7c29f026c20165459e520030b9e4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 11 Oct 2021 15:59:19 +1100 Subject: [PATCH] SITL: provide HAL_x_ENABLED for many SITL features This allows for the feature to be compiled out --- libraries/SITL/SIM_ADSB.cpp | 5 +++++ libraries/SITL/SIM_ADSB.h | 10 ++++++++++ libraries/SITL/SIM_AIS.cpp | 6 +++++- libraries/SITL/SIM_AIS.h | 10 ++++++++++ libraries/SITL/SIM_AirSim.cpp | 4 ++++ libraries/SITL/SIM_AirSim.h | 10 ++++++++++ libraries/SITL/SIM_CRRCSim.cpp | 4 ++++ libraries/SITL/SIM_CRRCSim.h | 10 ++++++++++ libraries/SITL/SIM_FlightAxis.cpp | 4 ++++ libraries/SITL/SIM_FlightAxis.h | 10 ++++++++++ libraries/SITL/SIM_Gazebo.cpp | 5 +++++ libraries/SITL/SIM_Gazebo.h | 11 +++++++++++ libraries/SITL/SIM_Gimbal.cpp | 4 ++++ libraries/SITL/SIM_Gimbal.h | 10 ++++++++++ libraries/SITL/SIM_JSBSim.cpp | 4 ++++ libraries/SITL/SIM_JSBSim.h | 10 ++++++++++ libraries/SITL/SIM_JSON.cpp | 4 ++++ libraries/SITL/SIM_JSON.h | 10 ++++++++++ libraries/SITL/SIM_JSON_Master.cpp | 6 ++++++ libraries/SITL/SIM_JSON_Master.h | 10 ++++++++++ libraries/SITL/SIM_Morse.cpp | 4 ++++ libraries/SITL/SIM_Morse.h | 11 +++++++++++ libraries/SITL/SIM_PS_LightWare.h | 8 ++++++++ libraries/SITL/SIM_PS_LightWare_SF45B.cpp | 4 ++++ libraries/SITL/SIM_PS_LightWare_SF45B.h | 8 ++++++++ libraries/SITL/SIM_PS_RPLidarA2.cpp | 4 ++++ libraries/SITL/SIM_PS_RPLidarA2.h | 8 ++++++++ libraries/SITL/SIM_PS_TeraRangerTower.cpp | 4 ++++ libraries/SITL/SIM_PS_TeraRangerTower.h | 8 ++++++++ libraries/SITL/SIM_Scrimmage.cpp | 4 ++++ libraries/SITL/SIM_Scrimmage.h | 10 ++++++++++ libraries/SITL/SIM_SerialProximitySensor.cpp | 4 ++++ libraries/SITL/SIM_SerialProximitySensor.h | 10 ++++++++++ libraries/SITL/SIM_SilentWings.cpp | 4 ++++ libraries/SITL/SIM_SilentWings.h | 10 ++++++++++ libraries/SITL/SIM_Webots.cpp | 4 ++++ libraries/SITL/SIM_Webots.h | 11 +++++++++++ libraries/SITL/SIM_XPlane.cpp | 4 ++++ libraries/SITL/SIM_XPlane.h | 11 +++++++++++ libraries/SITL/SIM_last_letter.cpp | 4 ++++ libraries/SITL/SIM_last_letter.h | 10 ++++++++++ 41 files changed, 291 insertions(+), 1 deletion(-) diff --git a/libraries/SITL/SIM_ADSB.cpp b/libraries/SITL/SIM_ADSB.cpp index 02c6d1e35d..256a171921 100644 --- a/libraries/SITL/SIM_ADSB.cpp +++ b/libraries/SITL/SIM_ADSB.cpp @@ -17,6 +17,9 @@ */ #include "SIM_ADSB.h" + +#if HAL_SIM_ADSB_ENABLED + #include "SITL.h" #include @@ -270,3 +273,5 @@ void ADSB::send_report(void) } } // namespace SITL + +#endif // HAL_SIM_ADSB_ENABLED diff --git a/libraries/SITL/SIM_ADSB.h b/libraries/SITL/SIM_ADSB.h index 3ef6e52e3b..4a8156fdc1 100644 --- a/libraries/SITL/SIM_ADSB.h +++ b/libraries/SITL/SIM_ADSB.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_ADSB_ENABLED +#define HAL_SIM_ADSB_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_ADSB_ENABLED + #include #include "SIM_Aircraft.h" @@ -79,3 +87,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_ADSB_ENABLED diff --git a/libraries/SITL/SIM_AIS.cpp b/libraries/SITL/SIM_AIS.cpp index 4127ded9d3..a6015416a9 100644 --- a/libraries/SITL/SIM_AIS.cpp +++ b/libraries/SITL/SIM_AIS.cpp @@ -21,8 +21,10 @@ */ #include "SIM_AIS.h" -#include +#if HAL_SIM_AIS_ENABLED + +#include extern const AP_HAL::HAL& hal; @@ -73,3 +75,5 @@ void AIS::update() write_to_autopilot(line, strlen(line)); } + +#endif // HAL_SIM_AIS_ENABLED diff --git a/libraries/SITL/SIM_AIS.h b/libraries/SITL/SIM_AIS.h index 6f3f23c6a4..14bc6c9015 100644 --- a/libraries/SITL/SIM_AIS.h +++ b/libraries/SITL/SIM_AIS.h @@ -22,6 +22,14 @@ #pragma once +#include + +#ifndef HAL_SIM_AIS_ENABLED +#define HAL_SIM_AIS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_AIS_ENABLED + #include "SIM_SerialDevice.h" #include @@ -42,3 +50,5 @@ private: }; } + +#endif // HAL_SIM_AIS_ENABLED diff --git a/libraries/SITL/SIM_AirSim.cpp b/libraries/SITL/SIM_AirSim.cpp index 40a024e287..da42e7cede 100644 --- a/libraries/SITL/SIM_AirSim.cpp +++ b/libraries/SITL/SIM_AirSim.cpp @@ -18,6 +18,8 @@ #include "SIM_AirSim.h" +#if HAL_SIM_AIRSIM_ENABLED + #include #include #include @@ -423,3 +425,5 @@ void AirSim::report_FPS(void) last_frame_count = state.timestamp; } } + +#endif // HAL_SIM_AIRSIM_ENABLED diff --git a/libraries/SITL/SIM_AirSim.h b/libraries/SITL/SIM_AirSim.h index 8028439b45..7e3b447817 100644 --- a/libraries/SITL/SIM_AirSim.h +++ b/libraries/SITL/SIM_AirSim.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_AIRSIM_ENABLED +#define HAL_SIM_AIRSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_AIRSIM_ENABLED + #include #include "SIM_Aircraft.h" @@ -150,3 +158,5 @@ private: }; } + +#endif // HAL_SIM_AIRSIM_ENABLED diff --git a/libraries/SITL/SIM_CRRCSim.cpp b/libraries/SITL/SIM_CRRCSim.cpp index 0046188beb..16daac43a4 100644 --- a/libraries/SITL/SIM_CRRCSim.cpp +++ b/libraries/SITL/SIM_CRRCSim.cpp @@ -18,6 +18,8 @@ #include "SIM_CRRCSim.h" +#if HAL_SIM_CRRCSIM_ENABLED + #include #include @@ -154,3 +156,5 @@ void CRRCSim::update(const struct sitl_input &input) } } // namespace SITL + +#endif // HAL_SIM_CRRCSIM_ENABLED diff --git a/libraries/SITL/SIM_CRRCSim.h b/libraries/SITL/SIM_CRRCSim.h index 46bcf83ec8..eb6d01c3b4 100644 --- a/libraries/SITL/SIM_CRRCSim.h +++ b/libraries/SITL/SIM_CRRCSim.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_CRRCSIM_ENABLED +#define HAL_SIM_CRRCSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_CRRCSIM_ENABLED + #include #include "SIM_Aircraft.h" @@ -77,3 +85,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_CRRCSIM_ENABLED diff --git a/libraries/SITL/SIM_FlightAxis.cpp b/libraries/SITL/SIM_FlightAxis.cpp index 7e39a977e3..5e34d91fe6 100644 --- a/libraries/SITL/SIM_FlightAxis.cpp +++ b/libraries/SITL/SIM_FlightAxis.cpp @@ -18,6 +18,8 @@ #include "SIM_FlightAxis.h" +#if HAL_SIM_FLIGHTAXIS_ENABLED + #include #include #include @@ -588,3 +590,5 @@ void FlightAxis::socket_creator(void) pthread_mutex_unlock(&sockmtx); } } + +#endif // HAL_SIM_FLIGHTAXIS_ENABLED diff --git a/libraries/SITL/SIM_FlightAxis.h b/libraries/SITL/SIM_FlightAxis.h index 4086b76870..3883839e22 100644 --- a/libraries/SITL/SIM_FlightAxis.h +++ b/libraries/SITL/SIM_FlightAxis.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_FLIGHTAXIS_ENABLED +#define HAL_SIM_FLIGHTAXIS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_FLIGHTAXIS_ENABLED + #include #include "SIM_Aircraft.h" @@ -194,3 +202,5 @@ private: } // namespace SITL + +#endif // HAL_SIM_FLIGHTAXIS_ENABLED diff --git a/libraries/SITL/SIM_Gazebo.cpp b/libraries/SITL/SIM_Gazebo.cpp index f1d04b73e2..bf32962b1b 100644 --- a/libraries/SITL/SIM_Gazebo.cpp +++ b/libraries/SITL/SIM_Gazebo.cpp @@ -18,6 +18,8 @@ #include "SIM_Gazebo.h" +#if HAL_SIM_GAZEBO_ENABLED + #include #include @@ -171,3 +173,6 @@ void Gazebo::update(const struct sitl_input &input) } } // namespace SITL + + +#endif // HAL_SIM_GAZEBO_ENABLED diff --git a/libraries/SITL/SIM_Gazebo.h b/libraries/SITL/SIM_Gazebo.h index 78515d4a92..4da05353ba 100644 --- a/libraries/SITL/SIM_Gazebo.h +++ b/libraries/SITL/SIM_Gazebo.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_GAZEBO_ENABLED +#define HAL_SIM_GAZEBO_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_GAZEBO_ENABLED + #include "SIM_Aircraft.h" #include @@ -75,3 +83,6 @@ private: }; } // namespace SITL + + +#endif // HAL_SIM_GAZEBO_ENABLED diff --git a/libraries/SITL/SIM_Gimbal.cpp b/libraries/SITL/SIM_Gimbal.cpp index ba0764a944..445a4214ef 100644 --- a/libraries/SITL/SIM_Gimbal.cpp +++ b/libraries/SITL/SIM_Gimbal.cpp @@ -18,6 +18,8 @@ #include "SIM_Gimbal.h" +#if HAL_SIM_GIMBAL_ENABLED + #include #include "SIM_Aircraft.h" @@ -413,3 +415,5 @@ void Gimbal::send_report(void) } } // namespace SITL + +#endif // HAL_SIM_GIMBAL_ENABLED diff --git a/libraries/SITL/SIM_Gimbal.h b/libraries/SITL/SIM_Gimbal.h index 59375d3677..792f009a03 100644 --- a/libraries/SITL/SIM_Gimbal.h +++ b/libraries/SITL/SIM_Gimbal.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_GIMBAL_ENABLED +#define HAL_SIM_GIMBAL_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_GIMBAL_ENABLED + #include #include "SIM_Aircraft.h" @@ -111,3 +119,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_GIMBAL_ENABLED diff --git a/libraries/SITL/SIM_JSBSim.cpp b/libraries/SITL/SIM_JSBSim.cpp index 38971d218b..ca1128143d 100644 --- a/libraries/SITL/SIM_JSBSim.cpp +++ b/libraries/SITL/SIM_JSBSim.cpp @@ -18,6 +18,8 @@ #include "SIM_JSBSim.h" +#if HAL_SIM_JSBSIM_ENABLED + #include #include #include @@ -482,3 +484,5 @@ void JSBSim::update(const struct sitl_input &input) } } // namespace SITL + +#endif // HAL_SIM_JSBSIM_ENABLED diff --git a/libraries/SITL/SIM_JSBSim.h b/libraries/SITL/SIM_JSBSim.h index 4690802a30..fda323e943 100644 --- a/libraries/SITL/SIM_JSBSim.h +++ b/libraries/SITL/SIM_JSBSim.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_JSBSIM_ENABLED +#define HAL_SIM_JSBSIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_JSBSIM_ENABLED + #include #include "SIM_Aircraft.h" @@ -176,3 +184,5 @@ public: }; } // namespace SITL + +#endif // HAL_SIM_JSBSIM_ENABLED diff --git a/libraries/SITL/SIM_JSON.cpp b/libraries/SITL/SIM_JSON.cpp index ecaae8ffbe..be64d053ed 100644 --- a/libraries/SITL/SIM_JSON.cpp +++ b/libraries/SITL/SIM_JSON.cpp @@ -18,6 +18,8 @@ #include "SIM_JSON.h" +#if HAL_SIM_JSON_ENABLED + #include #include #include @@ -448,3 +450,5 @@ void JSON::update(const struct sitl_input &input) } #endif } + +#endif // HAL_SIM_JSON_ENABLED diff --git a/libraries/SITL/SIM_JSON.h b/libraries/SITL/SIM_JSON.h index d4efb84d3e..3f1aeab5e7 100644 --- a/libraries/SITL/SIM_JSON.h +++ b/libraries/SITL/SIM_JSON.h @@ -14,6 +14,14 @@ */ #pragma once +#include + +#ifndef HAL_SIM_JSON_ENABLED +#define HAL_SIM_JSON_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_JSON_ENABLED + #include #include "SIM_Aircraft.h" @@ -143,3 +151,5 @@ private: }; } + +#endif // HAL_SIM_JSON_ENABLED diff --git a/libraries/SITL/SIM_JSON_Master.cpp b/libraries/SITL/SIM_JSON_Master.cpp index 36da197272..01f40fe468 100644 --- a/libraries/SITL/SIM_JSON_Master.cpp +++ b/libraries/SITL/SIM_JSON_Master.cpp @@ -17,6 +17,9 @@ */ #include "SIM_JSON_Master.h" + +#if HAL_SIM_JSON_MASTER_ENABLED + #include #include @@ -183,3 +186,6 @@ void JSON_Master::send(const struct sitl_fdm &output, const Vector3d &position) list->sock_out.send(json_out,length); } } + + +#endif // HAL_SIM_JSON_MASTER_ENABLED diff --git a/libraries/SITL/SIM_JSON_Master.h b/libraries/SITL/SIM_JSON_Master.h index b1f0b13933..36c4d827b2 100644 --- a/libraries/SITL/SIM_JSON_Master.h +++ b/libraries/SITL/SIM_JSON_Master.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_JSON_MASTER_ENABLED +#define HAL_SIM_JSON_MASTER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_JSON_MASTER_ENABLED + #include "SITL_Input.h" #include #include @@ -54,3 +62,5 @@ private: }; } + +#endif // HAL_SIM_JSON_MASTER_ENABLED diff --git a/libraries/SITL/SIM_Morse.cpp b/libraries/SITL/SIM_Morse.cpp index 9974ade201..d4303b87ee 100644 --- a/libraries/SITL/SIM_Morse.cpp +++ b/libraries/SITL/SIM_Morse.cpp @@ -18,6 +18,8 @@ #include "SIM_Morse.h" +#if HAL_SIM_MORSE_ENABLED + #include #include #include @@ -671,3 +673,5 @@ void Morse::send_report(void) } } + +#endif // HAL_SIM_MORSE_ENABLED diff --git a/libraries/SITL/SIM_Morse.h b/libraries/SITL/SIM_Morse.h index 2e567fba8b..5e45ab9f93 100644 --- a/libraries/SITL/SIM_Morse.h +++ b/libraries/SITL/SIM_Morse.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_MORSE_ENABLED +#define HAL_SIM_MORSE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_MORSE_ENABLED + #include #include "SIM_Aircraft.h" @@ -154,3 +162,6 @@ private: } // namespace SITL + + +#endif // HAL_SIM_MORSE_ENABLED diff --git a/libraries/SITL/SIM_PS_LightWare.h b/libraries/SITL/SIM_PS_LightWare.h index 857afa9c5c..bd63efc05d 100644 --- a/libraries/SITL/SIM_PS_LightWare.h +++ b/libraries/SITL/SIM_PS_LightWare.h @@ -21,6 +21,12 @@ #include "SIM_SerialProximitySensor.h" +#ifndef HAL_SIM_PS_LIGHTWARE_ENABLED +#define HAL_SIM_PS_LIGHTWARE_ENABLED HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED +#endif + +#if HAL_SIM_PS_LIGHTWARE_ENABLED + #include namespace SITL { @@ -35,3 +41,5 @@ private: }; }; + +#endif // HAL_SIM_PS_LIGHTWARE_ENABLED diff --git a/libraries/SITL/SIM_PS_LightWare_SF45B.cpp b/libraries/SITL/SIM_PS_LightWare_SF45B.cpp index c01f541b0f..44101927e4 100644 --- a/libraries/SITL/SIM_PS_LightWare_SF45B.cpp +++ b/libraries/SITL/SIM_PS_LightWare_SF45B.cpp @@ -18,6 +18,8 @@ #include "SIM_PS_LightWare_SF45B.h" +#if HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED + #include #include #include @@ -220,3 +222,5 @@ void PS_LightWare_SF45B::update_output_scan(const Location &location) send((char*)&packed_distance_data, sizeof(packed_distance_data)); } } + +#endif // HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED diff --git a/libraries/SITL/SIM_PS_LightWare_SF45B.h b/libraries/SITL/SIM_PS_LightWare_SF45B.h index 088a8215cf..6f99f81823 100644 --- a/libraries/SITL/SIM_PS_LightWare_SF45B.h +++ b/libraries/SITL/SIM_PS_LightWare_SF45B.h @@ -43,6 +43,12 @@ rc 2 1450 #include "SIM_PS_LightWare.h" +#ifndef HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED +#define HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED HAL_SIM_PS_LIGHTWARE_ENABLED +#endif + +#if HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED + #include #include @@ -258,3 +264,5 @@ private: }; }; + +#endif // HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED diff --git a/libraries/SITL/SIM_PS_RPLidarA2.cpp b/libraries/SITL/SIM_PS_RPLidarA2.cpp index 33bdd6bf13..47c4248582 100644 --- a/libraries/SITL/SIM_PS_RPLidarA2.cpp +++ b/libraries/SITL/SIM_PS_RPLidarA2.cpp @@ -18,6 +18,8 @@ #include "SIM_PS_RPLidarA2.h" +#if HAL_SIM_PS_RPLIDARA2_ENABLED + #include #include #include @@ -229,3 +231,5 @@ void PS_RPLidarA2::send_response_descriptor(uint32_t data_response_length, SendM abort(); } } + +#endif // HAL_SIM_PS_RPLIDARA2_ENABLED diff --git a/libraries/SITL/SIM_PS_RPLidarA2.h b/libraries/SITL/SIM_PS_RPLidarA2.h index ce02b72757..35fae76b19 100644 --- a/libraries/SITL/SIM_PS_RPLidarA2.h +++ b/libraries/SITL/SIM_PS_RPLidarA2.h @@ -45,6 +45,12 @@ rc 2 1450 #include "SIM_SerialProximitySensor.h" +#ifndef HAL_SIM_PS_RPLIDARA2_ENABLED +#define HAL_SIM_PS_RPLIDARA2_ENABLED HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED +#endif + +#if HAL_SIM_PS_RPLIDARA2_ENABLED + #include namespace SITL { @@ -127,3 +133,5 @@ private: }; }; + +#endif // HAL_SIM_PS_RPLIDARA2_ENABLED diff --git a/libraries/SITL/SIM_PS_TeraRangerTower.cpp b/libraries/SITL/SIM_PS_TeraRangerTower.cpp index b650495e0a..fee3224443 100644 --- a/libraries/SITL/SIM_PS_TeraRangerTower.cpp +++ b/libraries/SITL/SIM_PS_TeraRangerTower.cpp @@ -18,6 +18,8 @@ #include "SIM_PS_TeraRangerTower.h" +#if HAL_SIM_PS_TERARANGERTOWER_ENABLED + #include #include #include @@ -75,3 +77,5 @@ void PS_TeraRangerTower::update(const Location &location) { update_output(location); } + +#endif // HAL_SIM_PS_TERARANGERTOWER_ENABLED diff --git a/libraries/SITL/SIM_PS_TeraRangerTower.h b/libraries/SITL/SIM_PS_TeraRangerTower.h index 906d0088ef..8a2471495a 100644 --- a/libraries/SITL/SIM_PS_TeraRangerTower.h +++ b/libraries/SITL/SIM_PS_TeraRangerTower.h @@ -43,6 +43,12 @@ rc 2 1450 #include "SIM_SerialProximitySensor.h" +#ifndef HAL_SIM_PS_TERARANGERTOWER_ENABLED +#define HAL_SIM_PS_TERARANGERTOWER_ENABLED HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED +#endif + +#if HAL_SIM_PS_TERARANGERTOWER_ENABLED + #include namespace SITL { @@ -65,3 +71,5 @@ private: }; }; + +#endif // HAL_SIM_PS_TERARANGERTOWER_ENABLED diff --git a/libraries/SITL/SIM_Scrimmage.cpp b/libraries/SITL/SIM_Scrimmage.cpp index fb326eb08e..64b623094f 100644 --- a/libraries/SITL/SIM_Scrimmage.cpp +++ b/libraries/SITL/SIM_Scrimmage.cpp @@ -18,6 +18,8 @@ #include "SIM_Scrimmage.h" +#if HAL_SIM_SCRIMMAGE_ENABLED + #include #include #include @@ -130,3 +132,5 @@ void Scrimmage::update(const struct sitl_input &input) } } // namespace SITL + +#endif diff --git a/libraries/SITL/SIM_Scrimmage.h b/libraries/SITL/SIM_Scrimmage.h index 93641da6f5..5887d3368f 100644 --- a/libraries/SITL/SIM_Scrimmage.h +++ b/libraries/SITL/SIM_Scrimmage.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_SCRIMMAGE_ENABLED +#define HAL_SIM_SCRIMMAGE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_SCRIMMAGE_ENABLED + #include #include @@ -83,3 +91,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_SCRIMMAGE_ENABLED diff --git a/libraries/SITL/SIM_SerialProximitySensor.cpp b/libraries/SITL/SIM_SerialProximitySensor.cpp index 367896a5ce..aa2c057501 100644 --- a/libraries/SITL/SIM_SerialProximitySensor.cpp +++ b/libraries/SITL/SIM_SerialProximitySensor.cpp @@ -18,6 +18,8 @@ #include "SIM_SerialProximitySensor.h" +#if HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED + #include #include @@ -134,3 +136,5 @@ float SerialProximitySensor::measure_distance_at_angle_bf(const Location &locati // ::fprintf(stderr, "Distance @%f = %fm\n", angle, min_dist_cm/100.0f); return min_dist_cm / 100.0f; } + +#endif // HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED diff --git a/libraries/SITL/SIM_SerialProximitySensor.h b/libraries/SITL/SIM_SerialProximitySensor.h index b25c38829b..a8baad3a4a 100644 --- a/libraries/SITL/SIM_SerialProximitySensor.h +++ b/libraries/SITL/SIM_SerialProximitySensor.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED +#define HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED + #include "SIM_Aircraft.h" #include @@ -56,3 +64,5 @@ private: }; } + +#endif diff --git a/libraries/SITL/SIM_SilentWings.cpp b/libraries/SITL/SIM_SilentWings.cpp index 9034db9d14..b6068e8597 100755 --- a/libraries/SITL/SIM_SilentWings.cpp +++ b/libraries/SITL/SIM_SilentWings.cpp @@ -18,6 +18,8 @@ #include "SIM_SilentWings.h" +#if HAL_SIM_SILENTWINGS_ENABLED + #include #include @@ -318,3 +320,5 @@ void SilentWings::update(const struct sitl_input &input) report.frame_count = 0; } } + +#endif // HAL_SIM_SILENTWINGS_ENABLED diff --git a/libraries/SITL/SIM_SilentWings.h b/libraries/SITL/SIM_SilentWings.h index 4e8a91015b..a112c7e045 100755 --- a/libraries/SITL/SIM_SilentWings.h +++ b/libraries/SITL/SIM_SilentWings.h @@ -15,6 +15,14 @@ #pragma once +#include + +#ifndef HAL_SIM_SILENTWINGS_ENABLED +#define HAL_SIM_SILENTWINGS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_SILENTWINGS_ENABLED + #include #include "SIM_Aircraft.h" @@ -110,3 +118,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_SILENTWINGS_ENABLED diff --git a/libraries/SITL/SIM_Webots.cpp b/libraries/SITL/SIM_Webots.cpp index 22394289f0..a5b44bb7ae 100644 --- a/libraries/SITL/SIM_Webots.cpp +++ b/libraries/SITL/SIM_Webots.cpp @@ -18,6 +18,8 @@ #include "SIM_Webots.h" +#if HAL_SIM_WEBOTS_ENABLED + #include #include #include @@ -567,3 +569,5 @@ void Webots::report_FPS(void) // last_frame_count_s = state.timestamp; // } } + +#endif // HAL_SIM_WEBOTS_ENABLED diff --git a/libraries/SITL/SIM_Webots.h b/libraries/SITL/SIM_Webots.h index 3e768a70df..ef6ea1454a 100644 --- a/libraries/SITL/SIM_Webots.h +++ b/libraries/SITL/SIM_Webots.h @@ -17,6 +17,15 @@ */ #pragma once + +#include + +#ifndef HAL_SIM_WEBOTS_ENABLED +#define HAL_SIM_WEBOTS_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_WEBOTS_ENABLED + #include #include #include "SIM_Aircraft.h" @@ -135,3 +144,5 @@ private: } // namespace SITL + +#endif // HAL_SIM_WEBOTS_ENABLED diff --git a/libraries/SITL/SIM_XPlane.cpp b/libraries/SITL/SIM_XPlane.cpp index 6aa6f877f3..ab37f24580 100644 --- a/libraries/SITL/SIM_XPlane.cpp +++ b/libraries/SITL/SIM_XPlane.cpp @@ -18,6 +18,8 @@ #include "SIM_XPlane.h" +#if HAL_SIM_XPLANE_ENABLED + #include #include #include @@ -488,3 +490,5 @@ void XPlane::update(const struct sitl_input &input) } } // namespace SITL + +#endif // HAL_SIM_XPLANE_ENABLED diff --git a/libraries/SITL/SIM_XPlane.h b/libraries/SITL/SIM_XPlane.h index cfc6d45f96..8ccfed948e 100644 --- a/libraries/SITL/SIM_XPlane.h +++ b/libraries/SITL/SIM_XPlane.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_XPLANE_ENABLED +#define HAL_SIM_XPLANE_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_XPLANE_ENABLED + #include #include "SIM_Aircraft.h" @@ -112,3 +120,6 @@ private: } // namespace SITL + + +#endif // HAL_SIM_XPLANE_ENABLED diff --git a/libraries/SITL/SIM_last_letter.cpp b/libraries/SITL/SIM_last_letter.cpp index 0215c09a9e..8cb72cd0ec 100644 --- a/libraries/SITL/SIM_last_letter.cpp +++ b/libraries/SITL/SIM_last_letter.cpp @@ -18,6 +18,8 @@ #include "SIM_last_letter.h" +#if HAL_SIM_LAST_LETTER_ENABLED + #include #include #include @@ -135,3 +137,5 @@ void last_letter::update(const struct sitl_input &input) } } // namespace SITL + +#endif // HAL_SIM_LAST_LETTER_ENABLED diff --git a/libraries/SITL/SIM_last_letter.h b/libraries/SITL/SIM_last_letter.h index ca66ed8f0d..ae7cae5ecf 100644 --- a/libraries/SITL/SIM_last_letter.h +++ b/libraries/SITL/SIM_last_letter.h @@ -18,6 +18,14 @@ #pragma once +#include + +#ifndef HAL_SIM_LAST_LETTER_ENABLED +#define HAL_SIM_LAST_LETTER_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL) +#endif + +#if HAL_SIM_LAST_LETTER_ENABLED + #include #include "SIM_Aircraft.h" @@ -73,3 +81,5 @@ private: }; } // namespace SITL + +#endif // HAL_SIM_LAST_LETTER_ENABLED