Compare commits
	
		
			4 Commits
		
	
	
		
			7b52066378
			...
			fe7b57fe0e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fe7b57fe0e | |||
| c1ae6b7295 | |||
| 9eee89fac7 | |||
| 8c5e7e26ac | 
@@ -1,5 +1,14 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
## [1.3.58] - 2025-02-22
 | 
			
		||||
### Added
 | 
			
		||||
- implement backup and restore functionality for Bambu credentials and Spoolman URL
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
- update webpages for version v1.3.58
 | 
			
		||||
- update upgrade page message and improve progress display logic
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## [1.3.57] - 2025-02-22
 | 
			
		||||
### Changed
 | 
			
		||||
- update webpages for version v1.3.57
 | 
			
		||||
 
 | 
			
		||||
@@ -206,10 +206,10 @@
 | 
			
		||||
                            progress.textContent = '100%';
 | 
			
		||||
                            
 | 
			
		||||
                            // Automatischer Neustart nach erfolgreicher Aktualisierung
 | 
			
		||||
                            status.textContent = "Update successful! Restarting device...";
 | 
			
		||||
                            status.textContent = "Update successful! Restarting device... The page will reload in 30 seconds.";
 | 
			
		||||
                            setTimeout(() => {
 | 
			
		||||
                                window.location.reload();
 | 
			
		||||
                            }, 5000);
 | 
			
		||||
                                window.location.href = '/';
 | 
			
		||||
                            }, 30000);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            document.querySelectorAll('form input[type=submit]').forEach(btn => btn.disabled = false);
 | 
			
		||||
                        }
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
; https://docs.platformio.org/page/projectconf.html
 | 
			
		||||
 | 
			
		||||
[common]
 | 
			
		||||
version = "1.3.57"
 | 
			
		||||
version = "1.3.58"
 | 
			
		||||
 | 
			
		||||
#test
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,10 @@ AsyncWebSocket ws("/ws");
 | 
			
		||||
uint8_t lastSuccess = 0;
 | 
			
		||||
uint8_t lastHasReadRfidTag = 0;
 | 
			
		||||
 | 
			
		||||
// Globale Variablen für Config Backups hinzufügen
 | 
			
		||||
String bambuCredentialsBackup;
 | 
			
		||||
String spoolmanUrlBackup;
 | 
			
		||||
 | 
			
		||||
void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len) {
 | 
			
		||||
    if (type == WS_EVT_CONNECT) {
 | 
			
		||||
        Serial.println("Neuer Client verbunden!");
 | 
			
		||||
@@ -438,13 +442,18 @@ void setupWebserver(AsyncWebServer &server) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                // Update OLED Display alle 25%
 | 
			
		||||
                // Update OLED Display alle 5% und Webseite bei jeder Änderung
 | 
			
		||||
                static int lastProgress = -1;
 | 
			
		||||
                int currentProgress = (index + len) * 100 / updateSize;
 | 
			
		||||
                if (currentProgress % 25 == 0 && currentProgress != lastProgress) {
 | 
			
		||||
                    lastProgress = currentProgress;
 | 
			
		||||
                if (currentProgress != lastProgress) {
 | 
			
		||||
                    // OLED nur alle 5% aktualisieren
 | 
			
		||||
                    if (currentProgress % 5 == 0) {
 | 
			
		||||
                        oledShowMessage(String(currentProgress) + "% complete");
 | 
			
		||||
                    }
 | 
			
		||||
                    // Webseite bei jeder Änderung aktualisieren
 | 
			
		||||
                    lastProgress = currentProgress;
 | 
			
		||||
                    ws.textAll("{\"type\":\"updateProgress\",\"progress\":" + String(currentProgress) + "}");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (final) {
 | 
			
		||||
@@ -485,23 +494,47 @@ void setupWebserver(AsyncWebServer &server) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void backupJsonConfigs() {
 | 
			
		||||
    const char* configs[] = {"/bambu_credentials.json", "/spoolman_url.json"};
 | 
			
		||||
    for (const char* config : configs) {
 | 
			
		||||
        if (SPIFFS.exists(config)) {
 | 
			
		||||
            String backupPath = String(config) + ".bak";
 | 
			
		||||
            SPIFFS.remove(backupPath);
 | 
			
		||||
            SPIFFS.rename(config, backupPath);
 | 
			
		||||
    // Bambu Credentials backup
 | 
			
		||||
    if (SPIFFS.exists("/bambu_credentials.json")) {
 | 
			
		||||
        File file = SPIFFS.open("/bambu_credentials.json", "r");
 | 
			
		||||
        if (file) {
 | 
			
		||||
            bambuCredentialsBackup = file.readString();
 | 
			
		||||
            file.close();
 | 
			
		||||
            Serial.println("Bambu credentials backed up");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Spoolman URL backup
 | 
			
		||||
    if (SPIFFS.exists("/spoolman_url.json")) {
 | 
			
		||||
        File file = SPIFFS.open("/spoolman_url.json", "r");
 | 
			
		||||
        if (file) {
 | 
			
		||||
            spoolmanUrlBackup = file.readString();
 | 
			
		||||
            file.close();
 | 
			
		||||
            Serial.println("Spoolman URL backed up");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void restoreJsonConfigs() {
 | 
			
		||||
    const char* configs[] = {"/bambu_credentials.json", "/spoolman_url.json"};
 | 
			
		||||
    for (const char* config : configs) {
 | 
			
		||||
        String backupPath = String(config) + ".bak";
 | 
			
		||||
        if (SPIFFS.exists(backupPath)) {
 | 
			
		||||
            SPIFFS.remove(config);
 | 
			
		||||
            SPIFFS.rename(backupPath, config);
 | 
			
		||||
        }
 | 
			
		||||
    // Restore Bambu credentials
 | 
			
		||||
    if (bambuCredentialsBackup.length() > 0) {
 | 
			
		||||
        File file = SPIFFS.open("/bambu_credentials.json", "w");
 | 
			
		||||
        if (file) {
 | 
			
		||||
            file.print(bambuCredentialsBackup);
 | 
			
		||||
            file.close();
 | 
			
		||||
            Serial.println("Bambu credentials restored");
 | 
			
		||||
        }
 | 
			
		||||
        bambuCredentialsBackup = ""; // Clear backup
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Restore Spoolman URL
 | 
			
		||||
    if (spoolmanUrlBackup.length() > 0) {
 | 
			
		||||
        File file = SPIFFS.open("/spoolman_url.json", "w");
 | 
			
		||||
        if (file) {
 | 
			
		||||
            file.print(spoolmanUrlBackup);
 | 
			
		||||
            file.close();
 | 
			
		||||
            Serial.println("Spoolman URL restored");
 | 
			
		||||
        }
 | 
			
		||||
        spoolmanUrlBackup = ""; // Clear backup
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user