mirror of https://github.com/espruino/BangleApps
Merge pull request #3100 from bobrippling/fix/recorder-array
recorder: handle initial/non-settings loadpull/3099/head
commit
3f0dbc04c7
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue