Skip to content

Commit f35ce92

Browse files
authored
Add check preventing same location being written to flash twice
1 parent b19aa8d commit f35ce92

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/ios/boot.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ E.on('notify',msg=>{
124124
"tv.twitch": "Twitch",
125125
// could also use NRF.ancsGetAppInfo(msg.appId) here
126126
};
127+
127128

128129
//if (appNames[msg.appId]) msg.a
129130
if (msg.title === "BangleDumpCalendar") {
@@ -227,6 +228,12 @@ E.on('notify',msg=>{
227228
lon: d.lon,
228229
location:d.city
229230
}, require("Storage").readJSON("mylocation.json", true) || {});
231+
232+
if(Math.abs(myLocationJson.lat - locationJson.lat) < 0.0001 && Math.abs(myLocationJson.lon -locationJson.lon) < 0.0001){
233+
//same location, do not write
234+
return;
235+
}
236+
230237
myLocationJson.lon=locationJson.lon;
231238
myLocationJson.lat=locationJson.lat;
232239
myLocationJson.location=locationJson.city;

0 commit comments

Comments
 (0)