diff --git a/src/main.cpp b/src/main.cpp index c214eff..3fe3542 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -471,6 +471,7 @@ void setup() { doc["ledBrightness"] = led_brightness; doc["ledRgbBrightness"] = rgb_brightness; doc["tempFormat"] = "C"; + doc["switchBank"] = 0; doc["key1"] = keycode[BUTTON_1]; doc["key2"] = keycode[BUTTON_2]; doc["key3"] = keycode[BUTTON_3]; @@ -498,6 +499,8 @@ void setup() { server.on("/api/status", HTTP_GET, [](AsyncWebServerRequest *request){ StaticJsonDocument<200> doc; + doc["version"] = VERSION; + int cpu_freq = esp_clk_cpu_freq() / 1000000; doc["cpuspeed"] = String(cpu_freq) + "MHz"; @@ -514,6 +517,12 @@ void setup() { serializeJson(doc, out); request->send(200, "application/json", out); }); + server.on("/api/fwinfo", HTTP_GET, [](AsyncWebServerRequest *request){ + StaticJsonDocument<200> doc; + doc["version"] = VERSION; + doc["build_date"] = BUILD_DATE; + doc["build_time"] = BUILD_TIME; + }); server.on("/api/setconfig", HTTP_POST, [](AsyncWebServerRequest *request){ StaticJsonDocument<100> doc; doc["status"] = "FAILED"; diff --git a/web/index.html b/web/index.html index ca9037f..741a829 100644 --- a/web/index.html +++ b/web/index.html @@ -36,7 +36,7 @@ if (!window.isSecureContext) {
NMEA0183 to NMEA2000:
";
- text += " " + (json.nmea0183 || "").replace(/,/g, ", ");
- text += "
NMEA2000 to NMEA0183:
";
- text += " " + (json.nmea2000 || "").replace(/,/g, ", ");
+ buttonHandlers.firmwareInfo=function() {
+ getJson("api/fwinfo").then(function (json) {
+ let text = "
Version: " + json.version + "
"; + text += "Build date: " + json.build_date + "
"; + text += "Build time: " + json.build_time + "
"; text += ""; showOverlay(text, true); });