From d68aad1dda3544021bc75478c7b40e9cb41a89c2 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Fri, 13 Dec 2024 13:11:12 +0100 Subject: [PATCH] Use location from wifi scan (if better than 100m) or use configured location. --- stofananas.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stofananas.ino b/stofananas.ino index 68e6e98..887e977 100644 --- a/stofananas.ino +++ b/stofananas.ino @@ -312,6 +312,8 @@ void setup(void) config_save(); } savedata.hasRgbLed = (strcmp("rgb", config_get_value("led_type").c_str()) == 0); + savedata.latitude = atof(config_get_value("loc_latitude").c_str()); + savedata.longitude = atof(config_get_value("loc_longitude").c_str()); // set up web server server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html"); @@ -341,7 +343,7 @@ void setup(void) MDNS.addService("http", "tcp", 80); // attempt geolocation - if (!geolocate(latitude, longitude, accuracy)) { + if (!geolocate(latitude, longitude, accuracy) || accuracy > 100) { latitude = savedata.latitude; longitude = savedata.longitude; }