recorder 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)
master
Gordon Williams 2025-06-19 10:47:01 +01:00
parent 14fca983fc
commit eb594038ba
4 changed files with 12 additions and 10 deletions

View File

@ -56,3 +56,5 @@
0.44: List tracks in reverse chronological order. 0.44: List tracks in reverse chronological order.
0.45: Move recorder from widget into library 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)

View File

@ -333,14 +333,14 @@ function plotGraph(info, style) { "ram"
var factor = 1; // multiplier used for values when graphing var factor = 1; // multiplier used for values when graphing
var timeIdx = info.fields.indexOf("Time"); var timeIdx = info.fields.indexOf("Time");
if (l!==undefined) { if (l!==undefined) {
c = l.split(","); c = l.trim().split(",");
strt = c[timeIdx]; strt = c[timeIdx];
} }
if (style=="Heartrate") { if (style=="Heartrate") {
title = /*LANG*/"Heartrate (bpm)"; title = /*LANG*/"Heartrate (bpm)";
var hrmIdx = info.fields.indexOf("Heartrate"); var hrmIdx = info.fields.indexOf("Heartrate");
while(l!==undefined) { while(l!==undefined) {
c=l.split(",");l = f.readLine(f); c=l.trim().split(",");l = f.readLine(f);
if (c[hrmIdx]=="") continue; if (c[hrmIdx]=="") continue;
i = Math.round(80*(c[timeIdx] - strt)/dur); i = Math.round(80*(c[timeIdx] - strt)/dur);
infn[i]+=+c[hrmIdx]; infn[i]+=+c[hrmIdx];
@ -351,7 +351,7 @@ function plotGraph(info, style) { "ram"
var altIdx = info.fields.indexOf("Barometer Altitude"); var altIdx = info.fields.indexOf("Barometer Altitude");
if (altIdx<0) altIdx = info.fields.indexOf("Altitude"); if (altIdx<0) altIdx = info.fields.indexOf("Altitude");
while(l!==undefined) { while(l!==undefined) {
c=l.split(",");l = f.readLine(f); c=l.trim().split(",");l = f.readLine(f);
if (c[altIdx]=="") continue; if (c[altIdx]=="") continue;
i = Math.round(80*(c[timeIdx] - strt)/dur); i = Math.round(80*(c[timeIdx] - strt)/dur);
infn[i]+=+c[altIdx]; infn[i]+=+c[altIdx];
@ -368,14 +368,14 @@ function plotGraph(info, style) { "ram"
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
while(l!==undefined && c[latIdx]=="") { while(l!==undefined && c[latIdx]=="") {
c = l.split(","); c = l.trim().split(",");
l = f.readLine(f); l = f.readLine(f);
} }
// now iterate // now iterate
var p,lp = Bangle.project({lat:c[1],lon:c[2]}); var p,lp = Bangle.project({lat:c[1],lon:c[2]});
var t,dx,dy,d,lt = c[timeIdx]; var t,dx,dy,d,lt = c[timeIdx];
while(l!==undefined) { while(l!==undefined) {
c=l.split(","); c=l.trim().split(",");
l = f.readLine(f); l = f.readLine(f);
if (c[latIdx] == "") { if (c[latIdx] == "") {
continue; continue;

View File

@ -120,9 +120,9 @@ exports.getRecorders = function() {
recorders['baro'] = function() { recorders['baro'] = function() {
var temp="",press="",alt=""; var temp="",press="",alt="";
function onPress(c) { function onPress(c) {
temp=c.temperature; temp=c.temperature.toFixed(1);
press=c.pressure; press=c.pressure.toFixed(2);
alt=c.altitude; alt=c.altitude.toFixed(2);
} }
return { return {
name : "Baro", name : "Baro",

View File

@ -2,7 +2,7 @@
"id": "recorder", "id": "recorder",
"name": "Recorder", "name": "Recorder",
"shortName": "Recorder", "shortName": "Recorder",
"version": "0.45", "version": "0.46",
"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,clkinfo", "tags": "tool,outdoors,gps,widget,clkinfo",