forked from FOSS/BangleApps
recorder 0.21: Speed report now uses speed units from locale
parent
8eaa9d719d
commit
705a5d7a1b
|
@ -24,3 +24,4 @@
|
||||||
0.18: Improve widget load speed, allow currently recording track to be plotted in openstmap
|
0.18: Improve widget load speed, allow currently recording track to be plotted in openstmap
|
||||||
0.19: Fix track plotting code
|
0.19: Fix track plotting code
|
||||||
0.20: Automatic translation of some more strings.
|
0.20: Automatic translation of some more strings.
|
||||||
|
0.21: Speed report now uses speed units from locale
|
||||||
|
|
|
@ -348,7 +348,12 @@ function viewTrack(filename, info) {
|
||||||
infc[i]++;
|
infc[i]++;
|
||||||
}
|
}
|
||||||
} else if (style=="Speed") {
|
} else if (style=="Speed") {
|
||||||
title = /*LANG*/"Speed (m/s)";
|
// use locate to work out units
|
||||||
|
var localeStr = require("locale").speed(1,5); // get what 1kph equates to
|
||||||
|
let units = localeStr.replace(/[0-9.]*/,"");
|
||||||
|
var factor = parseFloat(localeStr)*3.6; // m/sec to whatever out units are
|
||||||
|
// title
|
||||||
|
title = /*LANG*/"Speed"+` (${units})`;
|
||||||
var latIdx = info.fields.indexOf("Latitude");
|
var latIdx = info.fields.indexOf("Latitude");
|
||||||
var lonIdx = info.fields.indexOf("Longitude");
|
var lonIdx = info.fields.indexOf("Longitude");
|
||||||
// skip until we find our first data
|
// skip until we find our first data
|
||||||
|
@ -381,7 +386,7 @@ function viewTrack(filename, info) {
|
||||||
} else throw new Error("Unknown type "+style);
|
} else throw new Error("Unknown type "+style);
|
||||||
var min=100000,max=-100000;
|
var min=100000,max=-100000;
|
||||||
for (var i=0;i<infn.length;i++) {
|
for (var i=0;i<infn.length;i++) {
|
||||||
if (infc[i]>0) infn[i]/=infc[i];
|
if (infc[i]>0) infn[i]=factor*infn[i]/infc[i];
|
||||||
var n = infn[i];
|
var n = infn[i];
|
||||||
if (n>max) max=n;
|
if (n>max) max=n;
|
||||||
if (n<min) min=n;
|
if (n<min) min=n;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "recorder",
|
"id": "recorder",
|
||||||
"name": "Recorder",
|
"name": "Recorder",
|
||||||
"shortName": "Recorder",
|
"shortName": "Recorder",
|
||||||
"version": "0.20",
|
"version": "0.21",
|
||||||
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,outdoors,gps,widget",
|
"tags": "tool,outdoors,gps,widget",
|
||||||
|
|
Loading…
Reference in New Issue