From 8c5e7e26ac5c9a7811a97a7803367f823dbafc4a Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 22 Feb 2025 17:53:51 +0100 Subject: [PATCH] docs: update upgrade page message and improve progress display logic --- html/upgrade.html | 6 +++--- src/website.cpp | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/html/upgrade.html b/html/upgrade.html index e35e495..e976218 100644 --- a/html/upgrade.html +++ b/html/upgrade.html @@ -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); } diff --git a/src/website.cpp b/src/website.cpp index 14693a0..e38b32f 100644 --- a/src/website.cpp +++ b/src/website.cpp @@ -438,12 +438,17 @@ 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) { + if (currentProgress != lastProgress) { + // OLED nur alle 5% aktualisieren + if (currentProgress % 5 == 0) { + oledShowMessage(String(currentProgress) + "% complete"); + } + // Webseite bei jeder Ă„nderung aktualisieren lastProgress = currentProgress; - oledShowMessage(String(currentProgress) + "% complete"); + ws.textAll("{\"type\":\"updateProgress\",\"progress\":" + String(currentProgress) + "}"); } }