diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 1e4864af8..7dbb9c458 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -10,3 +10,4 @@ 0.09: Fix file naming so months are 1-based (not 0) (fix #1119) 0.10: Adds additional 3 minute setting for HRM 0.11: Pre-minified boot&lib - folds constants and saves RAM +0.12: Add setting for Daily Step Goal diff --git a/apps/health/README.md b/apps/health/README.md index f44854e3e..c6b379c0a 100644 --- a/apps/health/README.md +++ b/apps/health/README.md @@ -24,6 +24,7 @@ Stores: * **Off** - Don't turn HRM on, but record heart rate if the HRM was turned on by another app/widget * **10 Min** - Turn HRM on every 10 minutes (for each heath entry) and turn it off after 2 minutes, or when a good reading is found * **Always** - Keep HRM on all the time (more accurate recording, but reduces battery life to ~36 hours) +* **Daily Step Goal** - Default 10000, daily step goal for pedometer apps to use ## Technical Info diff --git a/apps/health/app.js b/apps/health/app.js index 64640603e..e39590e2d 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -2,8 +2,8 @@ function getSettings() { return require("Storage").readJSON("health.json",1)||{}; } -function setSettings(s) { - require("Storage").writeJSON("health.json",s); +function setSettings(healthSettings) { + require("Storage").writeJSON("health.json",healthSettings); } function menuMain() { @@ -22,15 +22,21 @@ function menuMain() { function menuSettings() { swipe_enabled = false; clearButton(); - var s=getSettings(); + var healthSettings=getSettings(); + //print(healthSettings); E.showMenu({ "":{title:"Health Tracking"}, "< Back":()=>menuMain(), "Heart Rt":{ - value : 0|s.hrm, + value : 0|healthSettings.hrm, min : 0, max : 3, format : v=>["Off","3 mins","10 mins","Always"][v], - onchange : v => { s.hrm=v;setSettings(s); } + onchange : v => { healthSettings.hrm=v;setSettings(healthSettings); } + }, + "Daily Step Goal":{ + value : (healthSettings.stepGoal ? healthSettings.stepGoal : 10000), + min : 0, max : 20000, step : 100, + onchange : v => { healthSettings.stepGoal=v;setSettings(healthSettings); } } }); } @@ -199,7 +205,7 @@ function drawBarChart() { for (bar = 1; bar < 10; bar++) { if (bar == 5) { g.setFont('6x8', 2); - g.setFontAlign(0,-1) + g.setFontAlign(0,-1); g.setColor(g.theme.fg); g.drawString(chart_label + " " + (chart_index + bar -1) + " " + chart_data[chart_index + bar - 1], g.getWidth()/2, 150); g.setColor("#00f"); diff --git a/apps/health/metadata.json b/apps/health/metadata.json index 8bb986c57..5d096dc07 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -1,7 +1,7 @@ { "id": "health", "name": "Health Tracking", - "version": "0.11", + "version": "0.12", "description": "Logs health data and provides an app to view it", "icon": "app.png", "tags": "tool,system,health", diff --git a/apps/widstep/ChangeLog b/apps/widstep/ChangeLog new file mode 100644 index 000000000..55cda0f21 --- /dev/null +++ b/apps/widstep/ChangeLog @@ -0,0 +1 @@ +0.01: New widget diff --git a/apps/widstep/README.md b/apps/widstep/README.md new file mode 100644 index 000000000..c41b025cd --- /dev/null +++ b/apps/widstep/README.md @@ -0,0 +1,9 @@ +# Step counter widget +This is my step counter. There are many like it, but this one is mine. + +A pedometer widget designed to be as narrow as possible, but still easy to read, by sacrificing accuracy and only showing to the nearest 100 steps (0.1k). +Shows a subtle fill colour in the background for progress to the goal. The goal is picked up from the health tracker settings. + + +![](widstep-light.png) +![](widstep-dark.png) diff --git a/apps/widstep/icons8-winter-boots-48.png b/apps/widstep/icons8-winter-boots-48.png new file mode 100644 index 000000000..7dceceef0 Binary files /dev/null and b/apps/widstep/icons8-winter-boots-48.png differ diff --git a/apps/widstep/metadata.json b/apps/widstep/metadata.json new file mode 100644 index 000000000..ea108e0f1 --- /dev/null +++ b/apps/widstep/metadata.json @@ -0,0 +1,17 @@ +{ + "id": "widstep", + "name": "Step counter widget", + "version": "0.01", + "description": "Step counter widget, narrow but clearly readable", + "readme": "README.md", + "icon": "icons8-winter-boots-48.png", + "screenshots": [{"url":"widstep-light.png"},{"url":"widstep-dark.png"}], + "type": "widget", + "tags": "widget,health", + "supports": ["BANGLEJS","BANGLEJS2"], + "dependencies" : {"health":"app"}, + "allow_emulator":false, + "storage": [ + {"name":"widstep.wid.js","url":"widstep.wid.js"} + ] + } diff --git a/apps/widstep/widstep-dark.png b/apps/widstep/widstep-dark.png new file mode 100644 index 000000000..c8e1a8065 Binary files /dev/null and b/apps/widstep/widstep-dark.png differ diff --git a/apps/widstep/widstep-light.png b/apps/widstep/widstep-light.png new file mode 100644 index 000000000..9cce1e7c2 Binary files /dev/null and b/apps/widstep/widstep-light.png differ diff --git a/apps/widstep/widstep.wid.js b/apps/widstep/widstep.wid.js new file mode 100644 index 000000000..6ad971af7 --- /dev/null +++ b/apps/widstep/widstep.wid.js @@ -0,0 +1,23 @@ +let wsSettingsGoal = (require('Storage').readJSON("health.json", 1) || {}).stepGoal || 10000; + +Bangle.on('step', function(s) { WIDGETS["widstep"].draw(); }); +Bangle.on('lcdPower', function(on) { + if (on) WIDGETS["widstep"].draw(); +}); +WIDGETS["widstep"]={area:"tl", sortorder:-1, width:28, + draw:function() { + if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off + var steps = Bangle.getHealthStatus("day").steps; + g.reset(); + g.setColor(g.theme.bg); + g.fillRect(this.x, this.y, this.x + this.width, this.y + 23); + g.setColor(g.theme.dark ? '#00f' : '#0ff'); + var progress = this.width * Math.min(steps/wsSettingsGoal, 1); + g.fillRect(this.x+1, this.y+1, this.x + progress -1, this.y + 23); + g.setColor(g.theme.fg); + g.setFontAlign(0, -1); + var steps_k = (steps/1000).toFixed(1) + 'k'; + g.setFont('6x15').drawString(steps_k, this.x+this.width/2, this.y + 10); + g.setFont('4x6').drawString('steps', this.x+this.width/2, this.y + 2); + } +};