AP_Logger: remove more DataFlash references
Also strongly type the backend type
This commit is contained in:
parent
a59e1d0e0f
commit
539000df40
@ -22,9 +22,9 @@ extern const AP_HAL::HAL& hal;
|
||||
|
||||
#ifndef HAL_LOGGING_BACKENDS_DEFAULT
|
||||
# ifdef HAL_LOGGING_DATAFLASH
|
||||
# define HAL_LOGGING_BACKENDS_DEFAULT DATAFLASH_BACKEND_BLOCK
|
||||
# define HAL_LOGGING_BACKENDS_DEFAULT Backend_Type::BLOCK
|
||||
# else
|
||||
# define HAL_LOGGING_BACKENDS_DEFAULT DATAFLASH_BACKEND_FILE
|
||||
# define HAL_LOGGING_BACKENDS_DEFAULT Backend_Type::FILESYSTEM
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@ const AP_Param::GroupInfo AP_Logger::var_info[] = {
|
||||
// @Description: Bitmap of what Logger backend types to enable. Block-based logging is available on SITL and boards with dataflash chips. Multiple backends can be selected.
|
||||
// @Bitmask: 0:File,1:MAVLink,2:Block
|
||||
// @User: Standard
|
||||
AP_GROUPINFO("_BACKEND_TYPE", 0, AP_Logger, _params.backend_types, HAL_LOGGING_BACKENDS_DEFAULT),
|
||||
AP_GROUPINFO("_BACKEND_TYPE", 0, AP_Logger, _params.backend_types, uint8_t(HAL_LOGGING_BACKENDS_DEFAULT)),
|
||||
|
||||
// @Param: _FILE_BUFSIZE
|
||||
// @DisplayName: Maximum AP_Logger File Backend buffer size (in kilobytes)
|
||||
@ -102,7 +102,7 @@ void AP_Logger::Init(const struct LogStructure *structures, uint8_t num_types)
|
||||
|
||||
#if defined(HAL_BOARD_LOG_DIRECTORY)
|
||||
#if HAL_OS_POSIX_IO || HAL_OS_FATFS_IO
|
||||
if (_params.backend_types & DATAFLASH_BACKEND_FILE) {
|
||||
if (_params.backend_types & uint8_t(Backend_Type::FILESYSTEM)) {
|
||||
LoggerMessageWriter_DFLogStart *message_writer =
|
||||
new LoggerMessageWriter_DFLogStart();
|
||||
if (message_writer != nullptr) {
|
||||
@ -120,7 +120,7 @@ void AP_Logger::Init(const struct LogStructure *structures, uint8_t num_types)
|
||||
#endif // HAL_BOARD_LOG_DIRECTORY
|
||||
|
||||
#if DATAFLASH_MAVLINK_SUPPORT
|
||||
if (_params.backend_types & DATAFLASH_BACKEND_MAVLINK) {
|
||||
if (_params.backend_types & uint8_t(Backend_Type::MAVLINK)) {
|
||||
if (_next_backend == DATAFLASH_MAX_BACKENDS) {
|
||||
AP_HAL::panic("Too many backends");
|
||||
return;
|
||||
@ -140,7 +140,7 @@ void AP_Logger::Init(const struct LogStructure *structures, uint8_t num_types)
|
||||
#endif
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
if (_params.backend_types & DATAFLASH_BACKEND_BLOCK) {
|
||||
if (_params.backend_types & uint8_t(Backend_Type::BLOCK)) {
|
||||
if (_next_backend == DATAFLASH_MAX_BACKENDS) {
|
||||
AP_HAL::panic("Too many backends");
|
||||
return;
|
||||
@ -159,7 +159,7 @@ void AP_Logger::Init(const struct LogStructure *structures, uint8_t num_types)
|
||||
#endif
|
||||
|
||||
#ifdef HAL_LOGGING_DATAFLASH
|
||||
if (_params.backend_types & DATAFLASH_BACKEND_BLOCK) {
|
||||
if (_params.backend_types & uint8_t(Backend_Type::BLOCK)) {
|
||||
if (_next_backend == DATAFLASH_MAX_BACKENDS) {
|
||||
AP_HAL::panic("Too many backends");
|
||||
return;
|
||||
|
@ -30,13 +30,6 @@
|
||||
|
||||
class AP_Logger_Backend;
|
||||
|
||||
enum AP_Logger_Backend_Type {
|
||||
DATAFLASH_BACKEND_NONE = 0,
|
||||
DATAFLASH_BACKEND_FILE = (1<<0),
|
||||
DATAFLASH_BACKEND_MAVLINK = (1<<1),
|
||||
DATAFLASH_BACKEND_BLOCK = (1<<2),
|
||||
};
|
||||
|
||||
// do not do anything here apart from add stuff; maintaining older
|
||||
// entries means log analysis is easier
|
||||
enum Log_Event : uint8_t {
|
||||
@ -318,6 +311,13 @@ private:
|
||||
|
||||
void internal_error() const;
|
||||
|
||||
enum class Backend_Type : uint8_t {
|
||||
NONE = 0,
|
||||
FILESYSTEM = (1<<0),
|
||||
MAVLINK = (1<<1),
|
||||
BLOCK = (1<<2),
|
||||
};
|
||||
|
||||
/*
|
||||
* support for dynamic Write; user-supplies name, format,
|
||||
* labels and values in a single function call.
|
||||
|
Loading…
Reference in New Issue
Block a user