Merge pull request #3100 from bobrippling/fix/recorder-array

recorder: handle initial/non-settings load
pull/3099/head
thyttan 2023-11-16 10:34:52 +01:00 committed by GitHub
commit 3f0dbc04c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -41,3 +41,4 @@
0.32: Add cadence data to output files
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.35: Handle loading without a settings file (default record setting)

View File

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

View File

@ -9,6 +9,8 @@
settings.period = settings.period||10;
if (!settings.file || !settings.file.startsWith("recorder.log"))
settings.recording = false;
if (!settings.record)
settings.record = ["gps"];
return settings;
}
@ -159,7 +161,7 @@
return recorders;
}
let getActiveRecorders = function() {
let getActiveRecorders = function(settings) {
let activeRecorders = [];
let recorders = getRecorders();
settings.record.forEach(r => {
@ -204,7 +206,7 @@
if (settings.recording) {
// set up recorders
activeRecorders = getActiveRecorders();
activeRecorders = getActiveRecorders(settings);
activeRecorders.forEach(activeRecorder => {
activeRecorder.start();
});
@ -253,7 +255,7 @@
}
var headers = require("Storage").open(settings.file,"r").readLine();
if (headers){ // if file exists
if(headers.trim()!==getCSVHeaders(getActiveRecorders()).join(",")){
if(headers.trim()!==getCSVHeaders(getActiveRecorders(settings)).join(",")){
// headers don't match, reset (#3081)
options.force = "new";
}