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(); -}