Skip to content

Commit

Permalink
Use location from wifi scan (if better than 100m) or use configured l…
Browse files Browse the repository at this point in the history
…ocation.
  • Loading branch information
bertrik committed Dec 13, 2024
1 parent dc4d15e commit d68aad1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stofananas.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d68aad1

Please sign in to comment.