From 814319e050f4d24441782f405be00cba5734ac80 Mon Sep 17 00:00:00 2001 From: Luke Prior <22492406+LukePrior@users.noreply.github.com> Date: Sat, 19 Jun 2021 16:49:51 +1000 Subject: [PATCH] Show SondeHub map in web interface (#90) * sondehub * sondehub map in interface * fixes * include notice * more fixes * fix * fix * fix * Delete RX_FSK.ino.cpp * default to station position * tracker fix * fix check to be more robust * revert Co-authored-by: Uskompuf <22492406+Uskompuf@users.noreply.github.com> --- RX_FSK/RX_FSK.ino | 33 ++++++++++++++++++++++++++++++++- RX_FSK/data/index.html | 5 +++++ RX_FSK/data/style.css | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index ef89be6..0aa9575 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -410,6 +410,29 @@ const char *createWIFIForm() { return message; } +const char *createSondeHubMap() { + SondeInfo *s = &sonde.sondeList[0]; + char *ptr = message; + strcpy(ptr, HTMLHEAD); strcat(ptr, ""); + HTMLBODY(ptr, "map.html"); + if (!sonde.config.sondehub.active) { + strcat(ptr, "
NOTE: SondeHub uploading is not enabled, detected sonde will not be visable on map
"); + if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) { + sprintf(ptr + strlen(ptr), "", sonde.config.sondehub.lat, sonde.config.sondehub.lon); + } else { + sprintf(ptr + strlen(ptr), "", s-> ser); + } + } else { + if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) { + sprintf(ptr, "", sonde.config.sondehub.lat, sonde.config.sondehub.lon); + } else { + sprintf(ptr, "", s-> ser); + } + } + HTMLBODYEND(ptr); + return message; +} + const char *handleWIFIPost(AsyncWebServerRequest *request) { char label[10]; // parameters: a_i, f_1, t_i (active/frequency/type) @@ -471,7 +494,7 @@ void addSondeStatus(char *ptr, int i) sprintf(ptr + strlen(ptr), "GEO-App - ", s->lat, s->lon); sprintf(ptr + strlen(ptr), "wetterson.de - ", s->id); sprintf(ptr + strlen(ptr), "radiosondy.info - ", s->id); - sprintf(ptr + strlen(ptr), "SondeHub Tracker - ", s->id); + sprintf(ptr + strlen(ptr), "SondeHub Tracker - ", s->ser); sprintf(ptr + strlen(ptr), "OSM - ", s->lat, s->lon); sprintf(ptr + strlen(ptr), "Google", s->lat, s->lon); @@ -1127,6 +1150,14 @@ void SetupAsyncServer() { request->send(200, "text/html", createWIFIForm()); }); + server.on("/map.html", HTTP_GET, [](AsyncWebServerRequest * request) { + request->send(200, "text/html", createSondeHubMap()); + }); + server.on("/map.html", HTTP_POST, [](AsyncWebServerRequest * request) { + handleWIFIPost(request); + request->send(200, "text/html", createSondeHubMap()); + }); + server.on("/config.html", HTTP_GET, [](AsyncWebServerRequest * request) { request->send(200, "text/html", createConfigForm()); }); diff --git a/RX_FSK/data/index.html b/RX_FSK/data/index.html index d3e1cb4..81e842d 100644 --- a/RX_FSK/data/index.html +++ b/RX_FSK/data/index.html @@ -15,6 +15,7 @@ + @@ -33,6 +34,10 @@ +
+ +
+
diff --git a/RX_FSK/data/style.css b/RX_FSK/data/style.css index e098874..6fb7ea2 100644 --- a/RX_FSK/data/style.css +++ b/RX_FSK/data/style.css @@ -44,7 +44,7 @@ td#sfreq { outline: none; cursor: pointer; padding: 10px 10px; - width: 16vw; + width: 14vw; transition: 0.3s; }