Skip to content

Commit

Permalink
Add Refresh button
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Nov 25, 2024
1 parent d475814 commit f5f0ec8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Software/src/devboard/webserver/can_logging_html.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ String can_logger_processor(const String& var) {
".can-message { background-color: #404E57; margin-bottom: 5px; padding: 10px; border-radius: 5px; font-family: "
"monospace; }";
content += "</style>";

content += "<button onclick='refreshPage()'>Refresh data</button> ";
content += "<button onclick='goToMainPage()'>Back to main page</button>";

// Start a new block for the CAN messages
content += "<div style='background-color: #303E47; padding: 20px; border-radius: 15px'>";

// Check for messages
if (datalayer.system.info.logged_can_messages[0] == 0) {
content += "No incoming/outgoing CAN messages yet";
content += "CAN logger started! Refresh page to display incoming(RX) and outgoing(TX) messages";
} else {
// Split the messages using the newline character
String messages = String(datalayer.system.info.logged_can_messages);
Expand All @@ -46,6 +46,7 @@ String can_logger_processor(const String& var) {
// Add JavaScript for navigation
content += "<script>";
content += "function goToMainPage() { window.location.href = '/'; }";
content += "function refreshPage(){ location.reload(true); }";
content += "</script>";
return content;
}
Expand Down

0 comments on commit f5f0ec8

Please sign in to comment.