gpstrek - Reset compass samples on turning it off

pull/2952/head
Martin Boonk 2023-08-07 08:18:40 +02:00
parent 811174436d
commit a6ef1067bf
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ function onPulse(e){
function onGPS(fix) { function onGPS(fix) {
if(fix.fix) { if(fix.fix) {
state.currentPos = fix; state.currentPos = fix;
Bangle.setCompassPower(0, "gpstrek"); if (Bangle.isCompassOn()){
Bangle.setCompassPower(0, "gpstrek");
state.compassSamples = new Array(SAMPLES).fill(0)
}
} else { } else {
Bangle.setCompassPower(1, "gpstrek"); Bangle.setCompassPower(1, "gpstrek");
} }