From 3ba2f3117fc645496121ef08c5111021eb99c9a0 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 12 Dec 2023 09:21:15 +1100 Subject: [PATCH] AP_Arming: correct compilation when logging not available --- libraries/AP_Arming/AP_Arming.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index e51f3c7570..fc836b90d4 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -324,6 +324,7 @@ bool AP_Arming::airspeed_checks(bool report) return true; } +#if HAL_LOGGING_ENABLED bool AP_Arming::logging_checks(bool report) { if (check_enabled(ARMING_CHECK_LOGGING)) { @@ -346,6 +347,7 @@ bool AP_Arming::logging_checks(bool report) } return true; } +#endif // HAL_LOGGING_ENABLED #if AP_INERTIALSENSOR_ENABLED bool AP_Arming::ins_accels_consistent(const AP_InertialSensor &ins) @@ -1561,7 +1563,9 @@ bool AP_Arming::pre_arm_checks(bool report) & compass_checks(report) & gps_checks(report) & battery_checks(report) +#if HAL_LOGGING_ENABLED & logging_checks(report) +#endif #if AP_RC_CHANNEL_ENABLED & manual_transmitter_checks(report) #endif @@ -1660,10 +1664,14 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks) _last_arm_method = method; +#if HAL_LOGGING_ENABLED Log_Write_Arm(!do_arming_checks, method); // note Log_Write_Armed takes forced not do_arming_checks +#endif } else { +#if HAL_LOGGING_ENABLED AP::logger().arming_failure(); +#endif armed = false; } @@ -1719,9 +1727,11 @@ bool AP_Arming::disarm(const AP_Arming::Method method, bool do_disarm_checks) armed = false; _last_disarm_method = method; +#if HAL_LOGGING_ENABLED Log_Write_Disarm(!do_disarm_checks, method); // Log_Write_Disarm takes "force" check_forced_logging(method); +#endif #if HAL_HAVE_SAFETY_SWITCH AP_BoardConfig *board_cfg = AP_BoardConfig::get_singleton(); @@ -1849,6 +1859,7 @@ bool AP_Arming::disarm_switch_checks(bool display_failure) const } #endif // AP_RC_CHANNEL_ENABLED +#if HAL_LOGGING_ENABLED void AP_Arming::Log_Write_Arm(const bool forced, const AP_Arming::Method method) { const struct log_Arm_Disarm pkt { @@ -1927,6 +1938,7 @@ void AP_Arming::check_forced_logging(const AP_Arming::Method method) return; } } +#endif // HAL_LOGGING_ENABLED AP_Arming *AP_Arming::_singleton = nullptr;