diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index 15ce7e136e02f7..dab9301d76d12f 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -1040,9 +1040,9 @@ class Plane : public AP_Vehicle { void one_second_loop(void); void three_hz_loop(void); -#if AP_AIRSPEED_AUTOCAL_ENABLE + void airspeed_ratio_update(void); -#endif + void compass_save(void); void update_logging10(void); void update_logging25(void); diff --git a/ArduPlane/RC_Channel.cpp b/ArduPlane/RC_Channel.cpp index 6284016d91423a..5876c673581c7e 100644 --- a/ArduPlane/RC_Channel.cpp +++ b/ArduPlane/RC_Channel.cpp @@ -186,9 +186,9 @@ void RC_Channel_Plane::init_aux_function(const RC_Channel::AUX_FUNC ch_option, case AUX_FUNC::AIRMODE: case AUX_FUNC::WEATHER_VANE_ENABLE: #endif -#if AP_AIRSPEED_AUTOCAL_ENABLE + case AUX_FUNC::ARSPD_CALIBRATE: -#endif + case AUX_FUNC::TER_DISABLE: case AUX_FUNC::CROW_SELECT: run_aux_function(ch_option, ch_flag, AuxFuncTriggerSource::INIT); @@ -343,7 +343,7 @@ bool RC_Channel_Plane::do_aux_function(const AUX_FUNC ch_option, const AuxSwitch #endif case AUX_FUNC::ARSPD_CALIBRATE: -#if AP_AIRSPEED_AUTOCAL_ENABLE + switch (ch_flag) { case AuxSwitchPos::HIGH: plane.airspeed.set_calibration_enabled(true); @@ -354,7 +354,7 @@ bool RC_Channel_Plane::do_aux_function(const AUX_FUNC ch_option, const AuxSwitch plane.airspeed.set_calibration_enabled(false); break; } -#endif + break; case AUX_FUNC::LANDING_FLARE: diff --git a/libraries/AP_HAL/Util.h b/libraries/AP_HAL/Util.h index da22f1a8be1d99..10b7c96a3c012d 100644 --- a/libraries/AP_HAL/Util.h +++ b/libraries/AP_HAL/Util.h @@ -212,10 +212,10 @@ class AP_HAL::Util { // log info on stack usage virtual void log_stack_info(void) {} -#if AP_CRASHDUMP_ENABLED + virtual size_t last_crash_dump_size() const { return 0; } virtual void* last_crash_dump_ptr() const { return nullptr; } -#endif + #if HAL_ENABLE_DFU_BOOT virtual void boot_to_dfu(void) {} diff --git a/libraries/AP_HAL_ChibiOS/Scheduler.cpp b/libraries/AP_HAL_ChibiOS/Scheduler.cpp index 128ab1cc1eb314..a86e0bb145165a 100644 --- a/libraries/AP_HAL_ChibiOS/Scheduler.cpp +++ b/libraries/AP_HAL_ChibiOS/Scheduler.cpp @@ -468,7 +468,7 @@ void Scheduler::_monitor_thread(void *arg) try_force_mutex(); } -#if AP_CRASHDUMP_ENABLED + if (loop_delay >= 1800 && using_watchdog) { // we are about to watchdog, better to trigger a hardfault // now and get a crash dump file @@ -477,7 +477,7 @@ void Scheduler::_monitor_thread(void *arg) fptr gptr = (fptr) (void *)ptr; gptr(); } -#endif + #if HAL_LOGGING_ENABLED if (log_wd_counter++ == 10 && hal.util->was_watchdog_reset()) { diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index fd0f55f6ba644e..da44ef35059580 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -832,7 +832,7 @@ void Util::log_stack_info(void) #endif } -#if AP_CRASHDUMP_ENABLED + size_t Util::last_crash_dump_size() const { // get dump size @@ -856,7 +856,7 @@ void* Util::last_crash_dump_ptr() const } return (void*)stm32_crash_dump_addr(); } -#endif // AP_CRASHDUMP_ENABLED + #if HAL_ENABLE_DFU_BOOT && !defined(HAL_BOOTLOADER_BUILD) void Util::boot_to_dfu() diff --git a/libraries/AP_HAL_ChibiOS/Util.h b/libraries/AP_HAL_ChibiOS/Util.h index 8e431484a096d5..c2f7ecfebaddf2 100644 --- a/libraries/AP_HAL_ChibiOS/Util.h +++ b/libraries/AP_HAL_ChibiOS/Util.h @@ -159,11 +159,11 @@ class ChibiOS::Util : public AP_HAL::Util { // log info on stack usage void log_stack_info(void) override; -#if AP_CRASHDUMP_ENABLED + // get last crash dump size_t last_crash_dump_size() const override; void* last_crash_dump_ptr() const override; -#endif + #if HAL_ENABLE_DFU_BOOT void boot_to_dfu() override; diff --git a/libraries/AP_HAL_ChibiOS/system.cpp b/libraries/AP_HAL_ChibiOS/system.cpp index 09cb6668215000..fa32f452392d2b 100644 --- a/libraries/AP_HAL_ChibiOS/system.cpp +++ b/libraries/AP_HAL_ChibiOS/system.cpp @@ -23,9 +23,9 @@ #include "hwdef/common/watchdog.h" #include "hwdef/common/stm32_util.h" #include -#if AP_CRASHDUMP_ENABLED + #include -#endif + #include #include "hal.h" #include diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index db904e67eabf15..7f38541f5f944d 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -654,9 +654,9 @@ void RC_Channel::init_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos case AUX_FUNC::SCRIPTING_6: case AUX_FUNC::SCRIPTING_7: case AUX_FUNC::SCRIPTING_8: -#if AP_VIDEOTX_ENABLED + case AUX_FUNC::VTX_POWER: -#endif + case AUX_FUNC::OPTFLOW_CAL: case AUX_FUNC::TURBINE_START: case AUX_FUNC::MOUNT1_ROLL: @@ -722,7 +722,7 @@ void RC_Channel::init_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos } } -#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED + const RC_Channel::LookupTable RC_Channel::lookuptable[] = { { AUX_FUNC::SAVE_WP,"SaveWaypoint"}, @@ -804,7 +804,7 @@ const char *RC_Channel::string_for_aux_pos(AuxSwitchPos pos) const return ""; } -#endif // AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED + /* read an aux channel. Return true if a switch has changed @@ -816,7 +816,7 @@ bool RC_Channel::read_aux() // may wish to add special cases for other "AUXSW" things // here e.g. RCMAP_ROLL etc once they become options return false; -#if AP_VIDEOTX_ENABLED + } else if (_option == AUX_FUNC::VTX_POWER) { int8_t position; if (read_6pos_switch(position)) { @@ -824,7 +824,7 @@ bool RC_Channel::read_aux() return true; } return false; -#endif // AP_VIDEOTX_ENABLED + } AuxSwitchPos new_position; @@ -844,13 +844,13 @@ bool RC_Channel::read_aux() return false; } -#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED + // announce the change to the GCS: const char *aux_string = string_for_aux_function(_option); if (aux_string != nullptr) { GCS_SEND_TEXT(MAV_SEVERITY_INFO, "RC%i: %s %s", ch_in+1, aux_string, string_for_aux_pos(new_position)); } -#endif + // debounced; undertake the action: run_aux_function(_option, new_position, AuxFuncTriggerSource::RC); diff --git a/libraries/RC_Channel/RC_Channel.h b/libraries/RC_Channel/RC_Channel.h index d0a2cac8b16f05..acce19a7f4ac6e 100644 --- a/libraries/RC_Channel/RC_Channel.h +++ b/libraries/RC_Channel/RC_Channel.h @@ -309,10 +309,10 @@ class RC_Channel { // wrapper function around do_aux_function which allows us to log bool run_aux_function(AUX_FUNC ch_option, AuxSwitchPos pos, AuxFuncTriggerSource source); -#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED + const char *string_for_aux_function(AUX_FUNC function) const; const char *string_for_aux_pos(AuxSwitchPos pos) const; -#endif + // pwm value under which we consider that Radio value is invalid static const uint16_t RC_MIN_LIMIT_PWM = 800; // pwm value above which we consider that Radio value is invalid @@ -422,7 +422,7 @@ class RC_Channel { // switch high! bool init_position_on_first_radio_read(AUX_FUNC func) const; -#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED + // Structure to lookup switch change announcements struct LookupTable{ AUX_FUNC option; @@ -430,7 +430,7 @@ class RC_Channel { }; static const LookupTable lookuptable[]; -#endif + };