diff --git a/src/eeprom.cpp b/src/eeprom.cpp index 1064a2a..e833012 100644 --- a/src/eeprom.cpp +++ b/src/eeprom.cpp @@ -6,33 +6,25 @@ #include "eeprom.h" -#include +#ifdef CONFIG_EEPROM -#ifndef UNIT_TEST #include #include #include -#endif #include "mcu.h" #include "thingset.h" #include "data_nodes.h" -#include "helper.h" - -#ifndef UNIT_TEST -K_MUTEX_DEFINE(_lock); -static uint8_t buf[512]; // Buffer used by store and restore functions -#endif +#include #define EEPROM_HEADER_SIZE 8 // bytes -#define EEPROM_UPDATE_INTERVAL (6*60*60) // update every 6 hours +K_MUTEX_DEFINE(_lock); +static uint8_t buf[512]; // Buffer used by store and restore functions extern ThingSet ts; -#ifndef UNIT_TEST - uint32_t _calc_crc(const uint8_t *buf, size_t len) { #if defined(CONFIG_SOC_SERIES_STM32G4X) @@ -159,6 +151,8 @@ void eeprom_restore_data() {;} #endif +#include "helper.h" + void eeprom_update() { if (uptime() % EEPROM_UPDATE_INTERVAL == 0 && uptime() > 0) { diff --git a/src/eeprom.h b/src/eeprom.h index a93cf07..ea9b70e 100644 --- a/src/eeprom.h +++ b/src/eeprom.h @@ -7,6 +7,8 @@ #ifndef EEPROM_H #define EEPROM_H +#define EEPROM_UPDATE_INTERVAL (6*60*60) // update every 6 hours + /** * @file *