Merge pull request #1630 from BartS23/run2

[RUN] Fix.speed could be NaN
master
Gordon Williams 2022-03-28 09:57:36 +01:00 committed by GitHub
commit 91f5987dca
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"]); if (stats["dist"]) stats["dist"].emit("changed",stats["dist"]);
var duration = Date.now() - state.startTime; // in ms var duration = Date.now() - state.startTime; // in ms
state.avrSpeed = state.distance * 1000 / duration; // meters/sec 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["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]); if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
if (stats["speed"]) stats["speed"].emit("changed",stats["speed"]); if (stats["speed"]) stats["speed"].emit("changed",stats["speed"]);