commit
c298a36aba
|
|
@ -8,3 +8,4 @@
|
|||
0.08: Ensure boot code doesn't allocate and leave a gloval variable named 'settings'
|
||||
0.09: Handle lightswitch logic running before its widget has loaded
|
||||
0.10: Minor code improvements
|
||||
0.11: Fix issue where backlight is not turned on.
|
||||
|
|
|
|||
|
|
@ -10,13 +10,17 @@ exports = {
|
|||
unlockSide: "",
|
||||
tapSide: "right",
|
||||
tapOn: "always",
|
||||
isOn: true
|
||||
}, require("Storage").readJSON("lightswitch.json", true) || {});
|
||||
|
||||
// cache lock status
|
||||
var locked = Bangle.isLocked();
|
||||
|
||||
// check to unlock
|
||||
if (locked && data.dir === w.unlockSide) Bangle.setLocked();
|
||||
if (locked && data.dir === w.unlockSide) {
|
||||
Bangle.setLocked();
|
||||
if (w.isOn) Bangle.setLCDPower(true);
|
||||
}
|
||||
|
||||
// check to flash
|
||||
if (data.dir === w.tapSide && (w.tapOn === "always" || locked === (w.tapOn === "locked"))) require("lightswitch.js").flash();
|
||||
|
|
@ -38,13 +42,14 @@ exports = {
|
|||
isOn: true
|
||||
}, require("Storage").readJSON("lightswitch.json", true) || {});
|
||||
|
||||
// chack if locked, backlight off or actual value lower then minimal flash value
|
||||
// check if locked, backlight off or actual value lower then minimal flash value
|
||||
if (Bangle.isLocked() || !w.isOn || w.value < w.minFlash) {
|
||||
|
||||
// set inner bulb and brightness
|
||||
var setBrightness = function(w, value) {
|
||||
if (w.drawInnerBulb) w.drawInnerBulb(value);
|
||||
Bangle.setLCDBrightness(value);
|
||||
Bangle.setLCDPower(true);
|
||||
};
|
||||
|
||||
// override timeout if defined
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "lightswitch",
|
||||
"name": "Light Switch Widget",
|
||||
"shortName": "Light Switch",
|
||||
"version": "0.10",
|
||||
"version": "0.11",
|
||||
"description": "A fast way to switch LCD backlight on/off, change the brightness and show the lock status. All in one widget.",
|
||||
"icon": "images/app.png",
|
||||
"screenshots": [
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@
|
|||
} else {
|
||||
// activate backlight
|
||||
this.isOn = true;
|
||||
Bangle.setLCDPower(true);
|
||||
// redraw complete widget icon
|
||||
this.drawIcon(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue