Merge pull request #1254 from adamschmalhofer/widhwt-bjs2

Hand Wash Timer 0.02
master
Gordon Williams 2022-01-10 08:36:35 +00:00 committed by GitHub
commit 04ee04defc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 7 deletions

View File

@ -1893,13 +1893,15 @@
{ {
"id": "widhwt", "id": "widhwt",
"name": "Hand Wash Timer", "name": "Hand Wash Timer",
"version": "0.01", "version": "0.02",
"description": "Swipe your wrist over the watch face to start your personal Bangle.js hand wash timer for 35 sec. Start washing after the short buzz and stop after the long buzz.", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.",
"icon": "widget.png", "icon": "widget.png",
"type": "widget", "type": "widget",
"tags": "widget,tool", "tags": "widget,tool",
"supports": ["BANGLEJS"], "allow_emulator": true,
"supports": ["BANGLEJS", "BANGLEJS2"],
"storage": [ "storage": [
{"name":"widhwt.app.js","url":"app.js"},
{"name":"widhwt.wid.js","url":"widget.js"} {"name":"widhwt.wid.js","url":"widget.js"}
] ]
}, },

View File

@ -1 +1,2 @@
0.01: New Widget! 0.01: New Widget!
0.02: Ported to Bangle.js2

13
apps/widhwt/app.js Normal file
View File

@ -0,0 +1,13 @@
// Replace the "Loading..." box
// with our own message
g.clearRect(38, 68, 138, 108);
g.drawRect(38, 68, 138, 108);
g.setFontVector(13);
g.setFontAlign(0, 0, 0);
g.drawString("Wash...", g.getWidth()/2, g.getHeight()/2);
Bangle.buzz();
setTimeout(() => {
Bangle.buzz(1E3, 1);
setTimeout(() => load(), 2E3);
}, 35E3);

View File

@ -6,9 +6,7 @@
g.reset().setColor(color).drawImage(require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA==")), this.x + 1, 0); g.reset().setColor(color).drawImage(require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA==")), this.x + 1, 0);
} }
WIDGETS["widhwt"] = { area: "tr", width: 26, draw: draw }; function startTimer() {
Bangle.on('swipe', function() {
color = 0x41f; color = 0x41f;
Bangle.buzz(); Bangle.buzz();
Bangle.drawWidgets(); Bangle.drawWidgets();
@ -17,6 +15,14 @@
Bangle.buzz(1E3, 1); Bangle.buzz(1E3, 1);
Bangle.drawWidgets(); Bangle.drawWidgets();
}, 35E3); }, 35E3);
}
}); if (process.env.HWVERSION == 1) {
WIDGETS["widhwt"] = {
area: "tr",
width: 26,
draw: draw,
};
Bangle.on('swipe', startTimer);
}
})(); })();