diff --git a/ESP32_AP-Flasher/data/update_actions.json b/ESP32_AP-Flasher/data/update_actions.json index f67e1f37..376b9e34 100644 --- a/ESP32_AP-Flasher/data/update_actions.json +++ b/ESP32_AP-Flasher/data/update_actions.json @@ -18,6 +18,46 @@ "/fonts/calibrib150.vlw", "/fonts/calibrib50.vlw", "/fonts/calibrib60.vlw", - "/fonts/BellCent10.vlw" + "/fonts/BellCent10.vlw", + "/tagtypes/00.json", + "/tagtypes/01.json", + "/tagtypes/02.json", + "/tagtypes/05.json", + "/tagtypes/11.json", + "/tagtypes/21.json", + "/tagtypes/22.json", + "/tagtypes/26.json", + "/tagtypes/27.json", + "/tagtypes/2E.json", + "/tagtypes/2F.json", + "/tagtypes/30.json", + "/tagtypes/31.json", + "/tagtypes/32.json", + "/tagtypes/33.json", + "/tagtypes/34.json", + "/tagtypes/35.json", + "/tagtypes/36.json", + "/tagtypes/40.json", + "/tagtypes/41.json", + "/tagtypes/42.json", + "/tagtypes/43.json", + "/tagtypes/55.json", + "/tagtypes/60.json", + "/tagtypes/61.json", + "/tagtypes/62.json", + "/tagtypes/80.json", + "/tagtypes/81.json", + "/tagtypes/82.json", + "/tagtypes/83.json", + "/tagtypes/B0.json", + "/tagtypes/B1.json", + "/tagtypes/B2.json", + "/tagtypes/B3.json", + "/tagtypes/B5.json", + "/tagtypes/BD.json", + "/tagtypes/BE.json", + "/tagtypes/E0.json", + "/tagtypes/E1.json", + "/tagtypes/F0.json" ] } diff --git a/ESP32_AP-Flasher/src/serialap.cpp b/ESP32_AP-Flasher/src/serialap.cpp index f435a716..db4cb05e 100644 --- a/ESP32_AP-Flasher/src/serialap.cpp +++ b/ESP32_AP-Flasher/src/serialap.cpp @@ -180,8 +180,8 @@ void APTagReset() { // Send data to the AP uint16_t sendBlock(const void* data, const uint16_t len) { time_t timeCanary = millis(); - if(apInfo.state == AP_STATE_NORADIO)return true; - if (!apInfo.isOnline) return false; + if (apInfo.state == AP_STATE_NORADIO) return true; + if (!apInfo.isOnline) return false; if (!txStart()) return 0; // don't retry now, as it collides with communication from the tag for (uint8_t attempt = 0; attempt < 1; attempt++) { @@ -249,7 +249,7 @@ blksend: } bool sendDataAvail(struct pendingData* pending) { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (!apInfo.isOnline) return false; if (!txStart()) return false; addCRC(pending, sizeof(struct pendingData)); @@ -271,7 +271,7 @@ bool sendDataAvail(struct pendingData* pending) { return false; } bool sendCancelPending(struct pendingData* pending) { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (!apInfo.isOnline) return false; if (!txStart()) return false; addCRC(pending, sizeof(struct pendingData)); @@ -292,7 +292,7 @@ bool sendCancelPending(struct pendingData* pending) { return false; } bool sendChannelPower(struct espSetChannelPower* scp) { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if ((apInfo.state != AP_STATE_ONLINE) && (apInfo.state != AP_STATE_COMING_ONLINE)) return false; if (!txStart()) return false; addCRC(scp, sizeof(struct espSetChannelPower)); @@ -315,7 +315,7 @@ bool sendChannelPower(struct espSetChannelPower* scp) { return false; } bool sendPing() { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (apInfo.state == AP_STATE_FLASHING) return false; Serial.print("ping"); int t = millis(); @@ -334,7 +334,7 @@ bool sendPing() { return false; } bool sendGetInfo() { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (!txStart()) return false; for (uint8_t attempt = 0; attempt < 5; attempt++) { cmdReplyValue = CMD_REPLY_WAIT; @@ -348,7 +348,7 @@ bool sendGetInfo() { return false; } bool sendHighspeed() { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (!txStart()) return false; for (uint8_t attempt = 0; attempt < 5; attempt++) { cmdReplyValue = CMD_REPLY_WAIT; @@ -614,17 +614,16 @@ void rxSerialTask(void* parameter) { case ZBS_RX_WAIT_SUBCHANNEL: cmdbuffer[charindex] = lastchar; charindex++; - if(charindex == 3) { - RXState = ZBS_RX_WAIT_HEADER; - int Channel = atoi(cmdbuffer); - if(Channel != NO_SUBGHZ_CHANNEL) { - apInfo.hasSubGhz = true; - apInfo.SubGhzChannel = Channel; - } - else { - apInfo.hasSubGhz = false; - apInfo.SubGhzChannel = 0; - } + if (charindex == 3) { + RXState = ZBS_RX_WAIT_HEADER; + int Channel = atoi(cmdbuffer); + if (Channel != NO_SUBGHZ_CHANNEL) { + apInfo.hasSubGhz = true; + apInfo.SubGhzChannel = Channel; + } else { + apInfo.hasSubGhz = false; + apInfo.SubGhzChannel = 0; + } } break; #endif @@ -745,7 +744,7 @@ void segmentedShowIp() { } bool bringAPOnline() { - if(apInfo.state == AP_STATE_NORADIO)return true; + if (apInfo.state == AP_STATE_NORADIO) return true; if (apInfo.state == AP_STATE_FLASHING) return false; setAPstate(false, AP_STATE_OFFLINE); // try without rebooting diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp index 9393a33f..5e557f99 100644 --- a/ESP32_AP-Flasher/src/web.cpp +++ b/ESP32_AP-Flasher/src/web.cpp @@ -131,8 +131,9 @@ void wsSendSysteminfo() { if (timeinfo.tm_hour == 4 && timeinfo.tm_min == 0 && millis() > 2 * 3600 * 1000) { logLine("Nightly reboot"); wsErr("REBOOTING"); - delay(100); + config.runStatus = RUNSTATUS_STOP; ws.enable(false); + vTaskDelay(5000 / portTICK_PERIOD_MS); refreshAllPending(); saveDB("/current/tagDB.json"); ws.closeAll(); @@ -721,18 +722,27 @@ void init_web() { ws.enable(false); if (jsonObj["ssid"].as() == "factory") { + config.runStatus = RUNSTATUS_STOP; + vTaskDelay(2000 / portTICK_PERIOD_MS); preferences.begin("wifi", false); preferences.putString("ssid", ""); preferences.putString("pw", ""); preferences.end(); + destroyDB(); + cleanupCurrent(); contentFS->remove("/AP_FW_Pack.bin"); contentFS->remove("/OpenEPaperLink_esp32_C6.bin"); contentFS->remove("/bootloader.bin"); contentFS->remove("/partition-table.bin"); contentFS->remove("/update_actions.json"); contentFS->remove("/log.txt"); + contentFS->remove("/logold.txt"); contentFS->remove("/current/tagDB.json"); + contentFS->remove("/current/tagDB.json.bak"); + contentFS->remove("/current/tagDBrestored.json"); + contentFS->remove("/current/apconfig.json"); delay(100); + esp_deep_sleep_start(); ESP.restart(); } else { refreshAllPending(); diff --git a/resources/tagtypes/40.json b/resources/tagtypes/40.json index f3406366..db278221 100644 --- a/resources/tagtypes/40.json +++ b/resources/tagtypes/40.json @@ -1,16 +1,15 @@ { - "version": 0, + "version": 1, "name": "M3 2.9\" BW", "width": 384, "height": 168, "rotatebuffer": 3, "bpp": 1, - "colors": 2, "colortable": { "white": [ 255, 255, 255 ], - "black": [ 0, 0, 0 ], - "gray": [ 150, 150, 150 ] + "black": [ 0, 0, 0 ] }, + "highlight_color": 5, "shortlut": 0, "zlib_compression": "27", "options": [ "button", "led" ],