Open anjok opened 9 months ago
I had some issues with the EEPROM store and wanted to try the dummy store to double.check. Unfortunately it didn't compile. Here's what I did to get it to run.
stellarmate@astroberry:~/astro/OpenAstroTracker-Firmware $ git diff src/EPROMStore.cpp diff --git a/src/EPROMStore.cpp b/src/EPROMStore.cpp index 37c5c22..52f6f49 100644 --- a/src/EPROMStore.cpp +++ b/src/EPROMStore.cpp @@ -1,9 +1,10 @@ #include "inc/Globals.hpp" +#include "../Configuration.hpp" +#if USE_DUMMY_EEPROM == false PUSH_NO_WARNINGS #include <EEPROM.h> POP_NO_WARNINGS - -#include "../Configuration.hpp" +#endif #include "Utility.hpp" #include "EPROMStore.hpp" @@ -17,13 +18,15 @@ const float SteppingStorageNormalized = 25600.0; #if USE_DUMMY_EEPROM == true -static uint8_t dummyEepromStorage[EEPROMStore::STORE_SIZE]; +static uint8_t *dummyEepromStorage; // Initialize the EEPROM object for ESP boards, setting aside storage void EEPROMStore::initialize() { - LOG(DEBUG_EEPROM, "[EEPROM]: Dummy: Startup with %d bytes", EEPROMStore::STORE_SIZE); - memset(dummyEepromStorage, 0, sizeof(dummyEepromStorage)); + size_t size = EEPROMStore::STORE_SIZE; + dummyEepromStorage = (uint8_t *)malloc(size); + LOG(DEBUG_EEPROM, "[EEPROM]: Dummy: Startup with %d bytes", size); + memset(dummyEepromStorage, 0, size); displayContents(); // Will always be empty at restart }
I had some issues with the EEPROM store and wanted to try the dummy store to double.check. Unfortunately it didn't compile. Here's what I did to get it to run.