run 0.06: Add option to record a run using the recorder app automatically

pull/1393/head
Gordon Williams 2022-02-04 12:00:48 +00:00
parent 591618ea07
commit 6872c38a8d
5 changed files with 31 additions and 3 deletions

View File

@ -4,3 +4,4 @@
0.03: Fixed distance calculation, tested against Garmin Etrex, Amazfit GTS 2
0.04: Use the exstats module, and make what is displayed configurable
0.05: exstats updated so update 'distance' label is updated, option for 'speed'
0.06: Add option to record a run using the recorder app automatically

View File

@ -32,6 +32,8 @@ that, and then start the `Run` app.
Under `Settings` -> `App` -> `Run` you can change settings for this app.
* `Record Run` (only displayed if `Recorder` app installed) should the Run app automatically
record GPS/HRM/etc data every time you start a run?
* `Pace` is the distance that pace should be shown over - 1km, 1 mile, 1/2 Marathon or 1 Marathon
* `Box 1/2/3/4/5/6` are what should be shown in each of the 6 boxes on the display. From the top left, down.
If you set it to `-` nothing will be displayed, so you can display only 4 boxes of information

View File

@ -6,6 +6,7 @@ var fontHeading = "6x8:2";
var fontValue = B2 ? "6x15:2" : "6x8:3";
var headingCol = "#888";
var fixCount = 0;
var isMenuDisplayed = false;
g.clear();
Bangle.loadWidgets();
@ -13,6 +14,7 @@ Bangle.drawWidgets();
// ---------------------------
let settings = Object.assign({
record : true,
B1 : "dist",
B2 : "time",
B3 : "pacea",
@ -39,6 +41,19 @@ function onStartStop() {
// if stopping running, don't clear state
// so we can at least refer to what we've done
layout.render();
// start/stop recording
if (settings.record && WIDGETS["recorder"]) {
if (running) {
isMenuDisplayed = true;
WIDGETS["recorder"].setRecording(true).then(() => {
isMenuDisplayed = false;
layout.forgetLazyState();
layout.render();
});
} else {
WIDGETS["recorder"].setRecording(false);
}
}
}
var lc = [];
@ -80,5 +95,5 @@ Bangle.on("GPS", function(fix) {
// We always call ourselves once a second to update
setInterval(function() {
layout.clock.label = locale.time(new Date(),1);
layout.render();
if (!isMenuDisplayed) layout.render();
}, 1000);

View File

@ -1,6 +1,6 @@
{ "id": "run",
"name": "Run",
"version":"0.05",
"version":"0.06",
"description": "Displays distance, time, steps, cadence, pace and more for runners.",
"icon": "app.png",
"tags": "run,running,fitness,outdoors,gps",

View File

@ -9,6 +9,7 @@
// This way saved values are preserved if a new version adds more settings
const storage = require('Storage')
let settings = Object.assign({
record : true,
B1 : "dist",
B2 : "time",
B3 : "pacea",
@ -35,8 +36,17 @@
var menu = {
'': { 'title': 'Run' },
'< Back': back
'< Back': back,
};
if (WIDGETS["recorder"])
menu[/*LANG*/"Record Run"] = {
value : !!settings.record,
format : v => v?/*LANG*/"Yes":/*LANG*/"No",
onchange : v => {
settings.record = v;
saveSettings();
}
};
ExStats.appendMenuItems(menu, settings, saveSettings);
Object.assign(menu,{
'Box 1': getBoxChooser("B1"),