Merge remote-tracking branch 'refs/remotes/upstream/master'
commit
26f8ed47e3
|
|
@ -55,4 +55,9 @@
|
|||
0.43: Fix interaction on clocks without widgets
|
||||
0.44: List tracks in reverse chronological order.
|
||||
0.45: Move recorder from widget into library
|
||||
Improve recorder ClockInfo icons
|
||||
Improve recorder ClockInfo icons
|
||||
0.46: Ensure altitude graph draws properly (or any graph using the last column of CSV data)
|
||||
Lower accuracy of barometer data to ~1cm (saves about 15b/record)
|
||||
0.47: Fix 'blip' on speed map on some recordings
|
||||
Ensure Battery voltage is only stored to 0.01v
|
||||
Add graphs for Steps+Battery
|
||||
|
|
@ -197,6 +197,14 @@ function viewTrack(filename, info) {
|
|||
menu[/*LANG*/'Plot HRM'] = function() {
|
||||
plotGraph(info, "Heartrate");
|
||||
};
|
||||
if (info.fields.includes("Steps"))
|
||||
menu[/*LANG*/'Plot Steps'] = function() {
|
||||
plotGraph(info, "Steps");
|
||||
};
|
||||
if (info.fields.includes("Battery Percentage"))
|
||||
menu[/*LANG*/'Plot Battery'] = function() {
|
||||
plotGraph(info, "Battery");
|
||||
};
|
||||
// TODO: steps, heart rate?
|
||||
menu[/*LANG*/'Erase'] = function() {
|
||||
E.showPrompt(/*LANG*/"Delete Track?").then(function(v) {
|
||||
|
|
@ -325,6 +333,7 @@ function plotGraph(info, style) { "ram"
|
|||
var lt = 0; // last time
|
||||
//var tn = 0; // count for each time period
|
||||
var strt, dur = info.duration;
|
||||
if (dur<1) dur=1;
|
||||
var f = require("Storage").open(filename,"r");
|
||||
if (f===undefined) return;
|
||||
var l = f.readLine(f);
|
||||
|
|
@ -333,14 +342,14 @@ function plotGraph(info, style) { "ram"
|
|||
var factor = 1; // multiplier used for values when graphing
|
||||
var timeIdx = info.fields.indexOf("Time");
|
||||
if (l!==undefined) {
|
||||
c = l.split(",");
|
||||
c = l.trim().split(",");
|
||||
strt = c[timeIdx];
|
||||
}
|
||||
if (style=="Heartrate") {
|
||||
title = /*LANG*/"Heartrate (bpm)";
|
||||
var hrmIdx = info.fields.indexOf("Heartrate");
|
||||
while(l!==undefined) {
|
||||
c=l.split(",");l = f.readLine(f);
|
||||
c=l.trim().split(",");l = f.readLine(f);
|
||||
if (c[hrmIdx]=="") continue;
|
||||
i = Math.round(80*(c[timeIdx] - strt)/dur);
|
||||
infn[i]+=+c[hrmIdx];
|
||||
|
|
@ -351,45 +360,63 @@ function plotGraph(info, style) { "ram"
|
|||
var altIdx = info.fields.indexOf("Barometer Altitude");
|
||||
if (altIdx<0) altIdx = info.fields.indexOf("Altitude");
|
||||
while(l!==undefined) {
|
||||
c=l.split(",");l = f.readLine(f);
|
||||
c=l.trim().split(",");l = f.readLine(f);
|
||||
if (c[altIdx]=="") continue;
|
||||
i = Math.round(80*(c[timeIdx] - strt)/dur);
|
||||
infn[i]+=+c[altIdx];
|
||||
infc[i]++;
|
||||
}
|
||||
} else if (style=="Steps") {
|
||||
title = /*LANG*/"Steps/min";
|
||||
var stpIdx = info.fields.indexOf("Steps");
|
||||
var t,lt = c[timeIdx];
|
||||
while(l!==undefined) {
|
||||
c=l.trim().split(",");l = f.readLine(f);
|
||||
if (c[stpIdx]=="") continue;
|
||||
t = c[timeIdx];
|
||||
i = Math.round(80*(t - strt)/dur);
|
||||
infn[i]+=60*c[stpIdx];
|
||||
infc[i]+=t-lt;
|
||||
lt = t;
|
||||
}
|
||||
} else if (style=="Battery") {
|
||||
title = /*LANG*/"Battery %";
|
||||
var batIdx = info.fields.indexOf("Battery Percentage");
|
||||
while(l!==undefined) {
|
||||
c=l.trim().split(",");l = f.readLine(f);
|
||||
if (c[batIdx]=="") continue;
|
||||
i = Math.round(80*(c[timeIdx] - strt)/dur);
|
||||
infn[i]+=+c[batIdx];
|
||||
infc[i]++;
|
||||
}
|
||||
} else if (style=="Speed") {
|
||||
// use locate to work out units
|
||||
var localeStr = require("locale").speed(1,5); // get what 1kph equates to
|
||||
let units = localeStr.replace(/[0-9.]*/,"");
|
||||
factor = parseFloat(localeStr)*3.6; // m/sec to whatever out units are
|
||||
// title
|
||||
title = /*LANG*/"Speed"+` (${units})`;
|
||||
var latIdx = info.fields.indexOf("Latitude");
|
||||
var lonIdx = info.fields.indexOf("Longitude");
|
||||
// skip until we find our first data
|
||||
while(l!==undefined && c[latIdx]=="") {
|
||||
c = l.split(",");
|
||||
c = l.trim().split(",");
|
||||
l = f.readLine(f);
|
||||
}
|
||||
// now iterate
|
||||
var p,lp = Bangle.project({lat:c[1],lon:c[2]});
|
||||
var p,lp = Bangle.project({lat:c[latIdx],lon:c[lonIdx]});
|
||||
var t,dx,dy,d,lt = c[timeIdx];
|
||||
while(l!==undefined) {
|
||||
c=l.split(",");
|
||||
c=l.trim().split(",");
|
||||
l = f.readLine(f);
|
||||
if (c[latIdx] == "") {
|
||||
continue;
|
||||
}
|
||||
if (c[latIdx] == "") continue;
|
||||
t = c[timeIdx];
|
||||
i = Math.round(80*(t - strt)/dur);
|
||||
p = Bangle.project({lat:c[latIdx],lon:c[lonIdx]});
|
||||
dx = p.x-lp.x;
|
||||
dy = p.y-lp.y;
|
||||
d = Math.sqrt(dx*dx+dy*dy);
|
||||
if (t!=lt) {
|
||||
infn[i]+=d / (t-lt); // speed
|
||||
infc[i]++;
|
||||
}
|
||||
infn[i]+=d; // speed
|
||||
infc[i]+=t-lt;
|
||||
lp = p;
|
||||
lt = t;
|
||||
}
|
||||
|
|
@ -405,6 +432,7 @@ function plotGraph(info, style) { "ram"
|
|||
if (n>max) max=n;
|
||||
if (n<min) min=n;
|
||||
}
|
||||
if (style=="Battery") {min=0;max=100;}
|
||||
// work out a nice grid value
|
||||
var heightDiff = max-min;
|
||||
var grid = 1;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ exports.getRecorders = function() {
|
|||
name : "BAT",
|
||||
fields : ["Battery Percentage", "Battery Voltage", "Charging"],
|
||||
getValues : () => {
|
||||
return [E.getBattery(), NRF.getBattery(), Bangle.isCharging()];
|
||||
return [E.getBattery(), NRF.getBattery().toFixed(2), Bangle.isCharging()];
|
||||
},
|
||||
start : () => {
|
||||
},
|
||||
|
|
@ -120,9 +120,9 @@ exports.getRecorders = function() {
|
|||
recorders['baro'] = function() {
|
||||
var temp="",press="",alt="";
|
||||
function onPress(c) {
|
||||
temp=c.temperature;
|
||||
press=c.pressure;
|
||||
alt=c.altitude;
|
||||
temp=c.temperature.toFixed(1);
|
||||
press=c.pressure.toFixed(2);
|
||||
alt=c.altitude.toFixed(2);
|
||||
}
|
||||
return {
|
||||
name : "Baro",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "recorder",
|
||||
"name": "Recorder",
|
||||
"shortName": "Recorder",
|
||||
"version": "0.45",
|
||||
"version": "0.47",
|
||||
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,outdoors,gps,widget,clkinfo",
|
||||
|
|
|
|||
2
core
2
core
|
|
@ -1 +1 @@
|
|||
Subproject commit 7502f4c006f52c9b2fe8078bb1dc0bf6b0c400a5
|
||||
Subproject commit 0916756932699d626555171ce8e0a2989b151c89
|
||||
Loading…
Reference in New Issue