Fix.speed could be NaN

then curSpeed during the entire run is NaN
pull/1630/head
BartS23 2022-03-28 00:04:01 +02:00 committed by GitHub
parent 4d1cf766ef
commit 02fca7a4c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -135,7 +135,7 @@ Bangle.on("GPS", function(fix) {
if (stats["dist"]) stats["dist"].emit("changed",stats["dist"]);
var duration = Date.now() - state.startTime; // in ms
state.avrSpeed = state.distance * 1000 / duration; // meters/sec
state.curSpeed = state.curSpeed*0.8 + fix.speed*0.2/3.6; // meters/sec
if (!isNaN(fix.speed)) state.curSpeed = state.curSpeed*0.8 + fix.speed*0.2/3.6; // meters/sec
if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
if (stats["speed"]) stats["speed"].emit("changed",stats["speed"]);