gpstrek - Only average if no GPS fix is available

pull/2255/head
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;
return result;
}
}
function onMag(e) {
if (!isNaN(e.heading)){
if (Bangle.isLocked())
if (Bangle.isLocked() || (Bangle.getGPSFix() && Bangle.getGPSFix().lon))
state.avgComp = e.heading;
else {
state.compassSamples[state.sampleIndex++] = e.heading;