From 02fca7a4c881cdb8ad3019fb4adbe9be4412c673 Mon Sep 17 00:00:00 2001 From: BartS23 <10829389+BartS23@users.noreply.github.com> Date: Mon, 28 Mar 2022 00:04:01 +0200 Subject: [PATCH] Fix.speed could be NaN then curSpeed during the entire run is NaN --- modules/exstats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/exstats.js b/modules/exstats.js index ec0a838a7..b22f3f5d3 100644 --- a/modules/exstats.js +++ b/modules/exstats.js @@ -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"]);