diff --git a/apps/gpstrek/ChangeLog b/apps/gpstrek/ChangeLog index f9f60d99d..b72d3fae2 100644 --- a/apps/gpstrek/ChangeLog +++ b/apps/gpstrek/ChangeLog @@ -4,3 +4,5 @@ Use custom UI with swipes instead of leftright 0.04: Fix compass heading 0.05: Added adjustment for Bangle.js magnetometer heading fix +0.06: Fix waypoint menu always selecting last waypoint + Fix widget adding listeners more than once diff --git a/apps/gpstrek/app.js b/apps/gpstrek/app.js index 2bfae7b37..919f114ea 100644 --- a/apps/gpstrek/app.js +++ b/apps/gpstrek/app.js @@ -477,10 +477,9 @@ function showRouteSelector (){ } }; - for (let c of STORAGE.list((/\.trf$/))){ - let file = c; - menu[file] = ()=>{handleLoading(file);}; - } + STORAGE.list(/\.trf$/).forEach((file)=>{ + menu[file] = ()=>{handleLoading(file);}; + }); E.showMenu(menu); } @@ -543,14 +542,14 @@ function showWaypointSelector(){ } }; - for (let c in waypoints){ + waypoints.forEach((wp,c)=>{ menu[waypoints[c].name] = function (){ state.waypoint = waypoints[c]; state.waypointIndex = c; state.route = null; removeMenu(); }; - } + }); E.showMenu(menu); } diff --git a/apps/gpstrek/metadata.json b/apps/gpstrek/metadata.json index 039f0777c..3895c025b 100644 --- a/apps/gpstrek/metadata.json +++ b/apps/gpstrek/metadata.json @@ -1,7 +1,7 @@ { "id": "gpstrek", "name": "GPS Trekking", - "version": "0.05", + "version": "0.06", "description": "Helper for tracking the status/progress during hiking. Do NOT depend on this for navigation!", "icon": "icon.png", "screenshots": [{"url":"screen1.png"},{"url":"screen2.png"},{"url":"screen3.png"},{"url":"screen4.png"}], diff --git a/apps/gpstrek/widget.js b/apps/gpstrek/widget.js index 9b0e2d8f8..8b6b04a78 100644 --- a/apps/gpstrek/widget.js +++ b/apps/gpstrek/widget.js @@ -74,6 +74,12 @@ function onAcc (e){ } function start(bg){ + Bangle.removeListener('GPS', onGPS); + Bangle.removeListener("HRM", onPulse); + Bangle.removeListener("mag", onMag); + Bangle.removeListener("step", onStep); + Bangle.removeListener("pressure", onPressure); + Bangle.removeListener('accel', onAcc); Bangle.on('GPS', onGPS); Bangle.on("HRM", onPulse); Bangle.on("mag", onMag);