recorder: 1 decimal place for 1 second period logs

master
thyttan 2023-11-15 00:47:52 +01:00
parent 9ea23e39a5
commit c82feadca4
3 changed files with 5 additions and 4 deletions

View File

@ -42,3 +42,4 @@
0.33: Ensure that a new file is always created if the stuff that's being recorded has changed (fix #3081) 0.33: Ensure that a new file is always created if the stuff that's being recorded has changed (fix #3081)
0.34: Avoid prompting when creating a new file (#3081) 0.34: Avoid prompting when creating a new file (#3081)
0.35: Handle loading without a settings file (default record setting) 0.35: Handle loading without a settings file (default record setting)
0.36: When recording with 1 second periods, log time with one decimal.

View File

@ -2,7 +2,7 @@
"id": "recorder", "id": "recorder",
"name": "Recorder", "name": "Recorder",
"shortName": "Recorder", "shortName": "Recorder",
"version": "0.35", "version": "0.36",
"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",

View File

@ -176,11 +176,11 @@
}; };
let getCSVHeaders = activeRecorders => ["Time"].concat(activeRecorders.map(r=>r.fields)); let getCSVHeaders = activeRecorders => ["Time"].concat(activeRecorders.map(r=>r.fields));
let writeLog = function() { let writeLog = function(period) {
entriesWritten++; entriesWritten++;
WIDGETS["recorder"].draw(); WIDGETS["recorder"].draw();
try { try {
var fields = [Math.round(getTime())]; var fields = [period===1?getTime().toFixed(1):Math.round(getTime())];
activeRecorders.forEach(recorder => fields.push.apply(fields,recorder.getValues())); activeRecorders.forEach(recorder => fields.push.apply(fields,recorder.getValues()));
if (storageFile) storageFile.write(fields.join(",")+"\n"); if (storageFile) storageFile.write(fields.join(",")+"\n");
} catch(e) { } catch(e) {
@ -222,7 +222,7 @@
} }
// start recording... // start recording...
WIDGETS["recorder"].draw(); WIDGETS["recorder"].draw();
writeInterval = setInterval(writeLog, settings.period*1000); writeInterval = setInterval(writeLog, settings.period*1000, settings.period);
} else { } else {
WIDGETS["recorder"].width = 0; WIDGETS["recorder"].width = 0;
storageFile = undefined; storageFile = undefined;