Browse code

Merge branch 'strava-upload' of ssh://192.168.170.33:5522/volume1/web/gitlist/repos/bike_companion into strava-upload

louis.jonget authored on26/11/2022 09:25:28
Showing2 changed files
... ...
@@ -21,7 +21,7 @@ static char s_status[4];
21 21
 //restricting long and lat to 13 char : 0-1 for the sign, 1-3 for integer, 1 for the point, 7-10 for decimal, 1 for \0
22 22
 static char s_longitude[13];
23 23
 static char s_latitude[13];
24
-static char s_distance[6];
24
+static char s_distance[7];
25 25
 
26 26
 static char s_accuracy[5];
27 27
 static char s_altitude[6];
... ...
@@ -237,7 +237,7 @@ static void inbox_received_callback(DictionaryIterator *iter, void *context) {
237 237
 
238 238
   if(distance_tuple) {
239 239
     memset(s_distance,'\0',sizeof(s_distance));
240
-    strncpy(s_distance, distance_tuple->value->cstring, 6);
240
+    strncpy(s_distance, distance_tuple->value->cstring, 7);
241 241
   }else{
242 242
     //APP_LOG(APP_LOG_LEVEL_DEBUG, "not distance message... ");
243 243
   }
... ...
@@ -441,7 +441,7 @@ function locationSuccess(new_pos) {
441 441
       totaldist = totaldist + parseInt(dist);
442 442
       localStorage.setItem("dist", totaldist);
443 443
     }
444
-    distanceString = splitFloatNumber(totaldist / 1000)[0].toString();
444
+    distanceString = splitFloatNumber(totaldist / 1000)[0].toString() + "." + splitFloatNumber(totaldist / 1000)[1].toString().substring(0, 3);
445 445
     //console.log("total dist is now " + totaldist);
446 446
 
447 447
     // avg speed (also when not moving) since beginning