From 035e798b2363ba47d5890e1eb5f8e971553c8826 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 30 Nov 2020 13:48:20 +1100 Subject: [PATCH] AP_HAL_SITL: use a separate eeprom.bin for SITL build This resolves a problem in autotest where the eeprom.bin gets wiped out when we run Replay against a log as part of test.Copter.Replay --- libraries/AP_HAL_SITL/Storage.cpp | 13 +++++++++++-- libraries/AP_HAL_SITL/Storage.h | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/AP_HAL_SITL/Storage.cpp b/libraries/AP_HAL_SITL/Storage.cpp index fe6b84a19f..fcc744c5b1 100644 --- a/libraries/AP_HAL_SITL/Storage.cpp +++ b/libraries/AP_HAL_SITL/Storage.cpp @@ -1,3 +1,6 @@ +#include "Storage.h" + +#include #include #include @@ -5,10 +8,16 @@ #include #include #include -#include "Storage.h" - #include +#ifndef HAL_STORAGE_FILE +#if APM_BUILD_TYPE(APM_BUILD_Replay) +#define HAL_STORAGE_FILE "eeprom-replay.bin" +#else +#define HAL_STORAGE_FILE "eeprom.bin" +#endif +#endif + using namespace HALSITL; extern const AP_HAL::HAL& hal; diff --git a/libraries/AP_HAL_SITL/Storage.h b/libraries/AP_HAL_SITL/Storage.h index 85f2f2ab59..210f83b0af 100644 --- a/libraries/AP_HAL_SITL/Storage.h +++ b/libraries/AP_HAL_SITL/Storage.h @@ -5,10 +5,6 @@ #include "AP_HAL_SITL_Namespace.h" #include -#ifndef HAL_STORAGE_FILE -#define HAL_STORAGE_FILE "eeprom.bin" -#endif - // define which storage system to use. This allows us to test flash storage with --sitl-flash-storage // configure option #ifndef STORAGE_USE_FLASH