diff --git a/apps/gpstrek/ChangeLog b/apps/gpstrek/ChangeLog index b72d3fae2..d46ada767 100644 --- a/apps/gpstrek/ChangeLog +++ b/apps/gpstrek/ChangeLog @@ -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 diff --git a/apps/gpstrek/README.md b/apps/gpstrek/README.md index 6edad2b1d..c55f5a8bf 100644 --- a/apps/gpstrek/README.md +++ b/apps/gpstrek/README.md @@ -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. diff --git a/apps/gpstrek/app.js b/apps/gpstrek/app.js index 919f114ea..f26811ed3 100644 --- a/apps/gpstrek/app.js +++ b/apps/gpstrek/app.js @@ -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; }, diff --git a/apps/gpstrek/metadata.json b/apps/gpstrek/metadata.json index 3895c025b..cf5d06baa 100644 --- a/apps/gpstrek/metadata.json +++ b/apps/gpstrek/metadata.json @@ -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"}], diff --git a/apps/gpstrek/screen2.png b/apps/gpstrek/screen2.png index 12cd65975..9a6e14e06 100644 Binary files a/apps/gpstrek/screen2.png and b/apps/gpstrek/screen2.png differ diff --git a/apps/gpstrek/widget.js b/apps/gpstrek/widget.js index 8b6b04a78..347df2df5 100644 --- a/apps/gpstrek/widget.js +++ b/apps/gpstrek/widget.js @@ -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)