diff --git a/apps/gpsmagcourse/README.md b/apps/gpsmagcourse/README.md index bca039424..f6e60ea61 100644 --- a/apps/gpsmagcourse/README.md +++ b/apps/gpsmagcourse/README.md @@ -25,7 +25,7 @@ On Bangle.js 2 a click on the widget does reset the built-in compass. ## Settings * **Speed threshold** - - (default = 6 km/h) When GPS speed is lower then this threshold use the compass direction. + - (default = 6 km/h) When GPS speed is lower then this threshold use the compass direction. The speed must be for at least 10 seconds this fast to switch back to GPS course. * **Compass source** - off: Disables this addon. - built-in (default): Uses the built-in compass. Its calibration can be restarted by pressing the Widget. When tilt compensation is disabled or "Navigation compass" is not installed the watch must be orientated horizontally for the compass heading to be used. diff --git a/apps/gpsmagcourse/boot.js b/apps/gpsmagcourse/boot.js index 189dd9e35..ffa9512fa 100644 --- a/apps/gpsmagcourse/boot.js +++ b/apps/gpsmagcourse/boot.js @@ -6,6 +6,7 @@ tiltCompensation: true, // tilt compensation on built-in compass }, require("Storage").readJSON("gpsmagcourse.json", true) || {}); const CALIBDATA = (settings.compassSrc === 2) ? require("Storage").readJSON("magnav.json",1) : undefined; + let cntAboveSpeed = 0; // Check if magnav is installed try { @@ -63,7 +64,8 @@ }; const changeGpsCourse = (gps) => { - if (gps.speed < settings.speed) { + cntAboveSpeed = gps.speed < settings.speed ? 0 : cntAboveSpeed+1; + if (cntAboveSpeed < 10) { // need to stay x events above or equal threshold if (settings.compassSrc === 1 && (settings.tiltCompensation || isFaceUp(Bangle.getAccel()))) { // Use uncompensated built-in compass heading only if face is up const heading = Bangle.getCompass().heading; if (!isNaN(heading)) { diff --git a/apps/gpsmagcourse/widget.js b/apps/gpsmagcourse/widget.js index 0e00a1a70..6317cedcd 100644 --- a/apps/gpsmagcourse/widget.js +++ b/apps/gpsmagcourse/widget.js @@ -49,7 +49,7 @@ if (gps.courseOrig && WIDGETS.gpsmagcourse.show !== 1 && Bangle.isGPSOn()) { WIDGETS.gpsmagcourse.show = 1; WIDGETS.gpsmagcourse.draw(); - } else if (WIDGETS.gpsmagcourse.show) { + } else if (!gps.courseOrig && WIDGETS.gpsmagcourse.show === 1) { WIDGETS.gpsmagcourse.show = settings.showWidget === 1 ? 0 : 2; WIDGETS.gpsmagcourse.draw(); }