From 580199dfba7fdff1f52c502ca2e1067c0d1fdc0d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 26 Feb 2024 11:27:02 +1100 Subject: [PATCH] AP_Logger: disable HAL_LOGGING_BLOCK_ENABLED if not HAL_LOGGING_ENABLED HAL_LOGGING_DATAFLASH_ENABLED is set unconditionally in some hwdefs, but we still need to honour HAL_LOGGING_ENABLED --- libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp | 4 ++-- libraries/AP_Logger/AP_Logger_Flash_JEDEC.h | 4 ++-- libraries/AP_Logger/AP_Logger_W25NXX.cpp | 4 ++-- libraries/AP_Logger/AP_Logger_W25NXX.h | 8 +++++--- libraries/AP_Logger/AP_Logger_config.h | 10 +++++++++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp b/libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp index e40eab7882..025c53e309 100644 --- a/libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp +++ b/libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp @@ -4,7 +4,7 @@ #include "AP_Logger_config.h" -#if HAL_LOGGING_DATAFLASH_ENABLED +#if HAL_LOGGING_FLASH_JEDEC_ENABLED #include @@ -323,4 +323,4 @@ void AP_Logger_Flash_JEDEC::WriteEnable(void) dev->transfer(&b, 1, nullptr, 0); } -#endif // HAL_LOGGING_DATAFLASH_ENABLED +#endif // HAL_LOGGING_FLASH_JEDEC_ENABLED diff --git a/libraries/AP_Logger/AP_Logger_Flash_JEDEC.h b/libraries/AP_Logger/AP_Logger_Flash_JEDEC.h index c51ae1b3d2..1a85e51575 100644 --- a/libraries/AP_Logger/AP_Logger_Flash_JEDEC.h +++ b/libraries/AP_Logger/AP_Logger_Flash_JEDEC.h @@ -7,7 +7,7 @@ #include "AP_Logger_Block.h" -#if HAL_LOGGING_DATAFLASH_ENABLED +#if HAL_LOGGING_FLASH_JEDEC_ENABLED class AP_Logger_Flash_JEDEC : public AP_Logger_Block { public: @@ -46,4 +46,4 @@ private: bool read_cache_valid; }; -#endif // HAL_LOGGING_DATAFLASH_ENABLED +#endif // HAL_LOGGING_FLASH_JEDEC_ENABLED diff --git a/libraries/AP_Logger/AP_Logger_W25NXX.cpp b/libraries/AP_Logger/AP_Logger_W25NXX.cpp index d10facf8b9..df3e8bcea2 100644 --- a/libraries/AP_Logger/AP_Logger_W25NXX.cpp +++ b/libraries/AP_Logger/AP_Logger_W25NXX.cpp @@ -7,7 +7,7 @@ #include "AP_Logger_W25NXX.h" -#if HAL_LOGGING_DATAFLASH_ENABLED +#if HAL_LOGGING_FLASH_W25NXX_ENABLED #include @@ -341,4 +341,4 @@ void AP_Logger_W25NXX::WriteEnable(void) dev->transfer(&b, 1, nullptr, 0); } -#endif // HAL_LOGGING_DATAFLASH_ENABLED +#endif // HAL_LOGGING_FLASH_W25NXX_ENABLED diff --git a/libraries/AP_Logger/AP_Logger_W25NXX.h b/libraries/AP_Logger/AP_Logger_W25NXX.h index 5e7c8d7fb4..c384fa97db 100644 --- a/libraries/AP_Logger/AP_Logger_W25NXX.h +++ b/libraries/AP_Logger/AP_Logger_W25NXX.h @@ -3,12 +3,14 @@ */ #pragma once +#include "AP_Logger_config.h" + +#if HAL_LOGGING_FLASH_W25NXX_ENABLED + #include #include "AP_Logger_Block.h" -#if HAL_LOGGING_DATAFLASH_ENABLED - class AP_Logger_W25NXX : public AP_Logger_Block { public: AP_Logger_W25NXX(AP_Logger &front, LoggerMessageWriter_DFLogStart *writer) : @@ -47,4 +49,4 @@ private: bool read_cache_valid; }; -#endif // HAL_LOGGING_DATAFLASH_ENABLED +#endif // HAL_LOGGING_FLASH_W25NXX_ENABLED diff --git a/libraries/AP_Logger/AP_Logger_config.h b/libraries/AP_Logger/AP_Logger_config.h index 8627867a38..a5a3508043 100644 --- a/libraries/AP_Logger/AP_Logger_config.h +++ b/libraries/AP_Logger/AP_Logger_config.h @@ -26,11 +26,19 @@ #endif #if HAL_LOGGING_DATAFLASH_ENABLED - #define HAL_LOGGING_BLOCK_ENABLED 1 + #define HAL_LOGGING_BLOCK_ENABLED HAL_LOGGING_ENABLED #else #define HAL_LOGGING_BLOCK_ENABLED 0 #endif +#ifndef HAL_LOGGING_FLASH_W25NXX_ENABLED +#define HAL_LOGGING_FLASH_W25NXX_ENABLED HAL_LOGGING_BLOCK_ENABLED +#endif + +#ifndef HAL_LOGGING_FLASH_JEDEC_ENABLED +#define HAL_LOGGING_FLASH_JEDEC_ENABLED HAL_LOGGING_BLOCK_ENABLED +#endif + #if HAL_LOGGING_FILESYSTEM_ENABLED #if !defined (HAL_BOARD_LOG_DIRECTORY)