Browse code

debug speed

Louis Jonget authored on25/04/2025 14:21:53
Showing2 changed files
1 1
Binary files a/build/bike_companion.pbw and b/build/bike_companion.pbw differ
... ...
@@ -457,6 +457,8 @@ function locationSuccess(new_pos) {
457 457
         if (!isNaN(dist)) {
458 458
             totaldist = totaldist + parseInt(dist);
459 459
             localStorage.setItem("dist", totaldist);
460
+        }else{
461
+            console.log("[NaN] dist: "+dist)
460 462
         }
461 463
         distanceString = splitFloatNumber(totaldist / 1000)[0].toString() + "." + splitFloatNumber(totaldist / 1000)[1].toString().substring(0, 3);
462 464
         //console.log("total dist is now " + totaldist);
... ...
@@ -467,7 +469,8 @@ function locationSuccess(new_pos) {
467 469
         console.log("speedsum=" + parseInt(localStorage.getItem("speedsum")) + " / totalcoordinates=" + parseInt(localStorage.getItem("totalcoordinates")));
468 470
         console.log("--avgspeed=" + avgspeed + " / avgSpeedString=" + avgSpeedString)
469 471
         if (avgSpeedString == "0.N") {
470
-            avgSpeedString = "0.0";
472
+            console.log("[NaN] avgspeed: "+avgspeed+" / speedsum: "+localStorage.getItem("speedsum")+" / totalcoordinates: "+localStorage.getItem("totalcoordinates"))
473
+            avgSpeedString = "-.-";
471 474
         }
472 475
         //console.log("avg speed is : " + avgSpeedString);
473 476
 
... ...
@@ -492,6 +495,7 @@ function locationSuccess(new_pos) {
492 495
         } else {
493 496
             speedString = splitFloatNumber(speed)[0].toString().substring(0, 3) + "." + splitFloatNumber(speed)[1].toString().substring(0, 1);
494 497
             if (speedString == "0.N") {
498
+                console.log("[NaN] speed: "+speed+" / speedString: "+speedString)
495 499
                 speedString = "0.0";
496 500
             }
497 501