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
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

View File

@ -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);
}

View File

@ -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"}],

View File

@ -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);