mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Merge branch '0.1.0-fsmc' of https://github.com/arovak/hasp-lvgl into 0.1.0-fsmc
This commit is contained in:
commit
7e3f06b76e
@ -8,7 +8,7 @@ lolin24 =
|
|||||||
-D ILI9341_DRIVER=1
|
-D ILI9341_DRIVER=1
|
||||||
-D TFT_WIDTH=240
|
-D TFT_WIDTH=240
|
||||||
-D TFT_HEIGHT=320
|
-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_FREQUENCY=40000000
|
||||||
-D SPI_TOUCH_FREQUENCY=2500000
|
-D SPI_TOUCH_FREQUENCY=2500000
|
||||||
-D SPI_READ_FREQUENCY=20000000
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
|
@ -392,4 +392,28 @@ void configOutput(const JsonObject & settings)
|
|||||||
|
|
||||||
if(password.length() > 2) output.replace(password, passmask);
|
if(password.length() > 2) output.replace(password, passmask);
|
||||||
Log.trace(F("CONF: %s"), output.c_str());
|
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
|
||||||
}
|
}
|
@ -43,5 +43,6 @@ void configOutput(const JsonObject & settings);
|
|||||||
bool configSet(int8_t & value, const JsonVariant & setting, const char * name);
|
bool configSet(int8_t & value, const JsonVariant & setting, const char * name);
|
||||||
bool configSet(uint8_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 configSet(uint16_t & value, const JsonVariant & setting, const char * name);
|
||||||
|
bool configClear();
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -119,6 +119,9 @@ void dispatchAttribute(String strTopic, const char * payload)
|
|||||||
} else if(strTopic == F("update")) {
|
} else if(strTopic == F("update")) {
|
||||||
dispatchWebUpdate(payload);
|
dispatchWebUpdate(payload);
|
||||||
|
|
||||||
|
} else if(strTopic == F("clearconfig")) {
|
||||||
|
configClear();
|
||||||
|
|
||||||
} else if(strTopic == F("setupap")) {
|
} else if(strTopic == F("setupap")) {
|
||||||
// haspDisplayAP(String(F("HASP-ABC123")).c_str(), String(F("haspadmin")).c_str());
|
// haspDisplayAP(String(F("HASP-ABC123")).c_str(), String(F("haspadmin")).c_str());
|
||||||
|
|
||||||
|
@ -1555,15 +1555,13 @@ void httpHandleResetConfig()
|
|||||||
httpMessage += F("</h1><hr>");
|
httpMessage += F("</h1><hr>");
|
||||||
|
|
||||||
if(resetConfirmed) { // User has confirmed, so reset everything
|
if(resetConfirmed) { // User has confirmed, so reset everything
|
||||||
#if HASP_USE_SPIFFS > 0
|
bool formatted = configClear();
|
||||||
bool formatted = SPIFFS.format();
|
|
||||||
if(formatted) {
|
if(formatted) {
|
||||||
httpMessage += F("<b>Resetting all saved settings and restarting device into WiFi AP mode</b>");
|
httpMessage += F("<b>Resetting all saved settings and restarting device into WiFi AP mode</b>");
|
||||||
} else {
|
} else {
|
||||||
httpMessage += F("<b>Failed to format the internal flash partition</b>");
|
httpMessage += F("<b>Failed to format the internal flash partition</b>");
|
||||||
resetConfirmed = false;
|
resetConfirmed = false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
httpMessage +=
|
httpMessage +=
|
||||||
F("<h2>Warning</h2><b>This process will reset all settings to the default values. The internal flash "
|
F("<h2>Warning</h2><b>This process will reset all settings to the default values. The internal flash "
|
||||||
|
@ -23,7 +23,7 @@ static WiFiEventHandler gotIpEventHandler, disconnectedEventHandler;
|
|||||||
// #include <WiFi.h>
|
// #include <WiFi.h>
|
||||||
// #include "WiFiSpi.h"
|
// #include "WiFiSpi.h"
|
||||||
// extern WiFiSpiClass WiFi;
|
// extern WiFiSpiClass WiFi;
|
||||||
SPIClass spi2(ESPSPI_MOSI, ESPSPI_MISO, ESPSPI_SCLK); // SPI port where esp is connected
|
SPIClass espSPI(ESPSPI_MOSI, ESPSPI_MISO, ESPSPI_SCLK); // SPI port where esp is connected
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//#include "DNSserver.h"
|
//#include "DNSserver.h"
|
||||||
@ -165,7 +165,7 @@ void wifiSetup()
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Initialize the WifiSpi library
|
// Initialize the WifiSpi library
|
||||||
WiFiSpi.init(ESPSPI_CS, 8000000, &spi2);
|
WiFiSpi.init(ESPSPI_CS, 8000000, &espSPI);
|
||||||
|
|
||||||
// check for the presence of the shield:
|
// check for the presence of the shield:
|
||||||
if (WiFiSpi.status() == WL_NO_SHIELD) {
|
if (WiFiSpi.status() == WL_NO_SHIELD) {
|
||||||
@ -181,12 +181,14 @@ void wifiSetup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attempt to connect to Wifi network
|
// attempt to connect to Wifi network
|
||||||
int status = WL_IDLE_STATUS; // the Wifi radio's status
|
// int status = WL_IDLE_STATUS; // the Wifi radio's status
|
||||||
|
if(!wifiShowAP()) {
|
||||||
// while (status != WL_CONNECTED) {
|
// while (status != WL_CONNECTED) {
|
||||||
Log.notice(F("WIFI: Connecting to : %s"), wifiSsid);
|
Log.notice(F("WIFI: Connecting to : %s"), wifiSsid);
|
||||||
// Connect to WPA/WPA2 network
|
// Connect to WPA/WPA2 network
|
||||||
status = WiFi.begin(wifiSsid, wifiPassword);
|
// status = WiFi.begin(wifiSsid, wifiPassword);
|
||||||
|
WiFi.begin(wifiSsid, wifiPassword);
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -214,7 +216,9 @@ void wifiSetup()
|
|||||||
bool wifiEvery5Seconds()
|
bool wifiEvery5Seconds()
|
||||||
{
|
{
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
if(WiFi.status() == WL_CONNECTED) {
|
if(wifiShowAP()) { // no ssid is set yet wait for user on-screen input
|
||||||
|
return false;
|
||||||
|
} else if(WiFi.status() == WL_CONNECTED) {
|
||||||
#else
|
#else
|
||||||
if(WiFi.getMode() != WIFI_STA) {
|
if(WiFi.getMode() != WIFI_STA) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user