From fdfe6eeb65029a9333c2461925a76340500f4d0a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 14 Jul 2023 10:58:09 +1000 Subject: [PATCH] RC_Channel: allow compilation with HAL_LOGGING_ENABLED false --- libraries/RC_Channel/RC_Channel.cpp | 9 +++++++-- libraries/RC_Channel/RC_Channels.cpp | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index f3c6653f34..cebb53ae2f 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -877,14 +877,14 @@ void RC_Channel::do_aux_function_avoid_adsb(const AuxSwitchPos ch_flag) return; } avoidance->enable(); - AP::logger().Write_Event(LogEvent::AVOIDANCE_ADSB_ENABLE); + LOGGER_WRITE_EVENT(LogEvent::AVOIDANCE_ADSB_ENABLE); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "ADSB Avoidance Enabled"); return; } // disable AP_Avoidance avoidance->disable(); - AP::logger().Write_Event(LogEvent::AVOIDANCE_ADSB_DISABLE); + LOGGER_WRITE_EVENT(LogEvent::AVOIDANCE_ADSB_DISABLE); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "ADSB Avoidance Disabled"); #endif } @@ -1216,6 +1216,7 @@ bool RC_Channel::run_aux_function(aux_func_t ch_option, AuxSwitchPos pos, AuxFun #endif const bool ret = do_aux_function(ch_option, pos); +#if HAL_LOGGING_ENABLED // @LoggerMessage: AUXF // @Description: Auxiliary function invocation information // @Field: TimeUS: Time since system startup @@ -1238,6 +1239,8 @@ bool RC_Channel::run_aux_function(aux_func_t ch_option, AuxSwitchPos pos, AuxFun uint8_t(source), uint8_t(ret) ); +#endif + return ret; } @@ -1544,6 +1547,7 @@ bool RC_Channel::do_aux_function(const aux_func_t ch_option, const AuxSwitchPos } #endif +#if HAL_LOGGING_ENABLED case AUX_FUNC::LOG_PAUSE: { AP_Logger *logger = AP_Logger::get_singleton(); switch (ch_flag) { @@ -1559,6 +1563,7 @@ bool RC_Channel::do_aux_function(const aux_func_t ch_option, const AuxSwitchPos } break; } +#endif #if COMPASS_CAL_ENABLED case AUX_FUNC::MAG_CAL: { diff --git a/libraries/RC_Channel/RC_Channels.cpp b/libraries/RC_Channel/RC_Channels.cpp index 8578904f5a..0ecdaba6d9 100644 --- a/libraries/RC_Channel/RC_Channels.cpp +++ b/libraries/RC_Channel/RC_Channels.cpp @@ -169,10 +169,12 @@ void RC_Channels::read_aux_all() } need_log |= c->read_aux(); } +#if HAL_LOGGING_ENABLED if (need_log) { // guarantee that we log when a switch changes AP::logger().Write_RCIN(); } +#endif } void RC_Channels::init_aux_all()