widget hand wash timer

master
MaBecker 2020-04-02 12:04:41 +02:00
parent 22d93ef884
commit bdfcea2bf7
2 changed files with 15 additions and 10 deletions

View File

@ -956,7 +956,7 @@
"name": "Hand Wash Timer", "name": "Hand Wash Timer",
"icon": "widget.png", "icon": "widget.png",
"version":"0.01", "version":"0.01",
"description": "Any swip will start your personal Bangle.js hand wash timer for 35 sec. Start washing after the short buzz and stop after the long buzz.", "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.",
"tags": "widget,tool", "tags": "widget,tool",
"type":"widget", "type":"widget",
"storage": [ "storage": [

View File

@ -2,6 +2,7 @@
(() => { (() => {
var icon = require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA==")); var icon = require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA=="));
var color = 0x4A69; var color = 0x4A69;
var isActive = false;
function draw() { function draw() {
g.reset().setColor(color).drawImage(icon, this.x + 1, 0); g.reset().setColor(color).drawImage(icon, this.x + 1, 0);
@ -9,7 +10,9 @@
WIDGETS["widhwt"] = { area: "tr", width: 26, draw: draw }; WIDGETS["widhwt"] = { area: "tr", width: 26, draw: draw };
Bangle.on('swipe', function() { Bangle.on('twist', function() {
if (!isActive) {
isActive = true;
color = 0x41f; color = 0x41f;
Bangle.buzz(); Bangle.buzz();
Bangle.drawWidgets(); Bangle.drawWidgets();
@ -17,6 +20,8 @@
color = 0x4A69; color = 0x4A69;
Bangle.buzz(1E3, 1); Bangle.buzz(1E3, 1);
Bangle.drawWidgets(); Bangle.drawWidgets();
setTimeout(() => { isActive = false; }, 1E10);
}, 35E3); }, 35E3);
}
}); });
})(); })();