From cfd9d5baa01cb233ef6bd2251733190a0985c1d3 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Mon, 19 Oct 2020 01:21:20 +0300 Subject: [PATCH] esp32 version --- include/Consts.h | 8 ++++++-- src/UpgradeFirm.cpp | 8 ++++++-- src/main.cpp | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/Consts.h b/include/Consts.h index 5c1f6abf..bbe33076 100644 --- a/include/Consts.h +++ b/include/Consts.h @@ -3,8 +3,12 @@ // // Firmware // - +#ifdef ESP8266 #define FIRMWARE_NAME "esp8266-iotm" +#endif +#ifdef ESP32 +#define FIRMWARE_NAME "esp32-iotm" +#endif #define FIRMWARE_VERSION 258 #define FLASH_4MB true @@ -39,7 +43,7 @@ //#define WEBSOCKET_ENABLED //#define LAYOUT_IN_RAM //#define UDP_ENABLED -//#define SSDP_ENABLED +#define SSDP_ENABLED // // Sensors enable/disable diff --git a/src/UpgradeFirm.cpp b/src/UpgradeFirm.cpp index 669870f9..78171b22 100644 --- a/src/UpgradeFirm.cpp +++ b/src/UpgradeFirm.cpp @@ -32,7 +32,11 @@ void upgradeInit() { void getLastVersion() { if ((WiFi.status() == WL_CONNECTED)) { + #ifdef ESP8266 String tmp = getURL(F("http://95.128.182.133/projects/iotmanager/esp8266/esp8266ver/esp8266ver.txt")); + #else + String tmp = getURL(F("http://95.128.182.133/projects/iotmanager/esp32/esp32ver/esp32ver.txt")); + #endif if (tmp == "error") { lastVersion = -1; } else { @@ -88,7 +92,7 @@ bool upgradeFS() { t_httpUpdate_return retFS = ESPhttpUpdate.updateSpiffs(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/littlefs/littlefs.bin")); #else httpUpdate.rebootOnUpdate(false); - HTTPUpdateResult retFS = httpUpdate.updateSpiffs(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/littlefs/littlefs.bin")); + HTTPUpdateResult retFS = httpUpdate.updateSpiffs(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp32/littlefs/littlefs.bin")); #endif if (retFS == HTTP_UPDATE_OK) { //если FS обновилась успешно SerialPrint("I", "Update", "LittleFS upgrade done!"); @@ -107,7 +111,7 @@ bool upgradeBuild() { t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/firmware/firmware.bin")); #else httpUpdate.rebootOnUpdate(false); - HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/firmware/firmware.bin")); + HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp32/firmware/firmware.bin")); #endif if (retBuild == HTTP_UPDATE_OK) { //если BUILD обновился успешно diff --git a/src/main.cpp b/src/main.cpp index c8ebba41..fce31a41 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,11 +80,13 @@ void setup() { SerialPrint("I", "Bus", "Bus Init"); busInit(); -#ifdef SSDP_EN +#ifdef SSDP_ENABLED SerialPrint("I", "SSDP", "Ssdp Init"); SsdpInit(); #endif + //esp_log_level_set("esp_littlefs", ESP_LOG_NONE); + ts.add( TEST, 1000 * 60, [&](void*) { SerialPrint("I", "System", printMemoryStatus());