From 8afc07d85b4e64cfd8f2d48e8cfdf4c286cf8403 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Wed, 6 Jul 2022 11:04:19 +0100 Subject: [PATCH] AP_VisualOdom: only include log structure if enabled --- libraries/AP_VisualOdom/AP_VisualOdom.h | 6 +----- libraries/AP_VisualOdom/AP_VisualOdom_config.h | 7 +++++++ libraries/AP_VisualOdom/LogStructure.h | 6 +++++- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 libraries/AP_VisualOdom/AP_VisualOdom_config.h diff --git a/libraries/AP_VisualOdom/AP_VisualOdom.h b/libraries/AP_VisualOdom/AP_VisualOdom.h index 765e15700c..e13bb562f1 100644 --- a/libraries/AP_VisualOdom/AP_VisualOdom.h +++ b/libraries/AP_VisualOdom/AP_VisualOdom.h @@ -14,11 +14,7 @@ */ #pragma once -#include - -#ifndef HAL_VISUALODOM_ENABLED -#define HAL_VISUALODOM_ENABLED (!HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024) -#endif +#include "AP_VisualOdom_config.h" #if HAL_VISUALODOM_ENABLED diff --git a/libraries/AP_VisualOdom/AP_VisualOdom_config.h b/libraries/AP_VisualOdom/AP_VisualOdom_config.h new file mode 100644 index 0000000000..e38580cd3b --- /dev/null +++ b/libraries/AP_VisualOdom/AP_VisualOdom_config.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +#ifndef HAL_VISUALODOM_ENABLED +#define HAL_VISUALODOM_ENABLED (!HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024) +#endif diff --git a/libraries/AP_VisualOdom/LogStructure.h b/libraries/AP_VisualOdom/LogStructure.h index 51b92ccf4f..cb15e181c4 100644 --- a/libraries/AP_VisualOdom/LogStructure.h +++ b/libraries/AP_VisualOdom/LogStructure.h @@ -1,6 +1,7 @@ #pragma once #include +#include "AP_VisualOdom_config.h" #define LOG_IDS_FROM_VISUALODOM \ LOG_VISUALODOM_MSG, \ @@ -87,6 +88,7 @@ struct PACKED log_VisualVelocity { uint8_t ignored; }; +#if HAL_VISUALODOM_ENABLED #define LOG_STRUCTURE_FROM_VISUALODOM \ { LOG_VISUALODOM_MSG, sizeof(log_VisualOdom), \ "VISO", "Qffffffff", "TimeUS,dt,AngDX,AngDY,AngDZ,PosDX,PosDY,PosDZ,conf", "ssrrrmmm-", "FF000000-" }, \ @@ -94,4 +96,6 @@ struct PACKED log_VisualVelocity { "VISP", "QQIffffffffBB", "TimeUS,RTimeUS,CTimeMS,PX,PY,PZ,Roll,Pitch,Yaw,PErr,AErr,Rst,Ign", "sssmmmddhmd--", "FFC00000000--" }, \ { LOG_VISUALVEL_MSG, sizeof(log_VisualVelocity), \ "VISV", "QQIffffBB", "TimeUS,RTimeUS,CTimeMS,VX,VY,VZ,VErr,Rst,Ign", "sssnnnn--", "FFC0000--" }, - +#else +#define LOG_STRUCTURE_FROM_VISUALODOM +#endif