Fix AdvancedWebServer.ino uptime conversion (#2183)

From https://github.com/espressif/arduino-esp32/pull/9224
This commit is contained in:
Earle F. Philhower, III 2024-05-30 12:07:28 -07:00 committed by GitHub
parent 1f9350dc2a
commit a3dba8be5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,8 +60,9 @@ void handleRoot() {
static int cnt = 0;
digitalWrite(led, 1);
int sec = millis() / 1000;
int min = sec / 60;
int hr = min / 60;
int hr = sec / 3600;
int min = (sec / 60) % 60;
sec = sec % 60;
StreamString temp;
temp.reserve(500); // Preallocate a large chunk to avoid memory fragmentation
@ -80,7 +81,7 @@ void handleRoot() {
<p>Page Count: %d</p>\
<img src=\"/test.svg\" />\
</body>\
</html>", hr, min % 60, sec % 60, rp2040.getFreeHeap(), ++cnt);
</html>", hr, min, sec, rp2040.getFreeHeap(), ++cnt);
server.send(200, "text/html", temp);
digitalWrite(led, 0);
}