Skip to content

Commit

Permalink
AP_Logger: disable HAL_LOGGING_BLOCK_ENABLED if not HAL_LOGGING_ENABLED
Browse files Browse the repository at this point in the history
HAL_LOGGING_DATAFLASH_ENABLED is set unconditionally in some hwdefs, but we still need to honour HAL_LOGGING_ENABLED
  • Loading branch information
peterbarker committed Jun 25, 2024
1 parent 0e6543f commit 580199d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_Logger/AP_Logger_Flash_JEDEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "AP_Logger_config.h"

#if HAL_LOGGING_DATAFLASH_ENABLED
#if HAL_LOGGING_FLASH_JEDEC_ENABLED

#include <AP_HAL/AP_HAL.h>

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions libraries/AP_Logger/AP_Logger_Flash_JEDEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -46,4 +46,4 @@ class AP_Logger_Flash_JEDEC : public AP_Logger_Block {
bool read_cache_valid;
};

#endif // HAL_LOGGING_DATAFLASH_ENABLED
#endif // HAL_LOGGING_FLASH_JEDEC_ENABLED
4 changes: 2 additions & 2 deletions libraries/AP_Logger/AP_Logger_W25NXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "AP_Logger_W25NXX.h"

#if HAL_LOGGING_DATAFLASH_ENABLED
#if HAL_LOGGING_FLASH_W25NXX_ENABLED

#include <stdio.h>

Expand Down Expand Up @@ -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
8 changes: 5 additions & 3 deletions libraries/AP_Logger/AP_Logger_W25NXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
*/
#pragma once

#include "AP_Logger_config.h"

#if HAL_LOGGING_FLASH_W25NXX_ENABLED

#include <AP_HAL/AP_HAL.h>

#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) :
Expand Down Expand Up @@ -47,4 +49,4 @@ class AP_Logger_W25NXX : public AP_Logger_Block {
bool read_cache_valid;
};

#endif // HAL_LOGGING_DATAFLASH_ENABLED
#endif // HAL_LOGGING_FLASH_W25NXX_ENABLED
10 changes: 9 additions & 1 deletion libraries/AP_Logger/AP_Logger_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 580199d

Please sign in to comment.