Skip to content

Commit 5131cd2

Browse files
authored
Merge pull request espruino#4131 from bobrippling/runplus-resume
runplus: don't infinitely resume a track during a day
2 parents b588a41 + f49161a commit 5131cd2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

apps/runplus/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ Write to correct settings file, fixing settings not working.
3333
track screen state
3434
0.30: Change the "time" stat to show active time (duration) rather than
3535
elapsed time (fix #3802), and sync with recorder on load
36+
0.31: "Always resume run" will start a new run at app launch, and resume this
37+
run for the duration of the app

apps/runplus/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ let settings = Object.assign({
4949
}, require("Storage").readJSON("runplus.json", 1) || {});
5050
let statIDs = [settings.B1,settings.B2,settings.B3,settings.B4,settings.B5,settings.B6].filter(s=>s!=="");
5151
let exs = ExStats.getStats(statIDs, settings);
52+
let recordMode = settings.alwaysResume ? "new" : undefined; // if always resuming, start a new track then resume into it for subsequent onStartStop()s
5253
// ---------------------------
5354

5455
// handle the case where we were stopped outside of the app
@@ -98,7 +99,9 @@ function onStartStop() {
9899
promise = promise.
99100
then(() => {
100101
screen = "menu";
101-
return WIDGETS["recorder"].setRecording(true, { force : shouldResume?"append":undefined });
102+
const ret = WIDGETS["recorder"].setRecording(true, { force : recordMode });
103+
if(shouldResume) recordMode = "append"; // subsequent onStartStop()s resume the new recording
104+
return ret;
102105
}).then(() => {
103106
screen = "main";
104107
if(!shouldResume){

apps/runplus/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "runplus",
33
"name": "Run+",
4-
"version": "0.30",
4+
"version": "0.31",
55
"author": "thyttan",
66
"description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.",
77
"icon": "app.png",

0 commit comments

Comments
 (0)