diff --git a/lcd_config.ini b/lcd_config.ini index dcbd3ebb..0e421971 100644 --- a/lcd_config.ini +++ b/lcd_config.ini @@ -8,7 +8,7 @@ lolin24 = -D ILI9341_DRIVER=1 -D TFT_WIDTH=240 -D TFT_HEIGHT=320 - -D TFT_ROTATION=2 ; 0=0, 1=90, 2=180 or 3=270 degree + -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree -D SPI_FREQUENCY=40000000 -D SPI_TOUCH_FREQUENCY=2500000 -D SPI_READ_FREQUENCY=20000000 diff --git a/src/hasp_config.cpp b/src/hasp_config.cpp index 2def1d73..cf07995e 100644 --- a/src/hasp_config.cpp +++ b/src/hasp_config.cpp @@ -392,4 +392,28 @@ void configOutput(const JsonObject & settings) if(password.length() > 2) output.replace(password, passmask); Log.trace(F("CONF: %s"), output.c_str()); +} + +bool configClear() +{ +#if defined(STM32F4xx) + Log.verbose(F("CONF: Clearing EEPROM")); + char buffer[1024 + 128]; + memset(buffer, 1 ,sizeof(buffer)); + if(sizeof(buffer) > 0) { + uint16_t i; + for(i = 0; i < sizeof(buffer); i++) eeprom_buffered_write_byte(i, buffer[i]); + eeprom_buffered_write_byte(i, 0); + eeprom_buffer_flush(); + Log.verbose(F("CONF: [SUCCESS] Cleared EEPROM")); + return true; + } else { + Log.error(F("CONF: Failed to clear to EEPROM")); + return false; + } +#elif HASP_USE_SPIFFS > 0 + return SPIFFS.format(); +#else + return false; +#endif } \ No newline at end of file diff --git a/src/hasp_config.h b/src/hasp_config.h index ee425190..cb447c23 100644 --- a/src/hasp_config.h +++ b/src/hasp_config.h @@ -43,5 +43,6 @@ void configOutput(const JsonObject & settings); bool configSet(int8_t & value, const JsonVariant & setting, const char * name); bool configSet(uint8_t & value, const JsonVariant & setting, const char * name); bool configSet(uint16_t & value, const JsonVariant & setting, const char * name); +bool configClear(); #endif \ No newline at end of file diff --git a/src/hasp_dispatch.cpp b/src/hasp_dispatch.cpp index cec24e28..94e5ae53 100644 --- a/src/hasp_dispatch.cpp +++ b/src/hasp_dispatch.cpp @@ -119,6 +119,9 @@ void dispatchAttribute(String strTopic, const char * payload) } else if(strTopic == F("update")) { dispatchWebUpdate(payload); + } else if(strTopic == F("clearconfig")) { + configClear(); + } else if(strTopic == F("setupap")) { // haspDisplayAP(String(F("HASP-ABC123")).c_str(), String(F("haspadmin")).c_str()); diff --git a/src/hasp_http.cpp b/src/hasp_http.cpp index d5d018ba..16667ad2 100644 --- a/src/hasp_http.cpp +++ b/src/hasp_http.cpp @@ -1555,15 +1555,13 @@ void httpHandleResetConfig() httpMessage += F("