Moved index.html from SPIFFS to program memory. Removed dependencies to SPIFFS. Also, we can use a different partition scheme with much more program space instead of reserving some of it for SPIFFS.

This commit is contained in:
2019-11-29 06:10:17 +01:00
parent dd9e1538c8
commit 8e15f87cd3
11 changed files with 23 additions and 61 deletions

View File

@@ -4,8 +4,7 @@
#include "updater.h"
#include "http_client_wrapper.h"
void Updater::run(uint16_t spiffs_version) {
bool update_image = true;
void Updater::run() {
DEBUG("Updater is running...\n");
HTTPClientWrapper* http = new HTTPClientWrapper();
DEBUG("Requesting update info...\n");
@@ -26,12 +25,7 @@ void Updater::run(uint16_t spiffs_version) {
}
DEBUG("Found version %d. My version is %d.\n", version, OTA_VERSION);
if (version <= OTA_VERSION) {
if (spiffs_version>0 && spiffs_version < version) {
update_image = false;
DEBUG("SPIFFS needs an update. Continuing.\n");
} else {
return;
}
return;
}
String image_path = "";
@@ -44,27 +38,15 @@ void Updater::run(uint16_t spiffs_version) {
return;
}
String spiffs_path = "";
if (!read_line(&spiffs_path, http, "SPIFFS_PATH")) {
return;
}
String spiffs_md5 = "";
if (!read_line(&spiffs_md5, http, "SPIFFS_MD5")) {
return;
}
http->close();
delete http;
result = true;
if (update_image) {
result = do_update(U_FLASH, image_path, image_md5);
if(do_update(U_FLASH, image_path, image_md5)) {
DEBUG("Update done. Rebooting...\n");
} else {
DEBUG("Update failed. Rebooting...\n");
}
if (result) {
do_update(U_SPIFFS, spiffs_path, spiffs_md5);
}
DEBUG("Done. Rebooting...\n");
delay(1000);
ESP.restart();
}