From 55028512532c325f9b8e2596fac2752b9d1968f9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Feb 2024 22:27:18 +0200 Subject: [PATCH 1/3] Fix formatting for events table --- .../src/devboard/webserver/events_html.cpp | 77 +++++++++++++++---- .../src/devboard/webserver/index_html.cpp | 26 ++++++- 2 files changed, 87 insertions(+), 16 deletions(-) diff --git a/Software/src/devboard/webserver/events_html.cpp b/Software/src/devboard/webserver/events_html.cpp index 597245e0..4f6add2e 100644 --- a/Software/src/devboard/webserver/events_html.cpp +++ b/Software/src/devboard/webserver/events_html.cpp @@ -8,19 +8,69 @@ const char EVENTS_HTML_START[] = R"=====( .event { display: flex; flex-wrap: wrap; border: 1px solid white; padding: 10px; } .event > div { flex: 1; min-width: 100px; max-width: 90%; word-break: break-word; } -
+
-
-
Event Type
Severity
Last Event
Count
Data
Message
+
+
Event Type
+
Severity
+
Last Event
+
Count
+
Data
+
Message
)====="; const char EVENTS_HTML_END[] = R"=====(
- + + )====="; /* The above + + )rawliteral"; /* The above code is minified to increase performance. Here is the full HTML function: @@ -11,7 +33,7 @@ const char index_html[] = R"rawliteral( html {font-family: Arial; display: inline-block; text-align: center;} h2 {font-size: 3.0rem;} p {font-size: 3.0rem;} - body {max-width: 600px; margin:0px auto; padding-bottom: 25px;} + body {max-width: 800px; margin:0px auto; padding-bottom: 25px;} .switch {position: relative; display: inline-block; width: 120px; height: 68px} .switch input {display: none} .slider {position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 6px} From 5204da74a02b6829c12b01fc50acb035791c19a4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Feb 2024 23:51:23 +0200 Subject: [PATCH 2/3] Fix bug that caused clock to run --- .../src/devboard/webserver/events_html.cpp | 129 +++++------------- 1 file changed, 32 insertions(+), 97 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"=====(
- - + + )====="; -/* 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(); -} From e2b9222366dd579179e1181632e7e7d345b0a374 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Feb 2024 23:54:02 +0200 Subject: [PATCH 3/3] Restore minification on index_html --- .../src/devboard/webserver/index_html.cpp | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/Software/src/devboard/webserver/index_html.cpp b/Software/src/devboard/webserver/index_html.cpp index 6d77bad6..8ab7cf00 100644 --- a/Software/src/devboard/webserver/index_html.cpp +++ b/Software/src/devboard/webserver/index_html.cpp @@ -1,27 +1,5 @@ const char index_html[] = R"rawliteral( - - - Battery Emulator - - - - -

Battery Emulator

- %PLACEHOLDER% - - - +Battery Emulator

Battery Emulator

%PLACEHOLDER% )rawliteral"; /* The above code is minified to increase performance. Here is the full HTML function: