From 5204da74a02b6829c12b01fc50acb035791c19a4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Feb 2024 23:51:23 +0200 Subject: [PATCH] Fix bug that caused clock to run --- .../src/devboard/webserver/events_html.cpp | 127 +++++------------- 1 file changed, 31 insertions(+), 96 deletions(-) diff --git a/Software/src/devboard/webserver/events_html.cpp b/Software/src/devboard/webserver/events_html.cpp index 4f6add2e..185d20c4 100644 --- a/Software/src/devboard/webserver/events_html.cpp +++ b/Software/src/devboard/webserver/events_html.cpp @@ -2,98 +2,61 @@ #include const char EVENTS_HTML_START[] = R"=====( - -
-
-
-
Event Type
-
Severity
-
Last Event
-
Count
-
Data
-
Message
-
+
Event Type
Severity
Last Event
Count
Data
Message
)====="; const char EVENTS_HTML_END[] = R"=====(
- - +)====="; -function goToMainPage() { - window.location.href = '/'; +String events_processor(const String& var) { + if (var == "PLACEHOLDER") { + String content = ""; + content.reserve(5000); + // Page format + content.concat(FPSTR(EVENTS_HTML_START)); + for (int i = 0; i < EVENT_NOF_EVENTS; i++) { + Serial.println("Event: " + String(get_event_enum_string(static_cast(i))) + + " count: " + String(entries[i].occurences) + " seconds: " + String(entries[i].timestamp) + + " data: " + String(entries[i].data)); + if (entries[i].occurences > 0) { + content.concat("
"); + content.concat("
" + String(get_event_enum_string(static_cast(i))) + "
"); + content.concat("
" + String(get_led_color_display_text(entries[i].led_color)) + "
"); + content.concat("
" + String(entries[i].timestamp) + "
"); + content.concat("
" + String(entries[i].occurences) + "
"); + content.concat("
" + String(entries[i].data) + "
"); + content.concat("
" + String(get_event_message(static_cast(i))) + "
"); + content.concat(""); + content.concat("
"); // End of event row + } + } + content.concat(FPSTR(EVENTS_HTML_END)); + return content; + } + return String(); } - -)====="; -/* The above */ - -String events_processor(const String& var) { - if (var == "PLACEHOLDER") { - String content = ""; - content.reserve(5000); - // Page format - content.concat(FPSTR(EVENTS_HTML_START)); - for (int i = 0; i < EVENT_NOF_EVENTS; i++) { - Serial.println("Event: " + String(get_event_enum_string(static_cast(i))) + - " count: " + String(entries[i].occurences) + " seconds: " + String(entries[i].timestamp) + - " data: " + String(entries[i].data)); - if (entries[i].occurences > 0) { -content.concat("
"); -content.concat("
" + String(get_event_enum_string(static_cast(i))) + "
"); -content.concat("
" + String(get_led_color_display_text(entries[i].led_color)) + "
"); -content.concat("
" + String((millis() / 1000) - entries[i].timestamp) + "
"); -content.concat("
" + String(entries[i].occurences) + "
"); -content.concat("
" + String(entries[i].data) + "
"); -content.concat("
" + String(get_event_message(static_cast(i))) + "
"); -content.concat(""); -content.concat("
"); // End of event row - } - } - content.concat(FPSTR(EVENTS_HTML_END)); - return content; - } - return String(); -}