[lightswitch] Add setLCDPower for unlocking

master
storm64 2025-05-07 12:13:01 +02:00 committed by GitHub
parent 04d497ad73
commit e9d3c1d6b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -10,13 +10,17 @@ exports = {
unlockSide: "", unlockSide: "",
tapSide: "right", tapSide: "right",
tapOn: "always", tapOn: "always",
isOn: true
}, require("Storage").readJSON("lightswitch.json", true) || {}); }, require("Storage").readJSON("lightswitch.json", true) || {});
// cache lock status // cache lock status
var locked = Bangle.isLocked(); var locked = Bangle.isLocked();
// check to unlock // 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 // check to flash
if (data.dir === w.tapSide && (w.tapOn === "always" || locked === (w.tapOn === "locked"))) require("lightswitch.js").flash(); if (data.dir === w.tapSide && (w.tapOn === "always" || locked === (w.tapOn === "locked"))) require("lightswitch.js").flash();