Merge pull request #2218 from halemmerich/gpstrek

Gpstrek - Fix waypoint menu always selecting the last waypoint
pull/2220/head
Gordon Williams 2022-11-03 14:22:46 +00:00 committed by GitHub
commit 5374b1af30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View File

@ -4,3 +4,5 @@
Use custom UI with swipes instead of leftright Use custom UI with swipes instead of leftright
0.04: Fix compass heading 0.04: Fix compass heading
0.05: Added adjustment for Bangle.js magnetometer heading fix 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

View File

@ -477,10 +477,9 @@ function showRouteSelector (){
} }
}; };
for (let c of STORAGE.list((/\.trf$/))){ STORAGE.list(/\.trf$/).forEach((file)=>{
let file = c; menu[file] = ()=>{handleLoading(file);};
menu[file] = ()=>{handleLoading(file);}; });
}
E.showMenu(menu); E.showMenu(menu);
} }
@ -543,14 +542,14 @@ function showWaypointSelector(){
} }
}; };
for (let c in waypoints){ waypoints.forEach((wp,c)=>{
menu[waypoints[c].name] = function (){ menu[waypoints[c].name] = function (){
state.waypoint = waypoints[c]; state.waypoint = waypoints[c];
state.waypointIndex = c; state.waypointIndex = c;
state.route = null; state.route = null;
removeMenu(); removeMenu();
}; };
} });
E.showMenu(menu); E.showMenu(menu);
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "gpstrek", "id": "gpstrek",
"name": "GPS Trekking", "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!", "description": "Helper for tracking the status/progress during hiking. Do NOT depend on this for navigation!",
"icon": "icon.png", "icon": "icon.png",
"screenshots": [{"url":"screen1.png"},{"url":"screen2.png"},{"url":"screen3.png"},{"url":"screen4.png"}], "screenshots": [{"url":"screen1.png"},{"url":"screen2.png"},{"url":"screen3.png"},{"url":"screen4.png"}],

View File

@ -74,6 +74,12 @@ function onAcc (e){
} }
function start(bg){ 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('GPS', onGPS);
Bangle.on("HRM", onPulse); Bangle.on("HRM", onPulse);
Bangle.on("mag", onMag); Bangle.on("mag", onMag);