Skip to content

Commit e43ce34

Browse files
committed
widpedom 0.23: Allow tapping on the widget to disable step counting (2v29+ needed) - also add readme
1 parent 702db69 commit e43ce34

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

apps/widpedom/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
0.20: Fix issue where step count would randomly reset
2323
0.21: Memory usage improvements, fix widget initial width (fix #1170)
2424
0.22: Fix 'stps' regression for 0.21 (fix #1233)
25+
0.23: Allow tapping on the widget to disable step counting (2v29+ needed)

apps/widpedom/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Pedometer widget
2+
3+
Daily pedometer widget that can display steps in large/small size, and also your progress towards a step goal.
4+
5+
## Usage
6+
7+
Once installed, the pedometer will display the step count in the top left of the watch (when widgets are displayed)
8+
9+
On 2v29 and later firmwares, tapping on the widget with the watch unlocked will make it buzz and cause the steps to go grey, which will disable step detection. Tapping again will re-enable it.
10+
11+
## Settings
12+
13+
This app has a settings screen (under `Settings -> Apps -> Pedometer widget`)
14+
15+
* `Daily Goal` - set how many steps your goal for the day is. The Bangle will buzz when the goal is reached.
16+
* `Show Progress` - show progress towards the step goal in the widget bar
17+
* `Large Digits` - show large digits for the step counter rather than small ones
18+
* `Hide Widget` - don't show the widget. Normally in this case we'd suggest just uninstalling the widget, but keeping it installed but hidden will allow the Bangle to buzz when your step goal is reached.

apps/widpedom/metadata.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"id": "widpedom",
33
"name": "Pedometer widget",
4-
"version": "0.22",
5-
"description": "Daily pedometer widget",
4+
"version": "0.23",
5+
"description": "Daily pedometer widget that can display steps in large/small size, and also your progress towards a step goal.",
66
"icon": "widget.png",
77
"type": "widget",
88
"tags": "widget",
99
"supports": ["BANGLEJS","BANGLEJS2"],
10+
"readme": "README.md",
1011
"storage": [
1112
{"name":"widpedom.wid.js","url":"widget.js"},
1213
{"name":"widpedom.settings.js","url":"settings.js"}

apps/widpedom/widget.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var lastStepCount;
66
let stp_today = 0;
77
let settings;
8+
let stepDisabled = Bangle.getOptions().stepCounterDisabled; // 2v29+
89

910
function loadSettings() {
1011
const d = require('Storage').readJSON("wpedom.json", 1) || {};
@@ -109,6 +110,7 @@
109110
}
110111
g.reset();
111112
}
113+
if (stepDisabled) g.setColor("#888"); // dim down step count
112114
if (settings.large) {
113115
g.setFont("6x8",2);
114116
g.setFontAlign(-1, 0);
@@ -141,4 +143,14 @@
141143
delete pedomData;
142144
}
143145
WIDGETS["wpedom"].width = WIDGETS["wpedom"].getWidth();
146+
if (!settings.hide) Bangle.on("touch", (_,e) => { // allow disabling steps on tap
147+
if (!e || WIDGETS["back"]) return; // ignore taps if back widget shown - it's too close
148+
let w = WIDGETS["wpedom"];
149+
if (w._draw || e.y<w.y || e.y >= (w.y+24) || e.x<w.x || e.x>(w.x+w.width)) return; // ignore out of bounds or if hidden (w._draw set)
150+
if (stepDisabled===undefined) return; // 2v28 or before, disable steps not supported
151+
Bangle.buzz(50); // feedback
152+
stepDisabled = !stepDisabled;
153+
Bangle.setOptions({stepCounterDisabled:stepDisabled}); // 2v29
154+
w.draw();
155+
});
144156
})()

0 commit comments

Comments
 (0)