From 34524d3475aebfdcd2777ba08fd229ed839f4c47 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 4 Sep 2023 20:05:11 +1000 Subject: [PATCH] AP_Logger: correct logging when rally disabled --- libraries/AP_Logger/AP_Logger_config.h | 5 ++++- libraries/AP_Logger/LoggerMessageWriter.cpp | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Logger/AP_Logger_config.h b/libraries/AP_Logger/AP_Logger_config.h index 92f25cc3ca..1087a9a4e3 100644 --- a/libraries/AP_Logger/AP_Logger_config.h +++ b/libraries/AP_Logger/AP_Logger_config.h @@ -45,4 +45,7 @@ #define REPLAY_LOG_NEW_MSG_MIN 220 #include -#define HAL_LOGGER_FENCE_ENABLED AP_FENCE_ENABLED +#define HAL_LOGGER_FENCE_ENABLED HAL_LOGGING_ENABLED && AP_FENCE_ENABLED + +#include +#define HAL_LOGGER_RALLY_ENABLED HAL_LOGGING_ENABLED && HAL_RALLY_ENABLED diff --git a/libraries/AP_Logger/LoggerMessageWriter.cpp b/libraries/AP_Logger/LoggerMessageWriter.cpp index 76d11f5524..2de1050aef 100644 --- a/libraries/AP_Logger/LoggerMessageWriter.cpp +++ b/libraries/AP_Logger/LoggerMessageWriter.cpp @@ -7,6 +7,10 @@ #include #endif +#if HAL_LOGGER_RALLY_ENABLED +#include +#endif + #define FORCE_VERSION_H_INCLUDE #include "ap_version.h" #undef FORCE_VERSION_H_INCLUDE @@ -46,7 +50,7 @@ void LoggerMessageWriter_DFLogStart::reset() #if AP_MISSION_ENABLED _writeentiremission.reset(); #endif -#if HAL_RALLY_ENABLED +#if HAL_LOGGER_RALLY_ENABLED _writeallrallypoints.reset(); #endif #if HAL_LOGGER_FENCE_ENABLED @@ -183,7 +187,7 @@ void LoggerMessageWriter_DFLogStart::process() } } #endif -#if HAL_RALLY_ENABLED +#if HAL_LOGGER_RALLY_ENABLED if (!_writeallrallypoints.finished()) { _writeallrallypoints.process(); if (!_writeallrallypoints.finished()) { @@ -235,7 +239,7 @@ bool LoggerMessageWriter_DFLogStart::writeentiremission() } #endif -#if HAL_RALLY_ENABLED +#if HAL_LOGGER_RALLY_ENABLED bool LoggerMessageWriter_DFLogStart::writeallrallypoints() { if (stage != Stage::DONE) { @@ -356,6 +360,7 @@ void LoggerMessageWriter_WriteSysInfo::process() { _finished = true; // all done! } +#if HAL_LOGGER_RALLY_ENABLED void LoggerMessageWriter_WriteAllRallyPoints::process() { const AP_Rally *_rally = AP::rally(); @@ -405,6 +410,7 @@ void LoggerMessageWriter_WriteAllRallyPoints::reset() stage = Stage::WRITE_NEW_RALLY_MESSAGE; _rally_number_to_send = 0; } +#endif // HAL_LOGGER_RALLY_ENABLED void LoggerMessageWriter_WriteEntireMission::process() { const AP_Mission *_mission = AP::mission();