Compare commits
	
		
			4 Commits
		
	
	
		
			312f75fc5f
			...
			04a7c2cce3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 04a7c2cce3 | |||
| 78f54b72fd | |||
| f4eee9af91 | |||
| cad14b3bc2 | 
@@ -1,5 +1,12 @@
 | 
				
			|||||||
# Changelog
 | 
					# Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## [1.3.44] - 2025-02-22
 | 
				
			||||||
 | 
					### Changed
 | 
				
			||||||
 | 
					- update webpages for version v1.3.44
 | 
				
			||||||
 | 
					- update header title to 'Hollo Lollo Trollo'
 | 
				
			||||||
 | 
					- update header title to 'Filament Management Tool' and improve update response messages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [1.3.43] - 2025-02-22
 | 
					## [1.3.43] - 2025-02-22
 | 
				
			||||||
### Changed
 | 
					### Changed
 | 
				
			||||||
- update webpages for version v1.3.43
 | 
					- update webpages for version v1.3.43
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@
 | 
				
			|||||||
; https://docs.platformio.org/page/projectconf.html
 | 
					; https://docs.platformio.org/page/projectconf.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[common]
 | 
					[common]
 | 
				
			||||||
version = "1.3.43"
 | 
					version = "1.3.44"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#test
 | 
					#test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -368,11 +368,11 @@ void setupWebserver(AsyncWebServer &server) {
 | 
				
			|||||||
        [](AsyncWebServerRequest *request) {
 | 
					        [](AsyncWebServerRequest *request) {
 | 
				
			||||||
            // Nach Update-Abschluss
 | 
					            // Nach Update-Abschluss
 | 
				
			||||||
            bool success = !Update.hasError();
 | 
					            bool success = !Update.hasError();
 | 
				
			||||||
 | 
					            String message = success ? "Update successful" : String("Update failed: ") + Update.errorString();
 | 
				
			||||||
            AsyncWebServerResponse *response = request->beginResponse(
 | 
					            AsyncWebServerResponse *response = request->beginResponse(
 | 
				
			||||||
                success ? 200 : 400,
 | 
					                success ? 200 : 400,
 | 
				
			||||||
                "application/json",
 | 
					                "application/json",
 | 
				
			||||||
                success ? "{\"success\":true,\"message\":\"Update successful\"}" 
 | 
					                "{\"success\":" + String(success ? "true" : "false") + ",\"message\":\"" + message + "\"}"
 | 
				
			||||||
                       : "{\"success\":false,\"message\":\"Update failed\"}"
 | 
					 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            response->addHeader("Connection", "close");
 | 
					            response->addHeader("Connection", "close");
 | 
				
			||||||
            request->send(response);
 | 
					            request->send(response);
 | 
				
			||||||
@@ -392,33 +392,46 @@ void setupWebserver(AsyncWebServer &server) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            oledShowMessage("Upgrade please wait");
 | 
					            oledShowMessage("Upgrade please wait");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // TODO: Backup
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (!index) {
 | 
					            if (!index) {
 | 
				
			||||||
                updateSize = request->contentLength();
 | 
					                updateSize = request->contentLength();
 | 
				
			||||||
                command = (filename.indexOf("spiffs") > -1) ? U_SPIFFS : U_FLASH;
 | 
					                command = (filename.indexOf("spiffs") > -1) ? U_SPIFFS : U_FLASH;
 | 
				
			||||||
 | 
					                Serial.printf("Update Start: %s\nSize: %u\nCommand: %d\n", filename.c_str(), updateSize, command);
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                // Überprüfe die SPIFFS-Größe
 | 
				
			||||||
 | 
					                if (command == U_SPIFFS && updateSize > 0x30000) {
 | 
				
			||||||
 | 
					                    String errorMsg = "SPIFFS update too large. Maximum size is 192KB";
 | 
				
			||||||
 | 
					                    Serial.println(errorMsg);
 | 
				
			||||||
 | 
					                    request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (command == U_SPIFFS) {
 | 
					                if (command == U_SPIFFS) {
 | 
				
			||||||
                    // Backup JSON config files before SPIFFS update
 | 
					                    Serial.println("Backup JSON configs...");
 | 
				
			||||||
                    backupJsonConfigs();
 | 
					                    backupJsonConfigs();
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
                // Setze spezifische Update-Flags für SPIFFS-Updates
 | 
					                    if (!Update.begin(updateSize, command, false)) {
 | 
				
			||||||
                if (!Update.begin(updateSize, command, command == U_SPIFFS ? true : false, command == U_SPIFFS ? 0 : -1)) {
 | 
					                        Serial.printf("Update Begin Error: %s\n", Update.errorString());
 | 
				
			||||||
                    if (command == U_SPIFFS) {
 | 
					                        Serial.println("Restoring JSON configs...");
 | 
				
			||||||
                        // Restore JSON config files if update fails at start
 | 
					 | 
				
			||||||
                        restoreJsonConfigs();
 | 
					                        restoreJsonConfigs();
 | 
				
			||||||
 | 
					                        String errorMsg = String("Update begin failed: ") + Update.errorString();
 | 
				
			||||||
 | 
					                        request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    if (!Update.begin(updateSize, command)) {
 | 
				
			||||||
 | 
					                        Serial.printf("Update Begin Error: %s\n", Update.errorString());
 | 
				
			||||||
                        String errorMsg = String("Update begin failed: ") + Update.errorString();
 | 
					                        String errorMsg = String("Update begin failed: ") + Update.errorString();
 | 
				
			||||||
                        request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
					                        request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
				
			||||||
                        return;
 | 
					                        return;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (len) {
 | 
					            if (len) {
 | 
				
			||||||
                if (Update.write(data, len) != len) {
 | 
					                if (Update.write(data, len) != len) {
 | 
				
			||||||
 | 
					                    Serial.printf("Update Write Error: %s\n", Update.errorString());
 | 
				
			||||||
                    if (command == U_SPIFFS) {
 | 
					                    if (command == U_SPIFFS) {
 | 
				
			||||||
                        // Restore JSON config files if update fails during write
 | 
					                        Serial.println("Restoring JSON configs...");
 | 
				
			||||||
                        restoreJsonConfigs();
 | 
					                        restoreJsonConfigs();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    String errorMsg = String("Write failed: ") + Update.errorString();
 | 
					                    String errorMsg = String("Write failed: ") + Update.errorString();
 | 
				
			||||||
@@ -426,21 +439,23 @@ void setupWebserver(AsyncWebServer &server) {
 | 
				
			|||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                // Sende den Fortschritt als JSON, um unerwünschte Zeilenumbrüche zu vermeiden
 | 
					                Serial.printf("Progress: %u/%u\n", index + len, updateSize);
 | 
				
			||||||
                String progress = "{\"progress\":" + String((index + len) * 100 / updateSize) + "}";
 | 
					                String progress = "{\"progress\":" + String((index + len) * 100 / updateSize) + "}";
 | 
				
			||||||
                request->send(200, "application/json", progress);
 | 
					                request->send(200, "application/json", progress);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (final) {
 | 
					            if (final) {
 | 
				
			||||||
                if (!Update.end(true)) {
 | 
					                if (!Update.end(true)) {
 | 
				
			||||||
 | 
					                    Serial.printf("Update End Error: %s\n", Update.errorString());
 | 
				
			||||||
                    if (command == U_SPIFFS) {
 | 
					                    if (command == U_SPIFFS) {
 | 
				
			||||||
                        // Restore JSON config files if update fails at end
 | 
					                        Serial.println("Restoring JSON configs...");
 | 
				
			||||||
                        restoreJsonConfigs();
 | 
					                        restoreJsonConfigs();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    String errorMsg = String("Update end failed: ") + Update.errorString();
 | 
					                    String errorMsg = String("Update end failed: ") + Update.errorString();
 | 
				
			||||||
                    request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
					                    request->send(400, "application/json", "{\"success\":false,\"message\":\"" + errorMsg + "\"}");
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                Serial.println("Update Success!");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user