diff --git a/README.md b/README.md index 840ff918..012991bd 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,11 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571 +##### 1.1.1 (2020-09-07) + +* Improved update page for the web server (`/html` can be updated via a zip-file, which is provided in `/firmware/html.zip`) + **Attention: beside the `firmware.bin`, also the content of `/html` needs to be updated!** + ##### 1.1.0 (2020-09-06) * Implementation of "delete complete directory" diff --git a/code/lib/jomjol_fileserver_ota/server_ota.cpp b/code/lib/jomjol_fileserver_ota/server_ota.cpp index e9ab7f6c..ecd17a44 100644 --- a/code/lib/jomjol_fileserver_ota/server_ota.cpp +++ b/code/lib/jomjol_fileserver_ota/server_ota.cpp @@ -338,7 +338,9 @@ esp_err_t handler_ota_update(httpd_req_t *req) std::string in, out, zw; in = "/sdcard/firmware/html.zip"; - out = "/sdcard/html2/"; + out = "/sdcard/html/"; + + delete_all_in_directory(out); unzip(in, out); zw = "HTML Update Successfull!

No reboot necessary"; diff --git a/code/src/server_main.cpp b/code/src/server_main.cpp index 9885cfc7..f7cfe548 100644 --- a/code/src/server_main.cpp +++ b/code/src/server_main.cpp @@ -105,6 +105,7 @@ esp_err_t hello_main_handler(httpd_req_t *req) char filepath[50]; struct stat file_stat; printf("uri: %s\n", req->uri); + int _pos; char *base_path = (char*) req->user_ctx; std::string filetosend(base_path); @@ -120,9 +121,15 @@ esp_err_t hello_main_handler(httpd_req_t *req) else { filetosend = filetosend + "/html" + std::string(req->uri); + _pos = filetosend.find("?"); + if (_pos > -1){ + filetosend = filetosend.substr(0, _pos); + } } + + printf("Filename: %s\n", filename); - printf("File to upload: %s\n", filetosend.c_str()); + printf("File requested: %s\n", filetosend.c_str()); if (!filename) { ESP_LOGE(TAG, "Filename is too long"); diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index c233048a..923fa18b 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index dd146858..319d1962 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ diff --git a/firmware/html.zip b/firmware/html.zip new file mode 100644 index 00000000..2c0e0fc7 Binary files /dev/null and b/firmware/html.zip differ diff --git a/sd-card/html/edit_digits.html b/sd-card/html/edit_digits.html index 46230094..1a9ce4d8 100644 --- a/sd-card/html/edit_digits.html +++ b/sd-card/html/edit_digits.html @@ -152,7 +152,10 @@ function ChangeSelection(){ function SaveToConfig(){ SaveROIToConfig(ROIInfo, "[Digits]", basepath); - location.reload(); +// location.reload(); +// parent.window.location.reload(true); +// window.location = location.href + '?session=' + Math.floor((Math.random() * 1000000) + 1); + UpdatePage(); } diff --git a/sd-card/html/edit_reference.html b/sd-card/html/edit_reference.html index a15b57aa..2500d92a 100644 --- a/sd-card/html/edit_reference.html +++ b/sd-card/html/edit_reference.html @@ -101,13 +101,8 @@ setPreRotate(document.getElementById("prerotateangle").value); UpdateConfigFile(basepath); var canvas = document.getElementById("canvas"); - var okay = SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath); - if (okay) { - alert("Update \"reference.jpg\" successfull!") - } - else { - alert("Error on update \"reference.jpg\"!") - } + SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath); + showReference(); } } diff --git a/sd-card/html/gethost.js b/sd-card/html/gethost.js index 91674459..34343236 100644 --- a/sd-card/html/gethost.js +++ b/sd-card/html/gethost.js @@ -13,3 +13,9 @@ function getbasepath(){ } return host; } + +function UpdatePage(){ + var zw = location.href; + zw = zw.substr(0, zw.indexOf("?")); + window.location = zw + '?session=' + Math.floor((Math.random() * 1000000) + 1); +} diff --git a/sd-card/html/ota_page.html b/sd-card/html/ota_page.html index e16f77cd..5712a4d9 100644 --- a/sd-card/html/ota_page.html +++ b/sd-card/html/ota_page.html @@ -10,41 +10,151 @@ +

It is strongly recommended to update firmware and content of /html directory on SD-card at the same time!

+

1. Firmware Update

- + + +
- - - - - - - - - - -
- - - -
- - - - - -
-
+ + + + + + + + + + +
+ + + +
+ + + + + +
+
- (Takes about 60s) + (Takes about 60s)
- + + + diff --git a/sd-card/html/upload_script.html b/sd-card/html/upload_script.html index 669f13e0..0472f78e 100644 --- a/sd-card/html/upload_script.html +++ b/sd-card/html/upload_script.html @@ -29,6 +29,8 @@ + + @@ -85,11 +83,11 @@ Raw Value:

- +

Corrected Value:

- +