mirror of https://github.com/espruino/BangleApps
Merge pull request #2222 from halemmerich/gpstrek
gpstrek - Improve target markers in compasspull/2224/head
commit
a586122b3e
|
@ -6,3 +6,5 @@
|
|||
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
|
||||
0.07: Show checkered flag for target markers
|
||||
Single waypoints are now shown in the compass view
|
||||
|
|
|
@ -10,7 +10,7 @@ Tapping or button to switch to the next information display, swipe right for the
|
|||
|
||||
Choose either a route or a waypoint as basis for the display.
|
||||
|
||||
After this selection and availability of a GPS fix the compass will show a blue dot for your destination and a green one for possibly available waypoints on the way.
|
||||
After this selection and availability of a GPS fix the compass will show a checkered flag for your destination and a green dot for possibly available waypoints on the way.
|
||||
Waypoints are shown with name if available and distance to waypoint.
|
||||
|
||||
As long as no GPS signal is available the compass shows the heading from the build in magnetometer. When a GPS fix becomes available, the compass display shows the GPS course. This can be differentiated by the display of bubble levels on top and sides of the compass.
|
||||
|
|
|
@ -239,8 +239,14 @@ function getCompassSlice(compassDataSource){
|
|||
} else {
|
||||
bpos=Math.round(bpos*increment);
|
||||
}
|
||||
graphics.setColor(p.color);
|
||||
graphics.fillCircle(bpos,y+height-12,Math.floor(width*0.03));
|
||||
if (p.color){
|
||||
graphics.setColor(p.color);
|
||||
}
|
||||
if (p.icon){
|
||||
graphics.drawImage(p.icon, bpos,y+height-12, {rotate:0,scale:2});
|
||||
} else {
|
||||
graphics.fillCircle(bpos,y+height-12,Math.floor(width*0.03));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (compassDataSource.getMarkers){
|
||||
|
@ -595,8 +601,8 @@ function showBackgroundMenu(){
|
|||
"title" : "Background",
|
||||
back : showMenu,
|
||||
},
|
||||
"Start" : ()=>{ E.showPrompt("Start?").then((v)=>{ if (v) {WIDGETS.gpstrek.start(true); removeMenu();} else {E.showMenu(mainmenu);}});},
|
||||
"Stop" : ()=>{ E.showPrompt("Stop?").then((v)=>{ if (v) {WIDGETS.gpstrek.stop(true); removeMenu();} else {E.showMenu(mainmenu);}});},
|
||||
"Start" : ()=>{ E.showPrompt("Start?").then((v)=>{ if (v) {WIDGETS.gpstrek.start(true); removeMenu();} else {showMenu();}}).catch(()=>{E.showMenu(mainmenu);});},
|
||||
"Stop" : ()=>{ E.showPrompt("Stop?").then((v)=>{ if (v) {WIDGETS.gpstrek.stop(true); removeMenu();} else {showMenu();}}).catch(()=>{E.showMenu(mainmenu);});},
|
||||
};
|
||||
E.showMenu(menu);
|
||||
}
|
||||
|
@ -677,13 +683,15 @@ function setClosestWaypoint(route, startindex, progress){
|
|||
|
||||
let screen = 1;
|
||||
|
||||
const finishIcon = atob("CggB//meZmeZ+Z5n/w==");
|
||||
|
||||
const compassSliceData = {
|
||||
getCourseType: function(){
|
||||
return (state.currentPos && state.currentPos.course) ? "GPS" : "MAG";
|
||||
},
|
||||
getCourse: function (){
|
||||
if(compassSliceData.getCourseType() == "GPS") return state.currentPos.course;
|
||||
return state.compassHeading?360-state.compassHeading:undefined;
|
||||
return state.compassHeading?state.compassHeading:undefined;
|
||||
},
|
||||
getPoints: function (){
|
||||
let points = [];
|
||||
|
@ -691,7 +699,10 @@ const compassSliceData = {
|
|||
points.push({bearing:bearing(state.currentPos, state.route.currentWaypoint), color:"#0f0"});
|
||||
}
|
||||
if (state.currentPos && state.currentPos.lon && state.route){
|
||||
points.push({bearing:bearing(state.currentPos, getLast(state.route)), color:"#00f"});
|
||||
points.push({bearing:bearing(state.currentPos, getLast(state.route)), icon: finishIcon});
|
||||
}
|
||||
if (state.currentPos && state.currentPos.lon && state.waypoint){
|
||||
points.push({bearing:bearing(state.currentPos, state.waypoint), icon: finishIcon});
|
||||
}
|
||||
return points;
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "gpstrek",
|
||||
"name": "GPS Trekking",
|
||||
"version": "0.06",
|
||||
"version": "0.07",
|
||||
"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"}],
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.8 KiB |
|
@ -24,7 +24,7 @@ function onGPS(fix) {
|
|||
}
|
||||
|
||||
function onMag(e) {
|
||||
if (!state.compassHeading) state.compassHeading = 360-e.heading;
|
||||
if (!state.compassHeading) state.compassHeading = e.heading;
|
||||
|
||||
//if (a+180)mod 360 == b then
|
||||
//return (a+b)/2 mod 360 and ((a+b)/2 mod 360) + 180 (they are both the solution, so you may choose one depending if you prefer counterclockwise or clockwise direction)
|
||||
|
|
Loading…
Reference in New Issue