Compare commits

..

No commits in common. "fe7b57fe0e51f43410bacd2305b568a9b78dd880" and "7b52066378409c28003955d9feee9bb90b0e373c" have entirely different histories.

4 changed files with 19 additions and 61 deletions

View File

@ -1,14 +1,5 @@
# Changelog # 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 ## [1.3.57] - 2025-02-22
### Changed ### Changed
- update webpages for version v1.3.57 - update webpages for version v1.3.57

View File

@ -206,10 +206,10 @@
progress.textContent = '100%'; progress.textContent = '100%';
// Automatischer Neustart nach erfolgreicher Aktualisierung // Automatischer Neustart nach erfolgreicher Aktualisierung
status.textContent = "Update successful! Restarting device... The page will reload in 30 seconds."; status.textContent = "Update successful! Restarting device...";
setTimeout(() => { setTimeout(() => {
window.location.href = '/'; window.location.reload();
}, 30000); }, 5000);
} else { } else {
document.querySelectorAll('form input[type=submit]').forEach(btn => btn.disabled = false); document.querySelectorAll('form input[type=submit]').forEach(btn => btn.disabled = false);
} }

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[common] [common]
version = "1.3.58" version = "1.3.57"
#test #test

View File

@ -23,10 +23,6 @@ AsyncWebSocket ws("/ws");
uint8_t lastSuccess = 0; uint8_t lastSuccess = 0;
uint8_t lastHasReadRfidTag = 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) { void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len) {
if (type == WS_EVT_CONNECT) { if (type == WS_EVT_CONNECT) {
Serial.println("Neuer Client verbunden!"); Serial.println("Neuer Client verbunden!");
@ -442,17 +438,12 @@ void setupWebserver(AsyncWebServer &server) {
return; return;
} }
// Update OLED Display alle 5% und Webseite bei jeder Änderung // Update OLED Display alle 25%
static int lastProgress = -1; static int lastProgress = -1;
int currentProgress = (index + len) * 100 / updateSize; int currentProgress = (index + len) * 100 / updateSize;
if (currentProgress != lastProgress) { if (currentProgress % 25 == 0 && currentProgress != lastProgress) {
// OLED nur alle 5% aktualisieren
if (currentProgress % 5 == 0) {
oledShowMessage(String(currentProgress) + "% complete");
}
// Webseite bei jeder Änderung aktualisieren
lastProgress = currentProgress; lastProgress = currentProgress;
ws.textAll("{\"type\":\"updateProgress\",\"progress\":" + String(currentProgress) + "}"); oledShowMessage(String(currentProgress) + "% complete");
} }
} }
@ -494,47 +485,23 @@ void setupWebserver(AsyncWebServer &server) {
void backupJsonConfigs() { void backupJsonConfigs() {
// Bambu Credentials backup const char* configs[] = {"/bambu_credentials.json", "/spoolman_url.json"};
if (SPIFFS.exists("/bambu_credentials.json")) { for (const char* config : configs) {
File file = SPIFFS.open("/bambu_credentials.json", "r"); if (SPIFFS.exists(config)) {
if (file) { String backupPath = String(config) + ".bak";
bambuCredentialsBackup = file.readString(); SPIFFS.remove(backupPath);
file.close(); SPIFFS.rename(config, backupPath);
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() { void restoreJsonConfigs() {
// Restore Bambu credentials const char* configs[] = {"/bambu_credentials.json", "/spoolman_url.json"};
if (bambuCredentialsBackup.length() > 0) { for (const char* config : configs) {
File file = SPIFFS.open("/bambu_credentials.json", "w"); String backupPath = String(config) + ".bak";
if (file) { if (SPIFFS.exists(backupPath)) {
file.print(bambuCredentialsBackup); SPIFFS.remove(config);
file.close(); SPIFFS.rename(backupPath, config);
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
} }
} }