AP_Logger: create and use AP_Logger_config.h

This commit is contained in:
Peter Barker 2023-01-01 13:50:41 +11:00 committed by Andrew Tridgell
parent bd27a8c650
commit 6524bf3729
2 changed files with 57 additions and 53 deletions

View File

@ -3,56 +3,7 @@
/* ************************************************************ */
#pragma once
#include <AP_Filesystem/AP_Filesystem_config.h>
#ifndef HAL_LOGGING_ENABLED
#define HAL_LOGGING_ENABLED 1
#endif
// set default for HAL_LOGGING_DATAFLASH_ENABLED
#ifndef HAL_LOGGING_DATAFLASH_ENABLED
#define HAL_LOGGING_DATAFLASH_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif
#ifndef HAL_LOGGING_MAVLINK_ENABLED
#define HAL_LOGGING_MAVLINK_ENABLED HAL_LOGGING_ENABLED
#endif
#ifndef HAL_LOGGING_FILESYSTEM_ENABLED
#if HAVE_FILESYSTEM_SUPPORT
#define HAL_LOGGING_FILESYSTEM_ENABLED HAL_LOGGING_ENABLED
#else
#define HAL_LOGGING_FILESYSTEM_ENABLED 0
#endif
#endif
#if HAL_LOGGING_DATAFLASH_ENABLED
#define HAL_LOGGING_BLOCK_ENABLED 1
#else
#define HAL_LOGGING_BLOCK_ENABLED 0
#endif
#if HAL_LOGGING_FILESYSTEM_ENABLED
#if !defined (HAL_BOARD_LOG_DIRECTORY)
#error Need HAL_BOARD_LOG_DIRECTORY for filesystem backend support
#endif
#if !defined (HAVE_FILESYSTEM_SUPPORT)
#error Need HAVE_FILESYSTEM_SUPPORT for filesystem backend support
#endif
#endif
#ifndef HAL_LOGGER_FILE_CONTENTS_ENABLED
#define HAL_LOGGER_FILE_CONTENTS_ENABLED HAL_LOGGING_FILESYSTEM_ENABLED
#endif
// range of IDs to allow for new messages during replay. It is very
// useful to be able to add new messages during a replay, but we need
// to avoid colliding with existing messages
#define REPLAY_LOG_NEW_MSG_MAX 230
#define REPLAY_LOG_NEW_MSG_MIN 220
#include "AP_Logger_config.h"
#include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h>
@ -61,9 +12,6 @@
#include <AP_Logger/LogStructure.h>
#include <AP_Vehicle/ModeReason.h>
#include <AC_Fence/AC_Fence_config.h>
#define HAL_LOGGER_FENCE_ENABLED (AP_FENCE_ENABLED && !defined(HAL_BUILD_AP_PERIPH))
#if HAL_LOGGER_FENCE_ENABLED
#include <AC_Fence/AC_Fence.h>
#endif

View File

@ -0,0 +1,56 @@
#pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#include <AP_Filesystem/AP_Filesystem_config.h>
#ifndef HAL_LOGGING_ENABLED
#define HAL_LOGGING_ENABLED 1
#endif
// set default for HAL_LOGGING_DATAFLASH_ENABLED
#ifndef HAL_LOGGING_DATAFLASH_ENABLED
#define HAL_LOGGING_DATAFLASH_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL)
#endif
#ifndef HAL_LOGGING_MAVLINK_ENABLED
#define HAL_LOGGING_MAVLINK_ENABLED HAL_LOGGING_ENABLED
#endif
#ifndef HAL_LOGGING_FILESYSTEM_ENABLED
#if HAVE_FILESYSTEM_SUPPORT
#define HAL_LOGGING_FILESYSTEM_ENABLED HAL_LOGGING_ENABLED
#else
#define HAL_LOGGING_FILESYSTEM_ENABLED 0
#endif
#endif
#if HAL_LOGGING_DATAFLASH_ENABLED
#define HAL_LOGGING_BLOCK_ENABLED 1
#else
#define HAL_LOGGING_BLOCK_ENABLED 0
#endif
#if HAL_LOGGING_FILESYSTEM_ENABLED
#if !defined (HAL_BOARD_LOG_DIRECTORY)
#error Need HAL_BOARD_LOG_DIRECTORY for filesystem backend support
#endif
#if !defined (HAVE_FILESYSTEM_SUPPORT)
#error Need HAVE_FILESYSTEM_SUPPORT for filesystem backend support
#endif
#endif
#ifndef HAL_LOGGER_FILE_CONTENTS_ENABLED
#define HAL_LOGGER_FILE_CONTENTS_ENABLED HAL_LOGGING_FILESYSTEM_ENABLED
#endif
// range of IDs to allow for new messages during replay. It is very
// useful to be able to add new messages during a replay, but we need
// to avoid colliding with existing messages
#define REPLAY_LOG_NEW_MSG_MAX 230
#define REPLAY_LOG_NEW_MSG_MIN 220
#include <AC_Fence/AC_Fence_config.h>
#define HAL_LOGGER_FENCE_ENABLED (AP_FENCE_ENABLED && !defined(HAL_BUILD_AP_PERIPH))