diff --git a/src/hasp.cpp b/src/hasp.cpp index 78c75350..fc983b0c 100644 --- a/src/hasp.cpp +++ b/src/hasp.cpp @@ -3,8 +3,9 @@ *********************/ #include "hasp_conf.h" #include -#include "ArduinoJson.h" #include "ArduinoLog.h" +#include "ArduinoJson.h" +#include "StreamUtils.h" #include "lvgl.h" #include "lv_conf.h" @@ -24,6 +25,8 @@ #include "hasp_attribute.h" #include "hasp.h" +#include "EEPROM.h" + //#if LV_USE_HASP /********************* @@ -955,6 +958,15 @@ void haspLoadPage(const char * pages) file.close(); Log.notice(F("HASP: File %s loaded"), pages); +#else + +#if HASP_USE_EEPROM > 0 + Log.notice(F("HASP: Loading jsonl from EEPROM...")); + EepromStream eepromStream(4096, 1024); + dispatchJsonl(eepromStream); + Log.notice(F("HASP: Loaded jsonl from EEPROM")); +#endif + #endif } diff --git a/src/hasp_eeprom.cpp b/src/hasp_eeprom.cpp index ddc3d8d8..d53963fe 100644 --- a/src/hasp_eeprom.cpp +++ b/src/hasp_eeprom.cpp @@ -6,6 +6,12 @@ void eepromSetup() #if defined(STM32Fxx) eeprom_buffer_fill(); + char buffer[] = "{\"objid\":10,\"id\":1,\"page\":0,\"x\":10,\"y\":45,\"w\":220,\"h\":55,\"toggle\":\"TRUE\",\"txt\":\"Toggle Me\"}"; + uint size = strlen(buffer); + uint16_t i; + for(i = 0; i < size; i++) eeprom_buffered_write_byte(i+4096, buffer[i]); + eeprom_buffered_write_byte(i+4096, 0); + // eeprom_buffer_flush(); #endif // ESP8266 // Don't start at boot, only at write