From b3873657971b16546a8939b498fdc81de8e4dec1 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sat, 27 Apr 2024 11:07:24 +0100 Subject: [PATCH] exstats: fix steps being negative/handle step count increment between stats --- modules/exstats.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/exstats.js b/modules/exstats.js index 28879ccfe..5cd0374a7 100644 --- a/modules/exstats.js +++ b/modules/exstats.js @@ -102,6 +102,7 @@ var stats = {}; const DATA_FILE = "exstats.json"; // Load the state from a saved file if there was one state = Object.assign(state, require("Storage").readJSON(DATA_FILE,1)||{}); +state.startSteps = Bangle.getStepCount() - (state.lastSteps - state.startSteps); // force step history to a uint8array state.stepHistory = new Uint8Array(state.stepHistory); // when we exit, write the current state