diff --git a/apps.json b/apps.json index 890138590..41cb62c1b 100644 --- a/apps.json +++ b/apps.json @@ -49,10 +49,10 @@ { "id": "health", "name": "Health Tracking", - "version": "0.04", + "version": "0.05", "description": "Logs health data and provides an app to view it (BETA - requires firmware 2v11)", "icon": "app.png", - "tags": "tool,system", + "tags": "tool,system,health", "supports": ["BANGLEJS","BANGLEJS2"], "readme": "README.md", "storage": [ diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index a21d76fd1..808282b64 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -3,3 +3,4 @@ 0.03: Settings to turn HRM on 0.04: Add HRM graph view Don't restart HRM when changing apps if we've already got a good BPM value +0.05: Fix daily summary calculation diff --git a/apps/health/boot.js b/apps/health/boot.js index 17fbaaaa8..a8d78f685 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -55,28 +55,29 @@ Bangle.on("health", health => { } var recordPos = DB_HEADER_LEN+(rec*DB_RECORD_LEN); require("Storage").write(fn, getRecordData(health), recordPos, DB_FILE_LEN); - if (rec%DB_RECORDS_PER_DAY != DB_RECORDS_PER_DAY-1) return; + if (rec%DB_RECORDS_PER_DAY != DB_RECORDS_PER_DAY-2) return; // we're at the end of the day. Read in all of the data for the day and sum it up var sumPos = recordPos + DB_RECORD_LEN; // record after the current one is the sum if (f.substr(sumPos, DB_RECORD_LEN)!="\xFF\xFF\xFF\xFF") { print("HEALTH ERR: Daily summary already written!"); return; } - health = { steps:0, bpm:0, movement:0, records:0}; + health = { steps:0, bpm:0, movement:0, movCnt:0, bpmCnt:0}; var records = DB_RECORDS_PER_HR*24; for (var i=0;i