exstats: make time stat duration-based (rather than elapsed time)

master
Rob Pilling 2025-04-18 14:17:08 +01:00
parent 7987766ebe
commit ad30913080
7 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,4 @@
0.01: New app! 0.01: New app!
0.02: Show elapsed time on pause screen 0.02: Show elapsed time on pause screen
0.03: Avoid initial GPS skew and allow reset of time/splits 0.03: Avoid initial GPS skew and allow reset of time/splits
0.04: Bump exstats module - show active time, not elapsed

View File

@ -1,7 +1,7 @@
{ {
"id": "pace", "id": "pace",
"name": "Pace", "name": "Pace",
"version": "0.03", "version": "0.04",
"description": "Show pace and time running splits", "description": "Show pace and time running splits",
"icon": "app.png", "icon": "app.png",
"tags": "run,running,fitness,outdoors", "tags": "run,running,fitness,outdoors",

View File

@ -18,3 +18,4 @@
0.17: Ensure screen redraws after "Resume run?" menu (#3044) 0.17: Ensure screen redraws after "Resume run?" menu (#3044)
0.18: Minor code improvements 0.18: Minor code improvements
0.19: Fix step count bug when runs are resumed after a long time 0.19: Fix step count bug when runs are resumed after a long time
0.20: Bump exstats module - show active time, not elapsed

View File

@ -1,6 +1,6 @@
{ "id": "run", { "id": "run",
"name": "Run", "name": "Run",
"version": "0.19", "version": "0.20",
"description": "Displays distance, time, steps, cadence, pace and more for runners. The **Run+** app for Bangle.js 2 provides additional features.", "description": "Displays distance, time, steps, cadence, pace and more for runners. The **Run+** app for Bangle.js 2 provides additional features.",
"icon": "app.png", "icon": "app.png",
"tags": "run,running,fitness,outdoors,gps", "tags": "run,running,fitness,outdoors,gps",

View File

@ -28,3 +28,5 @@ Write to correct settings file, fixing settings not working.
0.25: Fix step count bug when runs are resumed after a long time 0.25: Fix step count bug when runs are resumed after a long time
0.26: Add ability to zoom in on a single stat by tapping it 0.26: Add ability to zoom in on a single stat by tapping it
0.27: Allow setting to alway resume an activity 0.27: Allow setting to alway resume an activity
0.28: Change the "time" stat to show active time (duration) rather than
elapsed time (fix #3802)

View File

@ -1,7 +1,7 @@
{ {
"id": "runplus", "id": "runplus",
"name": "Run+", "name": "Run+",
"version": "0.27", "version": "0.28",
"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.", "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.",
"icon": "app.png", "icon": "app.png",
"tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen", "tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",

View File

@ -229,7 +229,7 @@ exports.getStats = function(statIDs, options) {
if (statIDs.includes("time")) { if (statIDs.includes("time")) {
stats["time"]={ stats["time"]={
title : "Time", title : "Time",
getValue : function() { return Date.now()-state.startTime; }, getValue : function() { return state.duration; },
getString : function() { return formatTime(this.getValue()) }, getString : function() { return formatTime(this.getValue()) },
}; };
} }
@ -317,12 +317,12 @@ exports.getStats = function(statIDs, options) {
if (needHRM) Bangle.setHRMPower(true,"exs"); if (needHRM) Bangle.setHRMPower(true,"exs");
if (needBaro) Bangle.setBarometerPower(true,"exs"); if (needBaro) Bangle.setBarometerPower(true,"exs");
setInterval(function() { // run once a second.... setInterval(function() { // run once a second....
if (stats["time"]) stats["time"].emit("changed",stats["time"]);
if (!state.active) return; if (!state.active) return;
// called once a second // called once a second
var now = Date.now(); var now = Date.now();
state.duration += now - state.lastTime; // in ms state.duration += now - state.lastTime; // in ms
state.lastTime = now; state.lastTime = now;
if (stats["time"]) stats["time"].emit("changed",stats["time"]);
// set cadence -> steps over last minute // set cadence -> steps over last minute
state.stepsPerMin = Math.round(60000 * E.sum(state.stepHistory) / Math.min(state.duration,60000)); state.stepsPerMin = Math.round(60000 * E.sum(state.stepHistory) / Math.min(state.duration,60000));
if (stats["caden"]) stats["caden"].emit("changed",stats["caden"]); if (stats["caden"]) stats["caden"].emit("changed",stats["caden"]);
@ -335,7 +335,7 @@ exports.getStats = function(statIDs, options) {
state.BPM = 0; state.BPM = 0;
if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]); if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]);
} }
if (state.notify.time.increment > 0 && state.notify.time.next <= now) { if (state.notify.time.increment > 0 && state.notify.time.next <= state.duration) {
state.notify.time.next = state.notify.time.next + state.notify.time.increment; state.notify.time.next = state.notify.time.next + state.notify.time.increment;
stats["time"].emit("notify",stats["time"]); stats["time"].emit("notify",stats["time"]);
} }