Skip to content

Commit 64a92e2

Browse files
committed
health 0.37: Reduce movement limit for HRM off from 400 to 100
+ Fix daily summary for movement (was not scaling down correctly)
1 parent aad797d commit 64a92e2

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

apps/health/ChangeLog

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@
3939
Speed improvements (put temporary functions in RAM where possible)
4040
0.34: Fix readFullDatabase (was skipping first month of data)
4141
0.35: Update boot/lib.min.js
42-
0.36: Fix Distance graphs that used '1*' to remove the suffix
42+
0.36: Fix Distance graphs that used '1*' to remove the suffix
43+
0.37: Reduce movement limit for HRM off from 400 to 100
44+
Fix daily summary for movement (was not scaling down correctly)

apps/health/boot.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
function startMeasurement() {
77
// if is charging, or hardly moved and face up/down, don't start HRM
88
if (Bangle.isCharging() ||
9-
(Bangle.getHealthStatus("last").movement<400 && Math.abs(Bangle.getAccel().z)>0.99)) return;
9+
(Bangle.getHealthStatus("last").movement<100 && Math.abs(Bangle.getAccel().z)>0.99)) return;
1010
// otherwise turn HRM on
1111
Bangle.setHRMPower(1, "health");
1212
setTimeout(() => {
@@ -81,12 +81,6 @@ Bangle.on("health", health => {
8181
require("Storage").write(fn, "HEALTH2\0", 0, DB_HEADER_LEN + DB_RECORDS_PER_MONTH*inf.r); // header (and allocate full new file)
8282
}
8383
var recordPos = DB_HEADER_LEN+(rec*inf.r);
84-
85-
// scale down reported movement value in order to fit it within a
86-
// uint8 DB field
87-
health = Object.assign({}, health);
88-
health.movement /= 8;
89-
9084
require("Storage").write(fn, inf.encode(health), recordPos);
9185
if (rec%DB_RECORDS_PER_DAY != DB_RECORDS_PER_DAY-2) return;
9286
// we're at the end of the day. Read in all of the data for the day and sum it up

apps/health/boot.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/health/lib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ exports.getDecoder = function(fileContents) {
6161
health.steps>>8,health.steps&255, // 16 bit steps
6262
health.bpmMin || health.bpm, // 8 bit bpm
6363
health.bpmMax || health.bpm, // 8 bit bpm
64-
Math.min(health.movement, 255),
64+
Math.min(health.movement >> 3, 255),
6565
E.getBattery()|(Bangle.isCharging()&&128),
6666
0|Math.round(health.temperature*2),
6767
(alt>>8)|(Math.max(0,exports.ACTIVITY.indexOf(health.activity))<<5),alt&255,
@@ -82,7 +82,7 @@ exports.getDecoder = function(fileContents) {
8282
encode : health => { "ram"; return String.fromCharCode(
8383
health.steps>>8,health.steps&255, // 16 bit steps
8484
health.bpm, // 8 bit bpm
85-
Math.min(health.movement, 255));
85+
Math.min(health.movement >> 3, 255));
8686
}
8787
};
8888
}

apps/health/lib.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/health/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "health",
33
"name": "Health Tracking",
44
"shortName": "Health",
5-
"version": "0.36",
5+
"version": "0.37",
66
"description": "Logs health data and provides an app to view it",
77
"icon": "app.png",
88
"screenshots" : [ { "url":"screenshot.png" } ],

0 commit comments

Comments
 (0)