diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index 4b3a8b56a..2cd2d0556 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -5,7 +5,6 @@ #include "app.h" -#include "favicon.h" #include "html/h/index_html.h" #include "html/h/setup_html.h" #include "html/h/hoymiles_html.h" @@ -191,7 +190,7 @@ void app::setup(uint32_t timeout) { DPRINTLN(DBG_DEBUG, F("NXT pos: ") + String(ADDR_NEXT)); DPRINTLN(DBG_INFO, F("Settings not valid, erasing ...")); eraseSettings(); - saveValues(false); + saveValues(NULL, false); delay(100); DPRINTLN(DBG_INFO, F("... restarting ...")); delay(100); @@ -553,7 +552,7 @@ void app::processPayload(bool retransmit) { //----------------------------------------------------------------------------- -void app::showIndex(void) { +void app::showIndex(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showIndex")); String html = FPSTR(index_html); html.replace(F("{DEVICE}"), mDeviceName); @@ -561,12 +560,12 @@ void app::showIndex(void) { html.replace(F("{TS}"), String(mSendInterval) + " "); html.replace(F("{JS_TS}"), String(mSendInterval * 1000)); html.replace(F("{BUILD}"), String(AUTO_GIT_HASH)); - mWeb->send(200, "text/html", html); + request->send(200, "text/html", html); } //----------------------------------------------------------------------------- -void app::showSetup(void) { +void app::showSetup(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showSetup")); // overrides same method in main.cpp @@ -696,22 +695,22 @@ void app::showSetup(void) { html.replace(F("{MQTT_INTVL}"), String(mMqttInterval)); } - mWeb->send(200, F("text/html"), html); + request->send(200, F("text/html"), html); } //----------------------------------------------------------------------------- -void app::showSave(void) { +void app::showSave(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showSave")); - saveValues(true); + saveValues(request, true); } //----------------------------------------------------------------------------- -void app::showErase() { +void app::showErase(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showErase")); eraseSettings(); - showReboot(); + showReboot(request); } //----------------------------------------------------------------------------- @@ -788,7 +787,7 @@ void app::cbMqtt(char* topic, byte* payload, unsigned int length) { //----------------------------------------------------------------------------- -void app::showStatistics(void) { +void app::showStatistics(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showStatistics")); String content = F("Receive success: ") + String(mRxSuccess) + "\n"; content += F("Receive fail: ") + String(mRxFailed) + "\n"; @@ -834,7 +833,7 @@ void app::showStatistics(void) { content += F("not "); content += F("connected\n"); - mWeb->send(200, F("text/plain"), content); + request->send(200, F("text/plain"), content); } //----------------------------------------------------------------------------- @@ -856,28 +855,18 @@ void app::webapi(void) { // ToDo //----------------------------------------------------------------------------- -void app::showHoymiles(void) { +void app::showHoymiles(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showHoymiles")); String html = FPSTR(hoymiles_html); html.replace(F("{DEVICE}"), mDeviceName); html.replace(F("{VERSION}"), mVersion); html.replace(F("{TS}"), String(mSendInterval) + " "); html.replace(F("{JS_TS}"), String(mSendInterval * 1000)); - mWeb->send(200, F("text/html"), html); + request->send(200, F("text/html"), html); } - -//----------------------------------------------------------------------------- -void app::showFavicon(void) { - DPRINTLN(DBG_VERBOSE, F("app::showFavicon")); - static const char favicon_type[] PROGMEM = "image/x-icon"; - static const char favicon_content[] PROGMEM = FAVICON_PANEL_16; - mWeb->send_P(200, favicon_type, favicon_content, sizeof(favicon_content)); -} - - //----------------------------------------------------------------------------- -void app::showLiveData(void) { +void app::showLiveData(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showLiveData")); String modHtml; for(uint8_t id = 0; id < mSys->getNumInverters(); id++) { @@ -931,7 +920,6 @@ void app::showLiveData(void) { } } modHtml += ""; - yield(); } modHtml += F("
Last received data requested at: ") + getDateTimeStr(iv->ts) + F("
"); modHtml += F(""); @@ -948,12 +936,12 @@ void app::showLiveData(void) { #endif } } - mWeb->send(200, F("text/html"), modHtml); + request->send(200, F("text/html"), modHtml); } //----------------------------------------------------------------------------- -void app::showJSON(void) { +void app::showJSON(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("app::showJSON")); String modJson; @@ -974,124 +962,137 @@ void app::showJSON(void) { } modJson += F("\"json_ts\": \"") + String(getDateTimeStr(mTimestamp)) + F("\"\n}\n"); - // mWeb->send(200, F("text/json"), modJson); - mWeb->send(200, F("application/json"), modJson); // the preferred content-type (https://stackoverflow.com/questions/22406077/what-is-the-exact-difference-between-content-type-text-json-and-application-jso) + // request->send(200, F("text/json"), modJson); + request->send(200, F("application/json"), modJson); // the preferred content-type (https://stackoverflow.com/questions/22406077/what-is-the-exact-difference-between-content-type-text-json-and-application-jso) } //----------------------------------------------------------------------------- -void app::saveValues(bool webSend = true) { +void app::saveValues(AsyncWebServerRequest *request, bool webSend = true) { DPRINTLN(DBG_VERBOSE, F("app::saveValues")); - Main::saveValues(false); // general configuration - - if(mWeb->args() > 0) { - char buf[20] = {0}; - uint8_t i = 0; - uint16_t interval; - uint16_t activepowerlimit=-1; + Main::saveValues(request, false); // general configuration - // inverter - serial_u addr; - for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) { - // address - mWeb->arg("inv" + String(i) + "Addr").toCharArray(buf, 20); - if(strlen(buf) == 0) - memset(buf, 0, 20); - addr.u64 = Serial2u64(buf); - mEep->write(ADDR_INV_ADDR + (i * 8), addr.u64); - - // active power limit - activepowerlimit = mWeb->arg("inv" + String(i) + "ActivePowerLimit").toInt(); - if (activepowerlimit != 0xffff && activepowerlimit > 0) { - mEep->write(ADDR_INV_PWR_LIM + i * 2,activepowerlimit); - } - - // name - mWeb->arg("inv" + String(i) + "Name").toCharArray(buf, 20); - mEep->write(ADDR_INV_NAME + (i * MAX_NAME_LENGTH), buf, MAX_NAME_LENGTH); - - // max channel power / name - for(uint8_t j = 0; j < 4; j++) { - uint16_t pwr = mWeb->arg("inv" + String(i) + "ModPwr" + String(j)).toInt(); - mEep->write(ADDR_INV_CH_PWR + (i * 2 * 4) + (j*2), pwr); - memset(buf, 0, 20); - mWeb->arg("inv" + String(i) + "ModName" + String(j)).toCharArray(buf, 20); - mEep->write(ADDR_INV_CH_NAME + (i * 4 * MAX_NAME_LENGTH) + j * MAX_NAME_LENGTH, buf, MAX_NAME_LENGTH); - } - } + if(NULL != request) { + if(request->args() > 0) { + char *p; + char buf[20] = {0}; + uint8_t i = 0; + uint16_t interval; + uint16_t activepowerlimit=-1; - interval = mWeb->arg("invInterval").toInt(); - mEep->write(ADDR_INV_INTERVAL, interval); - i = mWeb->arg("invRetry").toInt(); - mEep->write(ADDR_INV_MAX_RTRY, i); + // inverter + serial_u addr; + for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) { + // address + request->arg("inv" + String(i) + "Addr").toCharArray(buf, 20); + if(strlen(buf) == 0) + memset(buf, 0, 20); + addr.u64 = Serial2u64(buf); + mEep->write(ADDR_INV_ADDR + (i * 8), addr.u64); + + // active power limit + activepowerlimit = request->arg("inv" + String(i) + "ActivePowerLimit").toInt(); + if (activepowerlimit != 0xffff && activepowerlimit > 0) { + mEep->write(ADDR_INV_PWR_LIM + i * 2,activepowerlimit); + } - // pinout - for(uint8_t i = 0; i < 3; i ++) { - uint8_t pin = mWeb->arg(String(pinArgNames[i])).toInt(); - mEep->write(ADDR_PINOUT + i, pin); - } + // name + request->arg("inv" + String(i) + "Name").toCharArray(buf, 20); + mEep->write(ADDR_INV_NAME + (i * MAX_NAME_LENGTH), buf, MAX_NAME_LENGTH); + + // max channel power / name + for(uint8_t j = 0; j < 4; j++) { + uint16_t pwr = request->arg("inv" + String(i) + "ModPwr" + String(j)).toInt(); + mEep->write(ADDR_INV_CH_PWR + (i * 2 * 4) + (j*2), pwr); + memset(buf, 0, 20); + request->arg("inv" + String(i) + "ModName" + String(j)).toCharArray(buf, 20); + mEep->write(ADDR_INV_CH_NAME + (i * 4 * MAX_NAME_LENGTH) + j * MAX_NAME_LENGTH, buf, MAX_NAME_LENGTH); + } + interval = request->arg("invInterval").toInt(); + mEep->write(ADDR_INV_INTERVAL, interval); + i = request->arg("invRetry").toInt(); + mEep->write(ADDR_INV_MAX_RTRY, i); - // nrf24 amplifier power - mSys->Radio.AmplifierPower = mWeb->arg("rf24Power").toInt() & 0x03; - mEep->write(ADDR_RF24_AMP_PWR, mSys->Radio.AmplifierPower); - - // ntp - char ntpAddr[NTP_ADDR_LEN] = {0}; - uint16_t ntpPort; - mWeb->arg("ntpAddr").toCharArray(ntpAddr, NTP_ADDR_LEN); - ntpPort = mWeb->arg("ntpPort").toInt(); - mEep->write(ADDR_NTP_ADDR, ntpAddr, NTP_ADDR_LEN); - mEep->write(ADDR_NTP_PORT, ntpPort); - - // mqtt - char mqttAddr[MQTT_ADDR_LEN] = {0}; - uint16_t mqttPort; - char mqttUser[MQTT_USER_LEN]; - char mqttPwd[MQTT_PWD_LEN]; - char mqttTopic[MQTT_TOPIC_LEN]; - mWeb->arg("mqttAddr").toCharArray(mqttAddr, MQTT_ADDR_LEN); - mWeb->arg("mqttUser").toCharArray(mqttUser, MQTT_USER_LEN); - mWeb->arg("mqttPwd").toCharArray(mqttPwd, MQTT_PWD_LEN); - mWeb->arg("mqttTopic").toCharArray(mqttTopic, MQTT_TOPIC_LEN); - //interval = mWeb->arg("mqttIntvl").toInt(); - mqttPort = mWeb->arg("mqttPort").toInt(); - mEep->write(ADDR_MQTT_ADDR, mqttAddr, MQTT_ADDR_LEN); - mEep->write(ADDR_MQTT_PORT, mqttPort); - mEep->write(ADDR_MQTT_USER, mqttUser, MQTT_USER_LEN); - mEep->write(ADDR_MQTT_PWD, mqttPwd, MQTT_PWD_LEN); - mEep->write(ADDR_MQTT_TOPIC, mqttTopic, MQTT_TOPIC_LEN); - //mEep->write(ADDR_MQTT_INTERVAL, interval); + // pinout + for(uint8_t i = 0; i < 3; i ++) { + uint8_t pin = request->arg(String(pinArgNames[i])).toInt(); + mEep->write(ADDR_PINOUT + i, pin); + } - // serial console - bool tmp; - interval = mWeb->arg("serIntvl").toInt(); - mEep->write(ADDR_SER_INTERVAL, interval); - tmp = (mWeb->arg("serEn") == "on"); - mEep->write(ADDR_SER_ENABLE, (uint8_t)((tmp) ? 0x01 : 0x00)); - mSerialDebug = (mWeb->arg("serDbg") == "on"); - mEep->write(ADDR_SER_DEBUG, (uint8_t)((mSerialDebug) ? 0x01 : 0x00)); - DPRINT(DBG_INFO, "Serial debug is "); - if(mSerialDebug) DPRINTLN(DBG_INFO, "on"); else DPRINTLN(DBG_INFO, "off"); - mSys->Radio.mSerialDebug = mSerialDebug; - updateCrc(); - mEep->commit(); - if((mWeb->arg("reboot") == "on")) - showReboot(); + // nrf24 amplifier power + mSys->Radio.AmplifierPower = request->arg("rf24Power").toInt() & 0x03; + mEep->write(ADDR_RF24_AMP_PWR, mSys->Radio.AmplifierPower); + + // ntp + char ntpAddr[NTP_ADDR_LEN] = {0}; + uint16_t ntpPort; + request->arg("ntpAddr").toCharArray(ntpAddr, NTP_ADDR_LEN); + ntpPort = request->arg("ntpPort").toInt(); + mEep->write(ADDR_NTP_ADDR, ntpAddr, NTP_ADDR_LEN); + mEep->write(ADDR_NTP_PORT, ntpPort); + + // mqtt + uint8_t mqttAddr[MQTT_ADDR_LEN] = {0}; + uint16_t mqttPort; + char mqttUser[MQTT_USER_LEN]; + char mqttPwd[MQTT_PWD_LEN]; + char mqttTopic[MQTT_TOPIC_LEN]; + request->arg("mqttAddr").toCharArray(buf, 20); + i = 0; + p = strtok(buf, "."); + while(NULL != p) { + mqttAddr[i++] = atoi(p); + p = strtok(NULL, "."); + } + request->arg("mqttUser").toCharArray(mqttUser, MQTT_USER_LEN); + request->arg("mqttPwd").toCharArray(mqttPwd, MQTT_PWD_LEN); + request->arg("mqttTopic").toCharArray(mqttTopic, MQTT_TOPIC_LEN); + //interval = request->arg("mqttIntvl").toInt(); + mqttPort = request->arg("mqttPort").toInt(); + mEep->write(ADDR_MQTT_ADDR, mqttAddr, MQTT_ADDR_LEN); + mEep->write(ADDR_MQTT_PORT, mqttPort); + mEep->write(ADDR_MQTT_USER, mqttUser, MQTT_USER_LEN); + mEep->write(ADDR_MQTT_PWD, mqttPwd, MQTT_PWD_LEN); + mEep->write(ADDR_MQTT_TOPIC, mqttTopic, MQTT_TOPIC_LEN); + //mEep->write(ADDR_MQTT_INTERVAL, interval); + + + // serial console + bool tmp; + interval = request->arg("serIntvl").toInt(); + mEep->write(ADDR_SER_INTERVAL, interval); + tmp = (request->arg("serEn") == "on"); + mEep->write(ADDR_SER_ENABLE, (uint8_t)((tmp) ? 0x01 : 0x00)); + mSerialDebug = (request->arg("serDbg") == "on"); + mEep->write(ADDR_SER_DEBUG, (uint8_t)((mSerialDebug) ? 0x01 : 0x00)); + DPRINT(DBG_INFO, "Serial debug is "); + if(mSerialDebug) DPRINTLN(DBG_INFO, "on"); else DPRINTLN(DBG_INFO, "off"); + mSys->Radio.mSerialDebug = mSerialDebug; + + updateCrc(); + mEep->commit(); + if((request->arg("reboot") == "on")) + showReboot(request); + else { + mShowRebootRequest = true; + request->send(200, F("text/html"), F("Setup saved" + "

saved

")); + } + } else { - mShowRebootRequest = true; - mWeb->send(200, F("text/html"), F("Setup saved" - "

saved

")); + updateCrc(); + mEep->commit(); + request->send(200, F("text/html"), F("Error" + "

Error while saving

")); } } else { updateCrc(); mEep->commit(); - mWeb->send(200, F("text/html"), F("Error" - "

Error while saving

")); } } @@ -1107,6 +1108,8 @@ void app::updateCrc(void) { mEep->write(ADDR_SETTINGS_CRC, crc); } + +//----------------------------------------------------------------------------- void app::sendMqttDiscoveryConfig(void) { DPRINTLN(DBG_VERBOSE, F("app::sendMqttDiscoveryConfig")); @@ -1160,6 +1163,8 @@ void app::sendMqttDiscoveryConfig(void) { } } + +//----------------------------------------------------------------------------- const char* app::getFieldDeviceClass(uint8_t fieldId) { uint8_t pos = 0; for(; pos < DEVICE_CLS_ASSIGN_LIST_LEN; pos++) { @@ -1169,6 +1174,8 @@ const char* app::getFieldDeviceClass(uint8_t fieldId) { return (pos >= DEVICE_CLS_ASSIGN_LIST_LEN) ? NULL : deviceClasses[deviceFieldAssignment[pos].deviceClsId]; } + +//----------------------------------------------------------------------------- const char* app::getFieldStateClass(uint8_t fieldId) { uint8_t pos = 0; for(; pos < DEVICE_CLS_ASSIGN_LIST_LEN; pos++) { diff --git a/tools/esp8266/app.h b/tools/esp8266/app.h index ca9bac1fc..26621ead7 100644 --- a/tools/esp8266/app.h +++ b/tools/esp8266/app.h @@ -62,19 +62,20 @@ class app : public Main { bool buildPayload(uint8_t id); void processPayload(bool retransmit); - void showFavicon(void); - void showIndex(void); - void showSetup(void); - void showSave(void); - void showErase(void); - void showStatistics(void); - void showHoymiles(void); - void showLiveData(void); - void showJSON(void); - void webapi(void); - - - void saveValues(bool webSend); + void showFavicon(AsyncWebServerRequest *request); + void showIndex(AsyncWebServerRequest *request); + void showSetup(AsyncWebServerRequest *request); + void showSave(AsyncWebServerRequest *request); + void showErase(AsyncWebServerRequest *request); + void showStatistics(AsyncWebServerRequest *request); + void showHoymiles(AsyncWebServerRequest *request); + void showLiveData(AsyncWebServerRequest *request); + void showJSON(AsyncWebServerRequest *request); + void devControl(AsyncWebServerRequest *request); + void webapi(AsyncWebServerRequest *request); + + + void saveValues(AsyncWebServerRequest *request, bool webSend); void updateCrc(void); void sendMqttDiscoveryConfig(void); const char* getFieldDeviceClass(uint8_t fieldId); diff --git a/tools/esp8266/favicon.h b/tools/esp8266/favicon.h deleted file mode 100644 index f0c501cd9..000000000 --- a/tools/esp8266/favicon.h +++ /dev/null @@ -1,194 +0,0 @@ -//----------------------------------------------------------------------------- -// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778 -// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ -//----------------------------------------------------------------------------- - - -// a) https://www.favicon-generator.org/ -// b) exiftool -all:all= -r -// c) hexlify.py: -// import sys -// f = open (sys.argv[1], 'rb').read() -// for n, c in enumerate(f): -// if n % 16 == 0: print (' "', end = '') -// print (f"\\x{c:02x}", end = '') -// if n % 16 == 15: print ('" \\') -// if n % 16 != 15: print ('"') - -#define FAVICON_PANEL_16 \ - "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" \ - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x03\x00\x00\x00\x28\x2d\x0f" \ - "\x53\x00\x00\x00\x04\x67\x41\x4d\x41\x00\x00\xb1\x8f\x0b\xfc\x61" \ - "\x05\x00\x00\x00\x20\x63\x48\x52\x4d\x00\x00\x7a\x26\x00\x00\x80" \ - "\x84\x00\x00\xfa\x00\x00\x00\x80\xe8\x00\x00\x75\x30\x00\x00\xea" \ - "\x60\x00\x00\x3a\x98\x00\x00\x17\x70\x9c\xba\x51\x3c\x00\x00\x01" \ - "\x9b\x50\x4c\x54\x45\xfc\xfe\xff\xff\xff\xff\xcb\xcd\xcf\x22\x25" \ - "\x30\x12\x16\x21\x11\x15\x21\x11\x15\x23\x12\x16\x25\x10\x13\x1f" \ - "\x8f\x91\x93\x9b\x9d\xa1\x14\x17\x22\x14\x18\x25\x14\x17\x23\x13" \ - "\x17\x22\x14\x17\x24\x17\x19\x27\x22\x24\x2e\xc1\xc2\xc3\xf8\xfa" \ - "\xfb\x61\x63\x6b\x11\x13\x1f\x15\x19\x24\x17\x19\x24\x18\x1a\x24" \ - "\x18\x1b\x26\x16\x19\x26\x42\x44\x4b\xe7\xe8\xe9\xfd\xff\xff\xfe" \ - "\xff\xff\xe0\xe2\xe4\x33\x36\x3f\x16\x19\x24\x16\x17\x22\x16\x18" \ - "\x22\x17\x18\x23\x11\x12\x1e\x71\x73\x76\xfb\xfc\xfd\xb5\xb7\xba" \ - "\x1a\x1c\x27\x15\x17\x22\x15\x17\x21\x14\x15\x20\x14\x16\x23\x17" \ - "\x1a\x26\x1b\x1c\x25\xaa\xac\xad\x7c\x7f\x85\x11\x13\x1d\x16\x18" \ - "\x24\x17\x19\x25\x18\x1a\x25\x30\x32\x38\xd7\xd9\xd9\xef\xf1\xf2" \ - "\x47\x49\x51\x12\x13\x1e\x17\x19\x22\x16\x17\x23\x10\x11\x1c\x59" \ - "\x5a\x5f\xf4\xf6\xf7\xcc\xce\xd0\x24\x25\x2e\x16\x18\x23\x19\x1a" \ - "\x24\x16\x17\x21\x15\x16\x21\x17\x17\x21\x15\x17\x20\x92\x93\x95" \ - "\x99\x9a\x9e\x16\x16\x20\x17\x19\x23\x1a\x1b\x25\x23\x25\x2c\xc4" \ - "\xc6\xc7\xf8\xfa\xfa\x61\x62\x68\x15\x16\x20\x11\x12\x1d\x44\x45" \ - "\x49\xea\xec\xec\xdf\xe1\xe2\x33\x35\x3b\x15\x16\x1f\x13\x14\x1d" \ - "\x78\x7a\x7c\xfc\xfd\xfe\xb2\xb4\xb7\x1a\x1c\x26\x18\x1b\x25\x1a" \ - "\x1b\x22\x19\x1b\x22\xae\xaf\xb0\x86\x88\x8b\x14\x16\x1e\x19\x1b" \ - "\x25\x17\x19\x21\x17\x19\x20\x12\x13\x1a\x2c\x2d\x32\xcc\xce\xcf" \ - "\xfb\xfe\xff\xd8\xdb\xdb\x72\x74\x76\x25\x26\x2c\x19\x1c\x24\x13" \ - "\x16\x1d\x11\x13\x18\x4c\x4d\x4f\xc1\xc3\xc3\xe2\xe4\xe6\xf6\xf8" \ - "\xf8\xb6\xb9\xb9\x4f\x51\x55\x1b\x1c\x23\x19\x1b\x23\x15\x17\x1f" \ - "\x70\x71\x72\xbb\xbb\xbc\xc3\xc4\xc5\xde\xe0\xe1\xf6\xf8\xf9\xfd" \ - "\xfe\xff\xe3\xe5\xe6\x7e\x81\x82\x21\x22\x27\x1d\x1f\x26\x94\x95" \ - "\x95\xbd\xbd\xbe\xbd\xbe\xbe\xc8\xca\xcb\xe5\xe7\xe9\xfa\xfc\xfd" \ - "\x52\x5f\xd3\xea\x00\x00\x00\x01\x62\x4b\x47\x44\x01\xff\x02\x2d" \ - "\xde\x00\x00\x00\xd2\x49\x44\x41\x54\x18\xd3\x63\x60\x00\x02\x46" \ - "\x26\x66\x16\x16\x56\x36\x76\x0e\x4e\x46\x06\x30\x60\xe4\xe2\xe6" \ - "\xe1\xe5\xe3\x17\x10\x14\x82\x0a\x08\x8b\x88\x8a\x89\x4b\x48\x4a" \ - "\x49\xcb\xc8\x82\xf9\x72\xf2\x0a\xdc\x8a\x4a\xca\x2a\xaa\x6a\xea" \ - "\x50\x1d\x1a\x9a\x5a\xda\x3a\xba\x7a\xfa\x06\x50\x1d\xb2\x86\x46" \ - "\x5a\xbc\xc6\x26\xa6\x66\xe6\x72\x10\xbe\x85\xa5\x95\xb5\x89\xa9" \ - "\x8d\xad\x9d\x3d\xc4\x08\x46\x07\x47\x27\x67\x17\x57\x37\x77\x0f" \ - "\x39\xa8\x11\x9e\x4a\xa6\x36\x5e\xde\x3e\xbe\x7e\x50\x23\xfc\x03" \ - "\x02\x55\x8c\x9d\x55\x82\x82\x43\xa0\x96\x86\x86\x85\x4b\x48\xb8" \ - "\x84\x47\x44\x46\x41\x75\x44\xc7\x78\xc7\xba\x87\xc7\xc5\x27\x40" \ - "\x75\xc8\x25\x26\x25\x7b\xa7\xa4\xa6\xa5\x67\x64\x42\x5d\x91\x95" \ - "\x9d\x93\x92\x9b\x97\x5f\x50\x58\x24\x0c\x55\x52\x5c\x52\x5a\x56" \ - "\x5e\x51\x59\x55\x5d\x53\x0b\x11\xa9\x93\xab\x6f\x68\x6c\x6a\x6e" \ - "\x69\x6d\x6b\xef\x60\x00\x00\x01\x53\x2a\x2a\x63\x34\xcd\xf7\x00" \ - "\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82" - -#define FAVICON_PANEL_32 \ - "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" \ - "\x00\x00\x00\x20\x00\x00\x00\x20\x08\x06\x00\x00\x00\x73\x7a\x7a" \ - "\xf4\x00\x00\x00\x04\x67\x41\x4d\x41\x00\x00\xb1\x8f\x0b\xfc\x61" \ - "\x05\x00\x00\x00\x20\x63\x48\x52\x4d\x00\x00\x7a\x26\x00\x00\x80" \ - "\x84\x00\x00\xfa\x00\x00\x00\x80\xe8\x00\x00\x75\x30\x00\x00\xea" \ - "\x60\x00\x00\x3a\x98\x00\x00\x17\x70\x9c\xba\x51\x3c\x00\x00\x00" \ - "\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00" \ - "\x00\x07\x4a\x49\x44\x41\x54\x58\xc3\x9d\x97\xd9\x72\x5d\xc5\x15" \ - "\x86\xbf\xee\xde\xd3\xd9\x67\xd0\x99\x74\x34\x3b\x48\x32\x48\xe0" \ - "\x21\x60\xe1\x32\xd8\x15\x5e\x80\xdc\xf2\x00\xe4\x41\x12\x9e\x21" \ - "\x37\xc9\x43\xa4\x20\x95\xe2\x9a\x82\x0c\x10\x70\x62\x06\x0f\xc2" \ - "\x24\x15\xe2\x59\x96\xce\xbc\xe7\xb1\x73\x21\x93\x32\x20\x4b\xa7" \ - "\xe8\xaa\x7d\xb3\x2f\x7a\x7d\xf5\xff\xfd\xaf\x5e\x2d\xf2\x52\x6b" \ - "\x66\x58\x4a\xc0\x67\xff\xf8\x27\x6f\xbd\xf5\x36\xa3\xf1\x04\xad" \ - "\x0b\x84\x94\x68\xad\xc9\xf3\x1c\xc7\x76\x08\xa3\x04\xdb\xb6\xc8" \ - "\xf3\x12\x0d\xb8\x15\x9b\x28\x8c\x90\x52\xb0\xfe\xdc\x02\xbf\xff" \ - "\xdd\x6f\xb9\x72\xf9\x32\xc5\x53\x15\xe5\x2c\xc5\xbf\x5b\xdf\x7e" \ - "\x7b\x87\x34\x4b\x68\x36\xeb\x38\x8e\x4d\xb3\x59\xc7\xb6\x0d\x3a" \ - "\x9d\x16\xb6\x63\x52\x71\x6c\xea\xb5\x2a\x52\x0a\x6a\xd5\x0a\x96" \ - "\x65\x02\x1a\xc7\x36\xd9\xde\xda\x64\x6b\x6b\x9b\xf2\x07\x7b\x1a" \ - "\xb3\x16\xcf\x8a\x82\x4f\x3f\xbd\x4a\x18\x86\x34\x1a\x73\x68\x24" \ - "\x52\x1a\x08\xa1\xa8\x54\x1c\xa2\x30\xa4\xd9\xac\xd3\x9d\xef\xa0" \ - "\xb5\x66\x65\x65\x91\x30\x8c\x50\x52\xd3\x6a\xd5\xd9\xda\x7a\x81" \ - "\x56\xbb\xcd\x0f\xf5\x9e\x09\x40\x0a\x78\xb4\xf7\x98\x8f\x3f\xfe" \ - "\x8c\xa2\x28\x99\x4c\xa6\x94\x25\xe4\x59\x49\x14\x47\xc4\x51\x4c" \ - "\x92\x24\x54\x9c\x0a\xfd\xfe\x88\x3c\xcb\x89\xc2\x88\x2c\xcb\xd1" \ - "\x5a\x23\x74\xce\xf6\xf6\x36\x4a\xf0\x3d\xf9\x67\x06\x10\xc0\xd7" \ - "\xb7\xbf\xa1\x3f\x18\xb1\xb0\x30\x8f\xef\xfb\x98\xa6\x49\x96\x6b" \ - "\xda\x9d\x39\x6c\x4b\x31\x1c\x8e\xa9\xd5\xaa\x8c\xc7\x1e\xae\xeb" \ - "\x50\x71\xab\x0c\xfa\x63\x4c\x43\xb2\x79\xfa\x39\x2e\xbd\xf6\x1a" \ - "\x47\x1d\xb6\x99\x2d\xb8\x7a\xf5\x73\xee\xde\x79\x80\x6d\x9b\x64" \ - "\x79\x86\x6d\xdb\x64\x59\x86\x28\x73\x22\xa1\xa1\x2c\xb1\x2d\x03" \ - "\xd3\x54\x2c\x2e\xf6\x70\x6c\x87\xb2\x28\xa8\xd5\x1c\xce\x9f\x3b" \ - "\xc3\xda\xda\x29\x4a\xfd\x13\x00\x84\x00\xcf\x0f\xb8\x7e\xfd\x3a" \ - "\xbd\x85\x0e\x8e\x6d\x31\x99\x7a\x58\x96\xc5\x70\x38\x22\x8a\x63" \ - "\xd2\x24\xc5\xb2\x4c\x1e\xde\x7f\x44\x9c\xa4\xa4\x71\x42\x91\xe7" \ - "\x14\x65\x49\x96\xda\xac\xad\xad\xe2\x58\xe6\x8f\xe4\x9f\x09\x40" \ - "\x02\xb7\xbf\xf9\x86\x4f\x3e\xb9\x4a\x92\xc4\x68\x5d\xd2\x68\xd4" \ - "\x71\x9c\x0a\x4a\x49\x1c\xdb\xe2\xe0\x60\xc0\xe2\x52\x0f\x7f\xea" \ - "\xe3\xe4\x19\xae\x5b\xe5\xe0\x60\x88\x10\x8a\x4e\xbb\xc5\xeb\x97" \ - "\x2f\x3f\x73\xff\x99\x2c\xd8\xdd\xbd\xcd\x70\x34\x46\x6b\xcd\x74" \ - "\xea\x63\x99\x16\x79\x9e\x63\x5b\x06\x9e\x80\x2c\xcb\x99\x4e\x7d" \ - "\x92\xa4\xa0\xd9\x6a\xb1\xd0\xeb\x90\x65\x39\x96\x65\xb0\xb3\xf3" \ - "\x73\xce\xbc\x74\xe6\x47\xf1\x9b\x19\x20\x2b\x0a\xbe\xf8\xe2\x3a" \ - "\x95\x4a\x85\xb9\x46\x95\xfe\x60\x48\xb7\xdb\x65\x32\x1a\xa1\x94" \ - "\x62\x3a\x0d\x90\x52\x12\x85\x11\x7e\x90\x50\x14\x05\xfd\xbd\x3d" \ - "\xb2\x3c\xa3\xde\x70\x59\x5b\x5b\x65\xae\x39\xc7\xb3\xda\xdd\xb1" \ - "\x00\x52\xc0\x83\x47\x7b\x7c\xf8\xd1\xdf\x18\x8f\x27\x44\xbe\x07" \ - "\x42\xe1\xfb\x11\x85\x96\x74\xda\x6d\xb4\x50\xb8\xae\x4d\x51\x94" \ - "\x98\x56\x82\xeb\x3a\x0c\xfb\x03\x84\x90\x28\x25\x39\x7f\xfe\x3c" \ - "\x12\x28\x7e\x8a\x02\x02\xd8\xdd\xfd\x9a\xbd\xbd\x7d\x96\x16\x7b" \ - "\x84\xbe\x87\x46\x3e\xe9\x03\x9a\xfb\xf7\xf6\x88\x93\x84\x38\x76" \ - "\x28\x72\xa8\x56\x5d\xe6\xe7\x3b\x14\x79\x86\xd6\x70\xee\xdc\xf3" \ - "\x5c\xba\x74\x89\xe3\x7a\xfd\x89\x16\x5c\xbb\xf6\x25\xfd\x7e\x9f" \ - "\xb9\x46\x0d\x29\x25\xed\x76\x0b\x06\x23\x9a\xed\x16\x9e\x17\x81" \ - "\x00\x43\x29\x02\xcf\x47\x08\xf8\xd7\xed\x7f\x13\xc7\x09\x8d\xb9" \ - "\x3a\xa7\x37\x37\x58\x5e\x59\x39\x32\x7e\x27\x02\x08\x01\x5e\x10" \ - "\x70\xfd\xc6\x4d\x2a\x8e\x4d\x96\x66\x24\x49\x42\x9e\x17\x44\x51" \ - "\x8c\x32\x14\x68\x58\x5d\x5d\x24\x4f\x13\xa4\x94\xd4\xea\xd5\x43" \ - "\xf9\xa5\xa4\x2c\x33\x36\xd6\x9f\xc3\x32\x8c\x23\xe3\x77\x22\x80" \ - "\x7c\x22\xff\xd5\xcf\xae\xd2\xeb\x75\x48\xd3\x0c\xcb\xb2\x48\x93" \ - "\x84\x2c\xcb\x49\xa2\x98\x30\x88\x88\xa3\x94\xb2\x48\x31\x0c\x03" \ - "\x77\xbe\x45\xde\xa8\xe3\xe4\x05\xa7\xd6\x7a\x5c\xbe\x72\xe5\x24" \ - "\x81\x8f\xb7\xe0\xe6\xcd\x5b\x3c\x7c\xf0\x08\x29\x0c\x0a\xad\xe9" \ - "\x74\x5a\x20\x24\xcb\x2b\x8b\xa4\x69\x8a\x65\xd9\x28\x43\x31\x1a" \ - "\x44\x80\xe4\xe1\x83\x3d\x82\x20\xa2\x5a\xaf\xb2\xbd\xf5\x02\xdb" \ - "\x2f\xbe\xf8\xcc\xf8\x9d\x08\x90\xe5\x05\x37\x6f\xdc\xa2\xd1\x68" \ - "\x50\x6f\xcc\xb1\xbf\xdf\x27\x08\x62\xa2\x30\xc4\x77\x2c\xb4\x2e" \ - "\x69\xb7\x9b\x74\xe6\xbb\xa4\x69\x4a\xaf\xd7\x65\xd0\x1f\x20\xa4" \ - "\x40\x88\x92\x53\xa7\x56\xa9\xd7\x6a\xc7\xfa\xff\x4c\x00\x29\xe0" \ - "\xde\xc3\x87\x7c\xf0\xc1\x5f\x08\xc2\x14\x43\x05\x74\x3b\x73\x18" \ - "\x96\xc3\x74\x3c\x01\x34\xa3\xe1\x98\xd1\x70\x42\x7f\x30\xa1\x2c" \ - "\x72\xb2\x34\xc3\xa9\xb8\x28\x43\xd1\xee\x34\xb8\x70\xe1\x02\xe2" \ - "\x44\x03\x9e\x01\x70\x18\xbf\x5d\x06\xc3\x21\x8e\x63\x33\x19\x4f" \ - "\xb0\x2c\x93\x42\x2b\x1a\xcd\x26\xad\xa6\x4b\x51\xe4\xd4\x1b\x75" \ - "\x1e\xef\x1d\x00\x30\x1a\x4d\xf0\xbd\x90\x8a\x6b\xb1\xbe\x73\x96" \ - "\x57\x2f\x5e\x64\x96\x51\xeb\x48\x00\x0d\x7c\x7e\xed\x4b\x26\x93" \ - "\x29\xbd\x5e\x97\x40\x81\x53\xa9\xf0\xf8\xf1\x90\xf1\x68\xcc\xb0" \ - "\xbf\x8f\x69\x2a\x5c\xd7\xa5\x5a\xab\xd2\xed\xb6\xf1\xfd\x10\xdf" \ - "\x0f\x50\x0a\xd6\x7f\x76\x8a\x85\x85\xc5\x13\xe5\x87\x23\x46\xb2" \ - "\xc3\xdb\xcf\xe7\xda\xb5\x6b\x64\x69\x42\x7f\xbf\x4f\x92\xa4\xb8" \ - "\xd5\x0a\xcd\x66\x8d\x85\xc5\x0e\x08\x41\xa9\x05\x77\xff\x7b\x9f" \ - "\xc9\xd8\xc3\x0f\x42\x84\x28\x69\xb6\x1b\x74\xba\x2d\x5e\xd8\xda" \ - "\xc2\x54\xb3\x4d\x7b\xf2\xa8\x1f\xbb\xbb\xbb\xdc\xb8\x79\x8b\xc5" \ - "\xa5\x1e\xae\xeb\xa0\x81\x7b\x77\x1f\xe2\xf9\x01\xe8\x82\x7a\xdd" \ - "\xa5\x3b\xdf\xc2\xb4\x14\x52\x68\xa6\xe3\x31\x7b\x8f\x1e\x13\xf8" \ - "\x01\xed\x76\x8b\x2b\x33\xc4\xef\x58\x0b\xbe\xfa\xea\x16\x77\xee" \ - "\x3c\xc2\x75\x1d\x2c\xd3\xa0\xd9\x6e\xe2\xfb\x11\x59\x96\xb1\xbf" \ - "\xb7\x4f\x9e\x17\x28\x29\x31\x2d\x83\xd5\xce\x12\x42\x1c\xaa\xa1" \ - "\x94\xe2\xf4\xe6\x3a\xa7\x9f\x7f\xfe\xc4\xf8\x3d\x13\x20\xcd\x0b" \ - "\xae\xdf\xb8\x49\xad\xd1\xc0\x50\x8a\xe9\x64\x42\x56\x68\xa4\x54" \ - "\x74\x3b\x4d\x3c\xcf\x27\x89\x13\xc2\x20\x24\x0c\x02\x04\x1a\xcb" \ - "\xb6\x69\x34\x1b\x54\xaa\x15\x4e\x6f\x6e\x50\x75\xdd\x99\xfc\xff" \ - "\x11\x80\x14\x70\xe7\xfe\x3d\x3e\xfa\xf0\xcf\x58\xa6\xa2\x56\xab" \ - "\x61\x59\x26\x69\x9a\x32\x9d\x78\xa0\x0b\x40\xb3\xb4\xbc\x80\xe7" \ - "\x79\x24\x69\x4c\xe0\x07\x8c\xfa\x63\x84\x61\xd0\x68\xb8\x9c\x39" \ - "\x7b\x96\xa2\xd4\x08\x31\x4b\x08\x7f\x00\x20\x80\x7b\xf7\xef\x93" \ - "\xc4\x01\xa1\x37\xc1\x9f\x4e\x59\x5a\x5e\xc2\xb2\x4c\x2c\xcb\x24" \ - "\x8e\x22\xbc\xa9\x47\x59\x14\x08\x43\x31\xbf\xd0\xc5\x75\x1d\xee" \ - "\xfc\xe7\x2e\x52\xc1\xea\xca\x12\x4b\xcb\x2b\x0c\x87\x23\xea\xf5" \ - "\xfa\x93\x77\xc1\xf1\x4b\xfd\xfa\x37\xef\xbc\xf3\x34\x41\xbd\x56" \ - "\x67\x71\xb9\xc7\x78\x32\xe2\xe0\xf1\x3e\x81\x17\xe0\x79\x3e\xdd" \ - "\x6e\x07\xc3\x30\x10\x42\x20\xa4\xc4\x9b\x7a\x68\x01\xba\x28\x91" \ - "\x4a\xd2\x6c\xd6\x79\xe9\xa5\x2d\x76\x76\x76\xc8\x8b\x02\x21\x04" \ - "\xa6\x69\xa0\x94\x3a\x56\x8d\xef\x03\x00\xae\x5b\xe1\xdc\xd9\xb3" \ - "\xbc\xfc\xca\xcb\x38\xae\xcd\x64\x32\x66\xd0\x1f\x10\xf8\x3e\x41" \ - "\x10\xd2\x5b\xe8\x61\x3b\x0e\x49\x92\x52\x16\x05\xde\xd4\x23\x4d" \ - "\x12\x2c\x5b\xf1\xfa\x6b\x97\xd8\xd8\xd8\x20\x4b\x53\xf2\x3c\x07" \ - "\x0e\x21\xbe\x03\x9f\x09\xe0\x50\x09\xc1\x42\xaf\xc7\xc5\x8b\x17" \ - "\x59\xdf\x5c\x47\x8b\x92\xc9\x74\xc2\x68\x30\x22\x89\x53\xa2\x30" \ - "\xa6\x56\xab\xd2\x9d\xef\x12\xf8\x11\x5a\xc3\xf2\x52\x8f\x5f\xbe" \ - "\xf9\x26\x8d\x46\x9d\xa2\x28\xc8\xb2\x9c\x2c\xcf\x0f\x7d\x36\x0c" \ - "\x0c\xc3\x3c\x12\xe2\x68\x00\x0e\xbb\xa1\x65\x59\x9c\xde\xdc\xe4" \ - "\xc2\x2b\xaf\xd0\x6c\xcd\x31\x1a\x8f\x89\xe3\x98\xe9\x68\x8c\x2e" \ - "\x0b\xb4\x06\xa9\x14\xcd\x56\x93\xed\xad\x4d\xde\x78\xe3\x17\x48" \ - "\xa9\x00\x8d\x2e\x4b\x8a\x22\x27\xcf\x0f\x5f\x47\x87\x10\x06\x52" \ - "\x7e\x1f\xe2\xd8\xeb\xf8\xbb\x41\x72\x75\x75\x95\x5f\xbd\xfd\x36" \ - "\xaf\xee\xec\xf0\xa7\xf7\xdf\xe7\xdd\x3f\xfc\x91\x83\xfd\x7d\xa6" \ - "\xe3\x11\x85\x96\xd8\x8e\xc9\xd2\xe2\x02\x8e\xe3\xa0\xff\x3f\x7d" \ - "\x6a\x8a\x3c\x27\x0c\x43\x84\x10\x68\x0d\x5a\x6b\xaa\xd5\x2a\xea" \ - "\xa9\x2e\x39\xd3\x58\xae\x35\x98\x86\xc9\xab\x3b\x3b\xac\x9d\x3a" \ - "\xc5\xc6\xfa\x3a\xef\xbe\xf7\x1e\x7f\xff\xeb\xa7\xe4\x71\x46\x99" \ - "\xe7\xac\xaf\xaf\xa3\x94\xa2\x2c\xf5\x93\x2b\x59\x22\xe5\xe1\xa7" \ - "\x35\x94\x65\x49\x59\x16\x68\x5d\xf2\x74\x03\xfe\x1f\xc2\x60\x72" \ - "\xe2\x6a\x9b\x4e\x8f\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" \ - "\x82" diff --git a/tools/esp8266/html/ahoy_logo_57x57.png b/tools/esp8266/html/ahoy_logo_57x57.png new file mode 100644 index 000000000..7f6098d39 Binary files /dev/null and b/tools/esp8266/html/ahoy_logo_57x57.png differ diff --git a/tools/esp8266/html/h/favicon.h b/tools/esp8266/html/h/favicon.h new file mode 100644 index 000000000..4ea57bb96 --- /dev/null +++ b/tools/esp8266/html/h/favicon.h @@ -0,0 +1,121 @@ +//----------------------------------------------------------------------------- +// 2022 Ahoy, https://www.mikrocontroller.net/topic/525778 +// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +//----------------------------------------------------------------------------- + + +// a) https://www.favicon-generator.org/ +// b) exiftool -all:all= -r ahoy_logo_* +// c) ./hexlify.py ahoy_logo_57x57.png >> h/favicon.h + +#define FAVICON_PANEL_57 \ + "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" \ + "\x00\x00\x00\x39\x00\x00\x00\x39\x08\x00\x00\x00\x00\xa9\x73\xdc" \ + "\x59\x00\x00\x00\x20\x63\x48\x52\x4d\x00\x00\x7a\x26\x00\x00\x80" \ + "\x84\x00\x00\xfa\x00\x00\x00\x80\xe8\x00\x00\x75\x30\x00\x00\xea" \ + "\x60\x00\x00\x3a\x98\x00\x00\x17\x70\x9c\xba\x51\x3c\x00\x00\x00" \ + "\x02\x62\x4b\x47\x44\x00\x00\xaa\x8d\x23\x32\x00\x00\x06\x61\x49" \ + "\x44\x41\x54\x48\xc7\xd5\x96\x09\x50\x13\x57\x18\x80\x53\x71\x6a" \ + "\xa7\xe3\x51\xec\xe8\x54\x9d\xd6\x63\x6a\x6b\x6d\xc7\xd6\xa9\xa3" \ + "\x1d\xb5\xea\x68\xab\xd6\xa3\xd6\xab\x58\x54\x10\x50\x0e\xa5\xa1" \ + "\x4a\x08\x97\xe1\xf0\xe0\x3e\x04\xcb\x25\x84\x53\x20\xa2\x82\x12" \ + "\xe4\x46\x54\x10\x45\x83\xe1\x0e\xd9\x08\x28\x60\x08\x08\x04\x08" \ + "\x39\x48\xb2\xfb\x77\x77\x23\x64\x83\x60\x9d\xce\x74\xa6\x7d\xb3" \ + "\xf3\xee\x6f\xdf\xff\xde\xff\xff\xef\xfd\x34\xf8\xa7\x89\xf6\x3f" \ + "\x27\xb1\x97\x02\x04\xa9\x6c\x42\x04\x42\x99\x06\x7b\x7b\x12\xeb" \ + "\xbc\xee\xe1\xb2\xe3\xd3\x80\x2c\x6e\xb6\xaf\xcb\x8d\x4c\x36\xb7" \ + "\x44\x3c\x80\xbd\x05\x29\x2b\xf5\xb7\xdd\x9e\xfa\x22\x74\x52\x0c" \ + "\xde\x50\x2b\x15\x3d\x8d\x25\xf1\x49\x01\xf1\x3c\xd9\xdf\x90\xdd" \ + "\xd9\xd6\x76\xb1\x27\xe7\x85\xc1\x9d\x0f\x6c\xb4\xa3\xbd\x68\x57" \ + "\xd1\xa5\x80\xa2\xce\x37\x91\x52\xdb\x53\x5c\x19\x7a\x80\xf6\x79" \ + "\x8d\x74\xed\x4a\x09\x75\x0e\xda\x7a\x78\x47\x6a\x1b\x3a\x21\xa9" \ + "\x60\x96\x01\x68\x4d\x8c\x67\x58\x2a\x8e\x4f\x0d\xe0\x14\x0f\x6a" \ + "\x90\x1a\x44\x4d\x0e\xe5\x1a\x6f\xe1\xc6\x67\x23\xd8\x04\x24\xe4" \ + "\x05\xa3\xa0\xdd\xbf\x7a\xe7\x27\xcd\xf1\x93\x8d\xde\x9f\x1a\x9a" \ + "\xb2\x74\xc9\xd2\xb2\xc6\x7c\x35\xf4\x6c\x9f\x91\x0f\x5a\xce\x31" \ + "\xe5\x44\x64\x3f\x43\x80\xaf\x39\x65\xa6\x51\x48\x99\xf1\xe6\xe8" \ + "\xb9\xeb\x97\x99\x57\xed\xb1\xb3\xd8\xfa\xa0\x2d\xcc\x68\xd7\x20" \ + "\xa8\x3d\x52\x27\x3e\xdb\xc8\x60\x0c\x35\x79\xf7\xe4\x92\x6f\x8b" \ + "\xe6\xb1\x9a\x17\x6f\x58\x6e\xd3\xbc\x6b\xe7\xaa\x39\x4b\x9c\x96" \ + "\x4f\xbf\x05\x70\xd3\x65\x68\x62\x12\x39\x2c\xc1\x4c\xa6\xf3\xec" \ + "\x27\x7b\x6c\xdc\xfb\xf0\x23\xdb\xe4\xef\x97\xaf\x74\x33\x9e\x66" \ + "\x13\x3f\xf7\xc7\x7e\xa8\x3f\x7a\x1f\x9d\x98\xac\x58\x7b\x7d\x60" \ + "\xa3\x31\xbf\x90\xf1\x44\xc0\x1f\xb8\xd7\x8e\xb5\x17\x25\x6d\x98" \ + "\x7f\xa9\xf9\xd2\x9f\x05\x30\xe0\x64\x66\xe9\x5f\xaf\x19\x9f\x1c" \ + "\x4e\xf0\x8e\x64\x76\x45\x5d\x93\xaa\x9f\xb5\xde\xbd\x9a\x71\xad" \ + "\xa4\xe5\xb9\xfc\xf4\xfa\x07\x58\x14\x8d\x0e\x18\x27\x68\x48\x74" \ + "\xf5\x84\x8f\x64\x3c\x12\xcd\x09\xec\xe8\x3a\x22\xec\x2a\x8c\xf6" \ + "\x74\xf0\x65\x87\x87\x87\xb3\x33\x3c\x63\x83\xb9\x7d\x68\xfe\xcf" \ + "\x29\x70\xdb\x9f\x30\x23\xb1\xdb\xee\xfa\x71\x48\x9e\x8f\x1c\xb0" \ + "\x90\x8b\x3e\xbf\x44\xf2\xfa\x74\xc7\x8f\xc9\x25\xe5\xec\x90\x94" \ + "\xb4\x2a\x65\xbb\x67\x23\xd9\x33\x10\x62\x56\xff\x1a\x29\xf5\xa8" \ + "\xc1\x73\x89\xdd\x17\xd1\x86\xe7\x20\x6f\xcd\x0c\xf3\xb5\xbe\x39" \ + "\x22\x58\xdc\xc1\xca\xfe\x31\x64\x56\x04\x69\x21\x49\x5f\x23\xaf" \ + "\x19\xa8\xba\xb6\x58\x3d\x52\xd7\x78\xcd\xda\x5a\x65\x40\xf6\xb8" \ + "\x3e\x25\xcb\xde\x2a\xcd\x58\x10\x43\x31\x18\x12\x34\x48\x74\x4a" \ + "\xf1\xa3\xd1\x36\x76\x52\x49\x8e\x4e\x48\x95\xa4\x7f\x8c\x37\x2a" \ + "\xca\xe2\x58\xee\xee\xae\x8e\x47\x7f\x65\x44\x3c\x47\x01\x73\xa6" \ + "\xd1\x8c\x7c\x29\xe4\x80\xab\x88\x28\xc4\x6c\x37\x46\x26\x45\xe1" \ + "\x68\x43\xa2\xfb\x29\x36\x8f\xcf\x6f\x52\xf4\xd7\xe7\x05\x9d\xf6" \ + "\x41\x20\x6f\x1a\x6d\xb6\x8d\x46\x4f\x8a\x82\x89\x86\x86\x5d\xa1" \ + "\xaa\x31\x15\xe9\x28\x25\x6e\xfe\x19\x0c\x76\xb5\x4a\xff\xa3\x9e" \ + "\x4b\x66\xf9\xd2\x7d\x8b\x3c\x19\x6d\x7a\x32\x8d\x4d\xe4\xfc\x18" \ + "\x9c\xbf\x72\xb1\x0b\x5f\x15\x6b\x4c\x57\x62\xe9\x76\xed\xc4\xc2" \ + "\x2a\x95\x4a\xa1\x54\x2a\x55\x2a\xb5\x34\x6d\x73\xf1\xd3\x9a\x82" \ + "\xe6\xa1\x51\x12\xf5\x7a\x48\x14\xd9\xc5\xd0\x8b\x3e\xb1\x77\x2a" \ + "\x01\x6d\x7e\x30\x02\x08\x5d\x04\xea\xfa\xbb\x37\x4e\x99\x5b\x9e" \ + "\x67\x3a\x32\xec\xcc\xcc\x2e\xb0\x4c\x6d\x46\x65\x20\xc9\x0e\x06" \ + "\x61\x56\x9a\x80\x6a\xe5\x39\x61\x62\x53\x5d\xb8\x3c\x3b\x16\xd7" \ + "\x5a\x56\x1e\xc0\x9d\xc8\x5a\x81\xcf\xa6\x45\xb1\x82\x3a\x9e\x0d" \ + "\x7d\x4d\xb0\x6a\xd0\xa5\xd2\x80\xac\xf3\x22\x14\xa6\xba\xdc\xaf" \ + "\x49\xc0\xe5\x7e\x14\x9d\x14\x8d\x1b\x1b\xea\xce\xc3\xed\xb5\x0e" \ + "\xd4\x0e\xab\x17\xa4\x00\x74\x39\x1e\xf2\x0d\xd1\x02\xd7\x55\x4d" \ + "\x25\xaf\x92\xdb\x54\x25\xf7\xc1\x60\x52\x2d\x16\xc6\x6f\x69\x1b" \ + "\xc4\x70\xb2\x02\x86\x18\xcd\x80\x55\xae\xd8\xd7\x87\xef\xbc\x76" \ + "\xb5\x95\x00\xa0\xdd\xea\x39\x95\x64\xc7\x91\x2a\x67\xf3\x60\x38" \ + "\x4d\xde\xe1\x2b\x7b\x11\xe7\x1d\x77\x41\x74\x33\x02\xea\xf6\xb6" \ + "\x00\x70\x57\xf2\x89\xe1\x9c\x2f\xcb\x89\xc2\xbf\x84\x4a\x26\x73" \ + "\xc8\x7a\x25\x07\x53\x47\x74\x29\xce\x3d\x05\x85\xb8\xaa\xa0\xab" \ + "\xd3\xa6\x92\xbe\x30\x92\x9d\xe0\xc8\xbc\x7b\x33\x87\x93\x68\xbd" \ + "\x25\xfa\x56\x43\x83\x30\x3c\xd0\x40\x5a\xdd\x7f\x14\x91\x08\x44" \ + "\x06\xb4\x9c\xad\xad\x2d\x1c\x26\x64\xe0\xee\x99\x35\xe3\xb3\xf9" \ + "\x0b\xb7\x1d\x32\x5d\xb7\xe9\x9b\x05\xf3\x17\xcc\xff\x6a\xdd\xd2" \ + "\x8f\x3f\xb4\xd5\x52\xc8\xc4\xcb\xba\x86\xe0\xf4\xd9\xc0\x90\x03" \ + "\x67\x94\x62\x16\x87\x44\x1f\x2c\xde\x8d\x88\x44\x22\xa1\x50\x84" \ + "\x10\xa5\x08\x11\x66\x04\x5a\x78\x53\xd7\xbc\x96\xac\x6b\x74\x58" \ + "\xe4\x88\x31\x9f\x1c\x80\xa1\x54\x0e\xe1\xa3\x58\xd4\x71\xfc\xa4" \ + "\x5a\x86\xe1\xa5\xde\x0f\x72\xfc\xa9\x64\x63\x3a\x59\xd7\xb2\x56" \ + "\xe0\x7a\xe5\x26\x11\xe7\x9c\x14\x4b\x4c\x7e\xec\x8c\x82\xdc\xad" \ + "\x13\x62\x9f\x8f\x92\x91\x67\xa9\x24\xe2\x41\xde\x02\xa5\xbb\x57" \ + "\xe3\xe4\xed\x04\x72\xcf\x3c\xc5\x2b\x52\xe1\x2a\x86\x73\xd5\xa3" \ + "\x4e\xc0\xcc\xa2\x92\x0a\x3f\xfc\xf0\x41\x4e\xb7\x58\x89\xfb\x75" \ + "\x58\xae\xde\xc6\x1f\xbb\xa0\x80\xde\x93\x42\x79\xfb\x48\x4f\x83" \ + "\xf9\x0b\x2a\x09\x31\x99\x78\x56\x7b\xea\xf7\x6d\x0e\xa5\x65\xb6" \ + "\x65\x7a\x92\x1f\x85\xbb\x2b\xf9\xc9\x74\x2c\x16\x7a\xd1\xc0\xfa" \ + "\xa0\xd9\x4f\x09\xe8\xd9\x2b\x67\xf2\xeb\x12\xd9\x7c\xb5\x9e\xe4" \ + "\xb1\xd0\x16\xdd\xbd\x93\x9a\x46\x16\xe5\xe6\x62\x43\x72\xf8\xfc" \ + "\x3d\x50\x9c\x6c\xf0\x2e\x05\xc3\xf4\x98\x09\x85\x69\xf8\x86\x65" \ + "\x05\x27\x48\x9f\x44\x4c\xd2\xc1\x90\x84\x02\x87\xe1\xa7\xae\x03" \ + "\x5e\x63\xc9\xaa\x73\x98\x22\x3b\x2e\x36\x94\x19\x54\x47\xc8\x5c" \ + "\x6a\xc6\xd1\x8e\x25\xfb\xe8\xd5\xb9\x4e\xa8\xa7\x8e\x94\x8d\xbe" \ + "\x3d\x82\x0a\x7c\xbe\xb8\xe8\x7a\x23\xb9\x83\xa6\xed\xc9\x94\xab" \ + "\x66\xe4\xd6\x2c\xdc\x65\xcd\x52\x79\x90\x24\x1a\xb4\xc3\xab\xa8" \ + "\x9b\xec\xad\xe1\xeb\x67\x62\x8d\xc7\x28\x2b\xea\x49\xc5\xe1\xf3" \ + "\x5e\xcf\x52\x52\x88\xea\xe0\x1a\xda\xa4\x29\xa6\xcd\xd2\x3e\x69" \ + "\xb7\x63\xb1\x1e\xcc\xfa\x29\x9d\x0a\xea\x5f\x87\x7a\x4b\xba\xea" \ + "\xbe\x1f\x51\x53\x86\x6e\x5e\xb1\x62\x95\xb9\xbd\xbd\xfd\xa6\xd9" \ + "\x05\x23\xc3\xf2\x74\x93\x4c\x03\x90\xf2\x96\x71\x4d\x24\xf9\x7b" \ + "\xa5\xc4\x9e\x4b\x83\x03\x8b\x5a\x3b\x3a\x84\x25\xfb\xdf\x2b\x7c" \ + "\x35\x28\xfc\xe3\xb7\x7a\x80\x09\xc8\xe1\xe8\xa3\x56\xd6\xc4\xcd" \ + "\x9f\x30\xf3\x1d\xa3\x39\x16\x1e\x2c\xfa\x89\x03\x33\x75\x6b\x0e" \ + "\x5e\xde\xe2\xfc\x12\x26\x24\x61\xd8\xff\x3b\xaf\x30\x5c\xa2\x56" \ + "\xa7\x55\xab\x4c\xaf\x56\xf3\xeb\x06\x7a\x1d\x43\x08\xee\x01\xfd" \ + "\xe0\x8d\x21\x78\x03\x09\xf2\xc7\x6e\x6b\xcf\x54\xcb\x01\xed\xed" \ + "\x7d\xe5\x55\x8f\x98\xe8\x60\xd6\x91\x7d\xf1\xe3\x05\x61\x86\x71" \ + "\x9f\xaa\x21\xc6\x95\xc5\xed\x1e\xd5\x5a\x81\x49\xc4\x41\xab\x5c" \ + "\xc9\xb8\x91\xdf\x6b\xb1\xa6\xa2\x26\x98\xe9\x97\xfa\x84\x5f\x5d" \ + "\x5b\xc3\x4b\xd8\xb3\x9c\x99\xd5\x0b\xe3\xa7\x71\xe2\x5b\xb4\xbb" \ + "\xd0\xd7\x8d\x65\xba\xec\x07\x67\xdf\x0c\x44\x0b\xf0\xf6\x24\x9e" \ + "\x30\x2d\xda\x23\x68\x7b\x63\x78\xfb\x1f\x89\xc6\xff\x7d\xf2\x2f" \ + "\x5f\x86\xf8\x6e\x11\xdc\xcf\x5c\x00\x00\x00\x00\x49\x45\x4e\x44" \ + "\xae\x42\x60\x82" diff --git a/tools/esp8266/html/hexlify.py b/tools/esp8266/html/hexlify.py new file mode 100755 index 000000000..000e5b826 --- /dev/null +++ b/tools/esp8266/html/hexlify.py @@ -0,0 +1,8 @@ +#!/usr/bin/python +import sys +f = open (sys.argv[1], 'rb').read() +for n, c in enumerate(f): + if n % 16 == 0: print (' "', end = '') + print (f"\\x{c:02x}", end = '') + if n % 16 == 15: print ('" \\') +if n % 16 != 15: print ('"') diff --git a/tools/esp8266/main.cpp b/tools/esp8266/main.cpp index 14ed8667a..82d9b5e0c 100644 --- a/tools/esp8266/main.cpp +++ b/tools/esp8266/main.cpp @@ -8,13 +8,14 @@ #include "html/h/style_css.h" #include "html/h/setup_html.h" +#include "html/h/favicon.h" //----------------------------------------------------------------------------- Main::Main(void) { mDns = new DNSServer(); - mWeb = new ESP8266WebServer(80); - mUpdater = new ESP8266HTTPUpdateServer(); + mWeb = new AsyncWebServer(80); + //mUpdater = new ESP8266HTTPUpdateServer(); mUdp = new WiFiUDP(); mApActive = true; @@ -37,6 +38,8 @@ Main::Main(void) { mUptimeTicker = 0xffffffff; mUptimeInterval = 1000; + mShouldReboot = false; + #ifdef AP_ONLY mTimestamp = 1; #else @@ -53,14 +56,18 @@ void Main::setup(uint32_t timeout) { bool startAp = mApActive; mLimit = timeout; - mWeb->on("/setup", std::bind(&Main::showSetup, this)); - mWeb->on("/save", std::bind(&Main::showSave, this)); - mWeb->on("/uptime", std::bind(&Main::showUptime, this)); - mWeb->on("/time", std::bind(&Main::showTime, this)); - mWeb->on("/style.css", std::bind(&Main::showCss, this)); - mWeb->on("/reboot", std::bind(&Main::showReboot, this)); - mWeb->on("/factory", std::bind(&Main::showFactoryRst, this)); - mWeb->onNotFound ( std::bind(&Main::showNotFound, this)); + mWeb->on("/setup", HTTP_ANY, std::bind(&Main::showSetup, this, std::placeholders::_1)); + mWeb->on("/save", HTTP_ANY, std::bind(&Main::showSave, this, std::placeholders::_1)); + mWeb->on("/uptime", HTTP_ANY, std::bind(&Main::showUptime, this, std::placeholders::_1)); + mWeb->on("/time", HTTP_ANY, std::bind(&Main::showTime, this, std::placeholders::_1)); + mWeb->on("/style.css", HTTP_ANY, std::bind(&Main::showCss, this, std::placeholders::_1)); + mWeb->on("/favicon.ico", HTTP_ANY, std::bind(&Main::showFavicon, this, std::placeholders::_1)); + mWeb->on("/reboot", HTTP_ANY, std::bind(&Main::showReboot, this, std::placeholders::_1)); + mWeb->on("/factory", HTTP_ANY, std::bind(&Main::showFactoryRst, this, std::placeholders::_1)); + mWeb->on("/update", HTTP_GET, std::bind(&Main::showUpdateForm, this, std::placeholders::_1)); + mWeb->on("/update", HTTP_POST, std::bind(&Main::showUpdate, this, std::placeholders::_1), + std::bind(&Main::showUpdate2, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); + mWeb->onNotFound( std::bind(&Main::showNotFound, this, std::placeholders::_1)); startAp = getConfig(); @@ -69,7 +76,6 @@ void Main::setup(uint32_t timeout) { startAp = setupStation(timeout); #endif - mUpdater->setup(mWeb); mApActive = startAp; mStActive = !startAp; } @@ -104,7 +110,7 @@ void Main::loop(void) { } #endif } - mWeb->handleClient(); + //mWeb->handleClient(); if(checkTicker(&mUptimeTicker, mUptimeInterval)) { mUptimeSecs++; @@ -122,6 +128,12 @@ void Main::loop(void) { stats(); }*/ } + + if(mShouldReboot) { + Serial.println("Rebooting..."); + delay(100); + ESP.restart(); + if (WiFi.status() != WL_CONNECTED) { DPRINTLN(DBG_INFO, "[WiFi]: Connection Lost"); mStActive = false; @@ -171,10 +183,10 @@ void Main::setupAp(const char *ssid, const char *pwd) { mDns->start(mDnsPort, "*", apIp); - mWeb->onNotFound([&]() { + /*mWeb->onNotFound([&]() { showSetup(); }); - mWeb->on("/", std::bind(&Main::showSetup, this)); + mWeb->on("/", std::bind(&Main::showSetup, this));*/ mWeb->begin(); } @@ -231,7 +243,7 @@ bool Main::setupStation(uint32_t timeout) { //----------------------------------------------------------------------------- -void Main::showSetup(void) { +void Main::showSetup(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("Main::showSetup")); String html = FPSTR(setup_html); html.replace(F("{SSID}"), mStationSsid); @@ -244,52 +256,65 @@ void Main::showSetup(void) { else html.replace("{IP}", (F("http://") + String(WiFi.localIP().toString()))); - mWeb->send(200, F("text/html"), html); + request->send(200, F("text/html"), html); } //----------------------------------------------------------------------------- -void Main::showCss(void) { +void Main::showCss(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("Main::showCss")); - mWeb->send(200, "text/css", FPSTR(style_css)); + request->send(200, "text/css", FPSTR(style_css)); } //----------------------------------------------------------------------------- -void Main::showSave(void) { +void Main::showFavicon(AsyncWebServerRequest *request) { + DPRINTLN(DBG_VERBOSE, F("app::showFavicon")); + static const char favicon_type[] PROGMEM = "image/x-icon"; + static const unsigned char favicon_content[] PROGMEM = FAVICON_PANEL_57; + // mWeb->send_P(200, favicon_type, favicon_content, sizeof(favicon_content)); + AsyncWebServerResponse *response = request->beginResponse_P(200, favicon_type, favicon_content, sizeof(favicon_content)); + // response->addHeader(F("Content-Encoding"), "gzip"); + request->send(response); +} + + + +//----------------------------------------------------------------------------- +void Main::showSave(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("Main::showSave")); - saveValues(true); + saveValues(request, true); } //----------------------------------------------------------------------------- -void Main::saveValues(bool webSend = true) { +void Main::saveValues(AsyncWebServerRequest *request, bool webSend = true) { DPRINTLN(DBG_VERBOSE, F("Main::saveValues")); - if(mWeb->args() > 0) { - if(mWeb->arg("ssid") != "") { + if(request->args() > 0) { + if(request->arg("ssid") != "") { memset(mStationSsid, 0, SSID_LEN); - mWeb->arg("ssid").toCharArray(mStationSsid, SSID_LEN); + request->arg("ssid").toCharArray(mStationSsid, SSID_LEN); mEep->write(ADDR_SSID, mStationSsid, SSID_LEN); - if(mWeb->arg("pwd") != "{PWD}") { + if(request->arg("pwd") != "{PWD}") { memset(mStationPwd, 0, PWD_LEN); - mWeb->arg("pwd").toCharArray(mStationPwd, PWD_LEN); + request->arg("pwd").toCharArray(mStationPwd, PWD_LEN); mEep->write(ADDR_PWD, mStationPwd, PWD_LEN); } } memset(mDeviceName, 0, DEVNAME_LEN); - mWeb->arg("device").toCharArray(mDeviceName, DEVNAME_LEN); + request->arg("device").toCharArray(mDeviceName, DEVNAME_LEN); mEep->write(ADDR_DEVNAME, mDeviceName, DEVNAME_LEN); mEep->commit(); updateCrc(); if(webSend) { - if(mWeb->arg("reboot") == "on") - showReboot(); + if(request->arg("reboot") == "on") + showReboot(request); else // TODO: add device name as redirect in AP-mode - mWeb->send(200, F("text/html"), F("Setup saved" + request->send(200, F("text/html"), F("Setup saved" "

saved

")); } } @@ -308,7 +333,7 @@ void Main::updateCrc(void) { //----------------------------------------------------------------------------- -void Main::showUptime(void) { +void Main::showUptime(AsyncWebServerRequest *request) { //DPRINTLN(DBG_VERBOSE, F("Main::showUptime")); char time[20] = {0}; @@ -319,53 +344,51 @@ void Main::showUptime(void) { snprintf(time, 20, "%d Tage, %02d:%02d:%02d", upTimeDy, upTimeHr, upTimeMn, upTimeSc); - mWeb->send(200, "text/plain", String(time)); + request->send(200, "text/plain", String(time)); } //----------------------------------------------------------------------------- -void Main::showTime(void) { +void Main::showTime(AsyncWebServerRequest *request) { //DPRINTLN(DBG_VERBOSE, F("Main::showTime")); - mWeb->send(200, "text/plain", getDateTimeStr(mTimestamp)); + request->send(200, "text/plain", getDateTimeStr(mTimestamp)); } //----------------------------------------------------------------------------- -void Main::showNotFound(void) { - DPRINTLN(DBG_VERBOSE, F("Main::showNotFound - ") + mWeb->uri()); - String msg = F("File Not Found\n\nURI: "); - msg += mWeb->uri(); +void Main::showNotFound(AsyncWebServerRequest *request) { + DPRINTLN(DBG_VERBOSE, F("Main::showNotFound - ") + request->url()); + String msg = F("File Not Found\n\nURL: "); + msg += request->url(); msg += F("\nMethod: "); - msg += ( mWeb->method() == HTTP_GET ) ? "GET" : "POST"; + msg += ( request->method() == HTTP_GET ) ? "GET" : "POST"; msg += F("\nArguments: "); - msg += mWeb->args(); + msg += request->args(); msg += "\n"; - for(uint8_t i = 0; i < mWeb->args(); i++ ) { - msg += " " + mWeb->argName(i) + ": " + mWeb->arg(i) + "\n"; + for(uint8_t i = 0; i < request->args(); i++ ) { + msg += " " + request->argName(i) + ": " + request->arg(i) + "\n"; } - mWeb->send(404, F("text/plain"), msg); + request->send(404, F("text/plain"), msg); } //----------------------------------------------------------------------------- -void Main::showReboot(void) { +void Main::showReboot(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("Main::showReboot")); - mWeb->send(200, F("text/html"), F("Rebooting ...rebooting ... auto reload after 10s")); - delay(1000); - ESP.restart(); + request->send(200, F("text/html"), F("Rebooting ...rebooting ... auto reload after 10s")); + mShouldReboot = true; } - //----------------------------------------------------------------------------- -void Main::showFactoryRst(void) { +void Main::showFactoryRst(AsyncWebServerRequest *request) { DPRINTLN(DBG_VERBOSE, F("Main::showFactoryRst")); String content = ""; int refresh = 3; - if(mWeb->args() > 0) { - if(mWeb->arg("reset").toInt() == 1) { + if(request->args() > 0) { + if(request->arg("reset").toInt() == 1) { eraseSettings(true); content = F("factory reset: success\n\nrebooting ... "); refresh = 10; @@ -380,7 +403,7 @@ void Main::showFactoryRst(void) { "

RESET

CANCEL

"); refresh = 120; } - mWeb->send(200, F("text/html"), F("Factory Reset") + content + F("")); + request->send(200, F("text/html"), F("Factory Reset") + content + F("")); if(refresh == 10) { delay(1000); ESP.restart(); @@ -388,6 +411,45 @@ void Main::showFactoryRst(void) { } +//----------------------------------------------------------------------------- +void Main::showUpdateForm(AsyncWebServerRequest *request) { + request->send(200, F("text/html"), F("
")); +} + + +//----------------------------------------------------------------------------- +void Main::showUpdate(AsyncWebServerRequest *request) { + mShouldReboot = !Update.hasError(); + AsyncWebServerResponse *response = request->beginResponse(200, "text/plain", mShouldReboot ? "OK" : "FAIL"); + response->addHeader("Connection", "close"); + request->send(response); +} + + +//----------------------------------------------------------------------------- +void Main::showUpdate2(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { + if(!index) { + Serial.printf("Update Start: %s\n", filename.c_str()); + Update.runAsync(true); + if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)) { + Update.printError(Serial); + } + } + if(!Update.hasError()) { + if(Update.write(data, len) != len){ + Update.printError(Serial); + } + } + if(final) { + if(Update.end(true)) { + Serial.printf("Update Success: %uB\n", index+len); + } else { + Update.printError(Serial); + } + } +} + + //----------------------------------------------------------------------------- time_t Main::getNtpTime(void) { //DPRINTLN(DBG_VERBOSE, F("Main::getNtpTime")); diff --git a/tools/esp8266/main.h b/tools/esp8266/main.h index 8f114f091..affd31ca4 100644 --- a/tools/esp8266/main.h +++ b/tools/esp8266/main.h @@ -11,9 +11,10 @@ #include #include -#include - -#include +//#include +//#include +#include "ESPAsyncTCP.h" +#include "ESPAsyncWebServer.h" // NTP #include @@ -41,8 +42,8 @@ class Main { protected: - void showReboot(void); - virtual void saveValues(bool webSend); + void showReboot(AsyncWebServerRequest *request); + virtual void saveValues(AsyncWebServerRequest *request, bool webSend); virtual void updateCrc(void); inline uint16_t buildEEpCrc(uint32_t start, uint32_t length) { @@ -118,8 +119,8 @@ class Main { bool mWifiSettingsValid; bool mSettingsValid; bool mApActive; + AsyncWebServer *mWeb; bool mStActive; - ESP8266WebServer *mWeb; char mVersion[9]; char mDeviceName[DEVNAME_LEN]; eep *mEep; @@ -128,18 +129,24 @@ class Main { uint32_t mNextTryTs; uint32_t mApLastTick; + bool mShouldReboot; + private: bool getConfig(void); void setupAp(const char *ssid, const char *pwd); bool setupStation(uint32_t timeout); - void showNotFound(void); - virtual void showSetup(void); - virtual void showSave(void); - void showUptime(void); - void showTime(void); - void showCss(void); - void showFactoryRst(void); + void showNotFound(AsyncWebServerRequest *request); + virtual void showSetup(AsyncWebServerRequest *request); + virtual void showSave(AsyncWebServerRequest *request); + void showUptime(AsyncWebServerRequest *request); + void showTime(AsyncWebServerRequest *request); + void showCss(AsyncWebServerRequest *request); + void showFavicon(AsyncWebServerRequest *request); + void showFactoryRst(AsyncWebServerRequest *request); + void showUpdateForm(AsyncWebServerRequest *request); + void showUpdate(AsyncWebServerRequest *request); + void showUpdate2(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final); time_t getNtpTime(void); void sendNTPpacket(IPAddress& address); @@ -151,7 +158,7 @@ class Main { uint8_t mHeapStatCnt; DNSServer *mDns; - ESP8266HTTPUpdateServer *mUpdater; + //ESP8266HTTPUpdateServer *mUpdater; WiFiUDP *mUdp; // for time server }; diff --git a/tools/esp8266/platformio.ini b/tools/esp8266/platformio.ini index ecfe47480..fb2305fb9 100644 --- a/tools/esp8266/platformio.ini +++ b/tools/esp8266/platformio.ini @@ -16,16 +16,16 @@ platform = espressif8266 framework = arduino board = d1_mini board_build.f_cpu = 80000000L - -; ;;;;; Possible Debug options ;;;;;; -; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level -;build_flags = -DDEBUG_ESP_PORT=Serial - ;-DDEBUG_ESP_CORE +board_upload.maximum_size = 1048576 +build_flags = -Wl,-Teagle.flash.1m64.ld + ; ;;;;; Possible Debug options ;;;;;; + ; https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level + ;-DDEBUG_ESP_PORT=Serial + ;-DDEBUG_ESP_CORE ;-DDEBUG_ESP_WIFI ;-DDEBUG_ESP_HTTP_CLIENT ;-DDEBUG_ESP_HTTP_SERVER ;-DDEBUG_ESP_OOM - monitor_speed = 115200 monitor_filters = ;default ; Remove typical terminal control codes from input @@ -39,14 +39,16 @@ lib_deps = nrf24/RF24@1.4.5 paulstoffregen/Time@^1.6.1 knolleary/PubSubClient@^2.8 - bblanchon/ArduinoJson@^6.19.4 - ;esp8266/DNSServer@1.1.0 - ;esp8266/EEPROM@^1.0 - ;esp8266/ESP8266HTTPUpdateServer@^1.0 - ;esp8266/ESP8266WebServer@^1.0 - ;esp8266/ESP8266WiFi@^1.0 - ;esp8266/SPI@1.0 - ;esp8266/Ticker@^1.0 + bblanchon/ArduinoJson@^6.19.4 + me-no-dev/ESP Async WebServer@^1.2.3 + me-no-dev/ESPAsyncTCP@^1.2.2 + ;esp8266/DNSServer@1.1.0 + ;esp8266/EEPROM@^1.0 + ;esp8266/ESP8266HTTPUpdateServer@^1.0 + ;esp8266/ESP8266WebServer@^1.0 + ;esp8266/ESP8266WiFi@^1.0 + ;esp8266/SPI@1.0 + ;esp8266/Ticker@^1.0 [env:node_mcu_v2] platform = espressif8266 @@ -77,11 +79,13 @@ lib_deps = nrf24/RF24@1.4.5 paulstoffregen/Time@^1.6.1 knolleary/PubSubClient@^2.8 - bblanchon/ArduinoJson@^6.19.4 - ;esp8266/DNSServer@1.1.0 - ;esp8266/EEPROM@^1.0 - ;esp8266/ESP8266HTTPUpdateServer@^1.0 - ;esp8266/ESP8266WebServer@^1.0 - ;esp8266/ESP8266WiFi@^1.0 - ;esp8266/SPI@1.0 - ;esp8266/Ticker@^1.0 \ No newline at end of file + bblanchon/ArduinoJson@^6.19.4 + me-no-dev/ESP Async WebServer@^1.2.3 + me-no-dev/ESPAsyncTCP@^1.2.2 + ;esp8266/DNSServer@1.1.0 + ;esp8266/EEPROM@^1.0 + ;esp8266/ESP8266HTTPUpdateServer@^1.0 + ;esp8266/ESP8266WebServer@^1.0 + ;esp8266/ESP8266WiFi@^1.0 + ;esp8266/SPI@1.0 + ;esp8266/Ticker@^1.0