Merge pull request #1228 from halemmerich/recorderimprovements

Recorder improvements
pull/1242/head
Gordon Williams 2022-01-07 10:13:32 +00:00 committed by GitHub
commit a25d1b6d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 18 deletions

View File

@ -768,7 +768,7 @@
"id": "recorder",
"name": "Recorder (BETA)",
"shortName": "Recorder",
"version": "0.05",
"version": "0.06",
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
"icon": "app.png",
"tags": "tool,outdoors,gps,widget",

View File

@ -4,3 +4,7 @@
0.03: Fix theme and maps/graphing if no GPS
0.04: Multiple bugfixes
0.05: Add recording for coresensor
0.06: Add recording for battery stats
Fix execution of other recorders (*.recorder.js)
Modified icons and colors for better visibility
Only show plotting speed if Latitude is available

View File

@ -16,7 +16,8 @@ You can record
* **Time** The current time
* **GPS** GPS Latitude, Longitude and Altitude
* **Steps** Steps counted by the step counter
* **HR** Heart rate
* **HR** Heart rate and confidence
* **BAT** Battery percentage and voltage
* **Core** CoreTemp body temperature
**Note:** It is possible for other apps to record information using this app
@ -25,4 +26,4 @@ function in `widget.js` for more information.
## Tips
When recording GPS, it usually takes several minutes for the watch to get a [GPS fix](https://en.wikipedia.org/wiki/Time_to_first_fix). There is a grey satellite symbol, which you will see turn red when you get an actual GPS Fix. You can [upload assistant files](https://banglejs.com/apps/#assisted%20gps%20update) to speed up the time spent on getting a GPS fix.
When recording GPS, it usually takes several minutes for the watch to get a [GPS fix](https://en.wikipedia.org/wiki/Time_to_first_fix). There is a red satellite symbol, which you will see turn green when you get an actual GPS Fix. You can [upload assistant files](https://banglejs.com/apps/#assisted%20gps%20update) to speed up the time spent on getting a GPS fix.

View File

@ -199,9 +199,10 @@ function viewTrack(filename, info) {
menu['Plot Alt.'] = function() {
plotGraph(info, "Altitude");
};
menu['Plot Speed'] = function() {
plotGraph(info, "Speed");
};
if (info.fields.includes("Latitude"))
menu['Plot Speed'] = function() {
plotGraph(info, "Speed");
};
// TODO: steps, heart rate?
menu['Erase'] = function() {
E.showPrompt("Delete Track?").then(function(v) {

View File

@ -48,41 +48,50 @@
Bangle.removeListener('GPS', onGPS);
Bangle.setGPSPower(0,"recorder");
},
draw : (x,y) => g.setColor(hasFix?"#0ff":"#888").drawImage(atob("DAyBAAACADgDuBOAeA4AzAHADgAAAA=="),x,y)
draw : (x,y) => g.setColor(hasFix?"#0f0":"#f88").drawImage(atob("DAwBEAKARAKQE4DwHkPqPRGKAEAA"),x,y)
};
},
hrm:function() {
var bpm = 0, bpmConfidence = 0;
var hasBPM = false;
function onHRM(h) {
if (h.confidence >= bpmConfidence) {
bpmConfidence = h.confidence;
bpm = h.bpm;
if (bpmConfidence) hasBPM = true;
}
}
return {
name : "HR",
fields : ["Heartrate"],
fields : ["Heartrate", "Confidence"],
getValues : () => {
var r = [bpmConfidence?bpm:""];
var r = [bpm,bpmConfidence];
bpm = 0; bpmConfidence = 0;
return r;
},
start : () => {
hasBPM = false;
Bangle.on('HRM', onHRM);
Bangle.setHRMPower(1,"recorder");
},
stop : () => {
hasBPM = false;
Bangle.removeListener('HRM', onHRM);
Bangle.setHRMPower(0,"recorder");
},
draw : (x,y) => g.setColor(hasBPM?"#f00":"#888").drawImage(atob("DAyBAAAAAD/H/n/n/j/D/B+AYAAAAA=="),x,y)
draw : (x,y) => g.setColor(Bangle.isHRMOn()?"#f00":"#f88").drawImage(atob("DAwBAAAAMMeef+f+f+P8H4DwBgAA"),x,y)
};
},
bat:function() {
return {
name : "BAT",
fields : ["Battery Percentage", "Battery Voltage", "Charging"],
getValues : () => {
return [E.getBattery(), NRF.getBattery(), Bangle.isCharging()];
},
start : () => {
},
stop : () => {
},
draw : (x,y) => g.setColor(Bangle.isCharging() ? "#0f0" : "#ff0").drawImage(atob("DAwBAABgH4G4EYG4H4H4H4GIH4AA"),x,y)
};
},
temp:function() {
var core = 0, skin = 0;
var hasCore = false;
@ -106,7 +115,7 @@
hasCore = false;
Bangle.removeListener('CoreTemp', onCore);
},
draw : (x,y) => g.setColor(hasCore?"#0f0":"#888").drawImage(atob("DAyBAAHh0js3EuDMA8A8AWBnDj9A8A=="),x,y)
draw : (x,y) => g.setColor(hasCore?"#0f0":"#8f8").drawImage(atob("DAwBAAAOAKPOfgZgZgZgZgfgPAAA"),x,y)
};
},
steps:function() {
@ -121,7 +130,7 @@
},
start : () => { lastSteps = Bangle.getStepCount(); },
stop : () => {},
draw : (x,y) => g.reset().drawImage(atob("DAyBAAADDHnnnnnnnnnnjDmDnDnAAA=="),x,y)
draw : (x,y) => g.reset().drawImage(atob("DAwBAAMMeeeeeeeecOMMAAMMMMAA"),x,y)
};
}
// TODO: recAltitude from pressure sensor
@ -138,7 +147,7 @@
}
})
*/
require("Storage").list(/^.*\.recorder\.js$/).forEach(fn=>eval(fn)(recorders));
require("Storage").list(/^.*\.recorder\.js$/).forEach(fn=>eval(require("Storage").read(fn))(recorders));
return recorders;
}