mirror of https://github.com/espruino/BangleApps
Add torch app
parent
7823f1cc83
commit
107d8ef7e0
13
apps.json
13
apps.json
|
@ -773,5 +773,18 @@
|
||||||
{"name":"pipboy.app.js","url":"app.js"},
|
{"name":"pipboy.app.js","url":"app.js"},
|
||||||
{"name":"pipboy.img","url":"app-icon.js","evaluate":true}
|
{"name":"pipboy.img","url":"app-icon.js","evaluate":true}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{ "id": "torch",
|
||||||
|
"name": "Torch",
|
||||||
|
"shortName":"Torch",
|
||||||
|
"icon": "app.png",
|
||||||
|
"version":"0.01",
|
||||||
|
"description": "Turns screen white to help you see in the dark. Select from the launcher or press BTN3 four times in quick succession to start when in normal clock mode",
|
||||||
|
"tags": "tool,torch",
|
||||||
|
"storage": [
|
||||||
|
{"name":"torch.app.js","url":"app.js"},
|
||||||
|
{"name":"torch.wid.js","url":"widget.js"},
|
||||||
|
{"name":"torch.img","url":"app-icon.js","evaluate":true}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
0.01: New App!
|
|
@ -0,0 +1 @@
|
||||||
|
require("heatshrink").decompress(atob("mEwxH+AH4A/AH4Acq0yF1tWlksF10yqwuuSVIuGSVF/FwySm5nM0YuGSUovBGAIuGAgIukGAQuGAgIvlSQozEF0iSEeowvlGAT1HF0iSDeo4vlegSShF5fMv4uFSLQkC0QACSRguevErld4GBKSDFz4ABF5CSBLsIvLdDK7GFwiPIF0AvEFw4tbFwztKFrguDF4gADFkAuFF44unF4wuoGAouqAAwu/ABtWqwutmUsmQutF4JhKF0iSJdT4uFAoIwGFz4wCFwgECF0qRCFwo3BF0qSDMQiSBF0owCFwgFBF86SBF1qSFF1SSDF1gA/AH4A1A"))
|
|
@ -0,0 +1,8 @@
|
||||||
|
Bangle.setLCDPower(1);
|
||||||
|
Bangle.setLCDTimeout(0);
|
||||||
|
g.reset();
|
||||||
|
g.fillRect(0,0,g.getWidth(),g.getHeight());
|
||||||
|
// Any button turns off
|
||||||
|
setWatch(()=>load(), BTN1);
|
||||||
|
setWatch(()=>load(), BTN2);
|
||||||
|
setWatch(()=>load(), BTN3);
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,16 @@
|
||||||
|
var clickTimes = [];
|
||||||
|
var CLICK_COUNT = 4; // number of taps
|
||||||
|
var CLICK_PERIOD = 1; // second
|
||||||
|
|
||||||
|
Bangle.on("lcdPower",function(on) {
|
||||||
|
// First click (that turns LCD on) isn't given to
|
||||||
|
// setWatch, so handle it here
|
||||||
|
if (on) clickTimes=[getTime()];
|
||||||
|
});
|
||||||
|
setWatch(function(e) {
|
||||||
|
while (clickTimes.length>=CLICK_COUNT) clickTimes.shift();
|
||||||
|
clickTimes.push(e.time);
|
||||||
|
var clickPeriod = e.time-clickTimes[0];
|
||||||
|
if (clickTimes.length==CLICK_COUNT && clickPeriod<CLICK_PERIOD)
|
||||||
|
load("torch.app.js");
|
||||||
|
}, BTN3, {repeat:true, edge:"rising"});
|
Loading…
Reference in New Issue