Przeglądaj źródła

Rolling 20220919

jomjol 3 lat temu
rodzic
commit
d479c8d44e

+ 1 - 0
.gitignore

@@ -5,6 +5,7 @@
 /sd-card/htm./.vscode/
 /code/build
 /sd-card/html/debug/
+/firmware/
 
 CMakeLists.txt.user
 CMakeCache.txt

+ 7 - 0
README.md

@@ -40,6 +40,13 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
 
 ------
 
+##### Rolling (2022-09-19)
+
+- Integrated version info better into the html (main page, logfile)
+- Updated autobuild
+- Remove `/firmware` from GitHub. 
+  - If you want to get the latest firmware and html files, please download from the automated build action.
+
 ##### Rolling (2022-09-18)
 
 - Updated PostProcessing with respect to `CheckDigitIncreaseConsistency`

+ 14 - 7
code/components/jomjol_fileserver_ota/server_ota.cpp

@@ -302,7 +302,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
     char _valuechar[30];    
     std::string fn = "/sdcard/firmware/";
     bool _file_del = false;
-    std::string _task;
+    std::string _task = "";
 
     if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
     {
@@ -419,6 +419,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
 
     if (_task.compare("unziphtml") == 0)
     {
+        printf("Task unziphmtl\n");
         std::string in, out, zw;
 
         in = "/sdcard/firmware/html.zip";
@@ -428,24 +429,30 @@ esp_err_t handler_ota_update(httpd_req_t *req)
 
         unzip(in, out+"/");
         zw = "HTML Update Successfull!<br><br>No reboot necessary";
-        httpd_resp_sendstr_chunk(req, zw.c_str());
+        httpd_resp_send(req, zw.c_str(), strlen(zw.c_str()));
         httpd_resp_sendstr_chunk(req, NULL);  
         return ESP_OK;        
     }
 
-
-
     if (_file_del)
     {
+        printf("Delete !! _file_del: %s\n", fn.c_str());
         struct stat file_stat;
-        if (stat(fn.c_str(), &file_stat) != -1) {
+        int _result = stat(fn.c_str(), &file_stat);
+        printf("Ergebnis %d\n", _result);
+        if (_result == 0) {
             printf("Deleting file : %s", fn.c_str());
             /* Delete file */
             unlink(fn.c_str());
         }
+        else
+        {
+            printf("File does not exist: %s\n", fn.c_str());
+        }
         /* Respond with an empty chunk to signal HTTP response completion */
-        std::string zw = "file deleted!\n";
-        httpd_resp_sendstr_chunk(req, zw.c_str());
+        std::string zw = "file deleted\n";
+        printf((zw + "\n").c_str());
+        httpd_resp_send(req, zw.c_str(), strlen(zw.c_str()));
         httpd_resp_send_chunk(req, NULL, 0);
         return ESP_OK;
     }

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="645fbf0";
+const char* GIT_REV="45c9914";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2022-09-18 18:22";
+const char* BUILD_TIME="2022-09-19 20:06";

+ 1 - 0
code/sd-card/html/version.txt

@@ -0,0 +1 @@
+rolling, 45c9914, 

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="645fbf0";
+const char* GIT_REV="45c9914";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2022-09-18 18:22";
+const char* BUILD_TIME="2022-09-19 20:06";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin


BIN
firmware/html.zip


+ 31 - 4
sd-card/html/ota_page_new.html

@@ -158,8 +158,8 @@ function upload() {
 
     /* Max size of an individual file. Make sure this
      * value is same as that set in file_server.c */
-    var MAX_FILE_SIZE = 6000*1024;
-    var MAX_FILE_SIZE_STR = "6MB";
+    var MAX_FILE_SIZE = 8000*1024;
+    var MAX_FILE_SIZE_STR = "8MB";
 
     if (fileInput.length == 0) {
         alert("No file selected!");
@@ -179,7 +179,7 @@ function upload() {
         xhttp.onreadystatechange = function() {
             if (xhttp.readyState == 4) {
                 if (xhttp.status == 200) {
-					alert("Upload successfull!")
+//					alert("Upload successfull!")
 //                    document.reload();
                     document.getElementById("reboot").disabled = false;
                     document.getElementById("doUpdate").disabled = false;
@@ -195,9 +195,36 @@ function upload() {
 		
 
         var file = fileInput[0];
-        xhttp.open("POST", upload_path, true);
+        xhttp.open("POST", upload_path, false);
         xhttp.send(file);
     }
+
+    alert("Start processing!");
+
+	var xhttp = new XMLHttpRequest();
+	/* first delete the old firmware */	
+	xhttp.onreadystatechange = function() {
+		if (xhttp.readyState == 4) {
+			if (xhttp.status == 200) {
+                alert("Processing done!\n" + xhttp.responseText);
+				/* keine Reaktion, damit sich das Dokument nicht ändert */
+			} else if (xhttp.status == 0) {
+				alert("Server closed the connection abruptly!");
+				UpdatePage();
+			} else {
+				alert(xhttp.status + " Error!\n" + xhttp.responseText);
+				UpdatePage();
+			}
+		}
+	};
+    var _toDo = basepath + "/ota?task=update&file=" + filePath;
+	xhttp.open("GET", _toDo, false);
+	xhttp.send();
+	/* ----------------------------- */
+
+
+
+
 }
 
 init();

+ 1 - 2
sd-card/html/version.txt

@@ -1,2 +1 @@
-# HTML version
-# Do not edit, it will get be updated by cmake!
+rolling, 45c9914,