exstats: emit (elapsed) time changes on tick

to keep UIs in sync with state
master
Rob Pilling 2025-04-17 21:59:41 +01:00
parent cc051726cc
commit 7987766ebe
1 changed files with 1 additions and 1 deletions

View File

@ -317,6 +317,7 @@ exports.getStats = function(statIDs, options) {
if (needHRM) Bangle.setHRMPower(true,"exs");
if (needBaro) Bangle.setBarometerPower(true,"exs");
setInterval(function() { // run once a second....
if (stats["time"]) stats["time"].emit("changed",stats["time"]);
if (!state.active) return;
// called once a second
var now = Date.now();
@ -328,7 +329,6 @@ exports.getStats = function(statIDs, options) {
// move step history onwards
state.stepHistory.set(state.stepHistory,1);
state.stepHistory[0]=0;
if (stats["time"]) stats["time"].emit("changed",stats["time"]);
// update BPM - if nothing valid in 60s remove the reading
state.BPMage++;
if (state.BPM && state.BPMage>60) {