1
0
Fork 0

gpstrek - Only average if no GPS fix is available

master
Martin Boonk 2022-11-06 00:38:12 +01:00
parent bc9e7b4c86
commit 4df226fb37
1 changed files with 3 additions and 2 deletions

View File

@ -71,10 +71,11 @@ function average(samples){
result%=360; result%=360;
return result; return result;
} }
function onMag(e) { function onMag(e) {
if (!isNaN(e.heading)){ if (!isNaN(e.heading)){
if (Bangle.isLocked()) if (Bangle.isLocked() || (Bangle.getGPSFix() && Bangle.getGPSFix().lon))
state.avgComp = e.heading; state.avgComp = e.heading;
else { else {
state.compassSamples[state.sampleIndex++] = e.heading; state.compassSamples[state.sampleIndex++] = e.heading;