more eventlog wrapping in ifdefs

This commit is contained in:
Brett Christensen 2024-02-09 15:21:39 +11:00
parent 9b47043aba
commit 3a47b3eb42

View file

@ -75,9 +75,11 @@ void init_webserver() {
request->send_P(200, "text/html", index_html, cellmonitor_processor); request->send_P(200, "text/html", index_html, cellmonitor_processor);
}); });
#ifdef EVENTLOGGING
server.on("/events", HTTP_GET, [](AsyncWebServerRequest* request) { server.on("/events", HTTP_GET, [](AsyncWebServerRequest* request) {
request->send_P(200, "text/html", index_html, events_processor); request->send_P(200, "text/html", index_html, events_processor);
}); });
#endif
// Route for editing Wh // Route for editing Wh
server.on("/updateBatterySize", HTTP_GET, [](AsyncWebServerRequest* request) { server.on("/updateBatterySize", HTTP_GET, [](AsyncWebServerRequest* request) {
@ -631,7 +633,9 @@ String processor(const String& var) {
content += "function goToUpdatePage() { window.location.href = '/update'; }"; content += "function goToUpdatePage() { window.location.href = '/update'; }";
content += "function goToCellmonitorPage() { window.location.href = '/cellmonitor'; }"; content += "function goToCellmonitorPage() { window.location.href = '/cellmonitor'; }";
content += "function goToSettingsPage() { window.location.href = '/settings'; }"; content += "function goToSettingsPage() { window.location.href = '/settings'; }";
#ifdef EVENTLOGGING
content += "function goToEventsPage() { window.location.href = '/events'; }"; content += "function goToEventsPage() { window.location.href = '/events'; }";
#endif
content += content +=
"function promptToReboot() { if (window.confirm('Are you sure you want to reboot the emulator? NOTE: If " "function promptToReboot() { if (window.confirm('Are you sure you want to reboot the emulator? NOTE: If "
"emulator is handling contactors, they will open during reboot!')) { " "emulator is handling contactors, they will open during reboot!')) { "
@ -943,6 +947,7 @@ String cellmonitor_processor(const String& var) {
return String(); return String();
} }
#ifdef EVENTLOGGING
const char EVENTS_HTML_START[] PROGMEM = R"=====( const char EVENTS_HTML_START[] PROGMEM = R"=====(
<style> <style>
body { background-color: black; color: white; } body { background-color: black; color: white; }
@ -991,7 +996,7 @@ String events_processor(const String& var) {
} }
return String(); return String();
} }
#endif
void onOTAStart() { void onOTAStart() {
// Log when OTA has started // Log when OTA has started
Serial.println("OTA update started!"); Serial.println("OTA update started!");