Update boot to use its own block
parent
aae381e787
commit
c588a254d0
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
{
|
||||
//Set LCD to zero every reboot
|
||||
let s = require("Storage").readJSON("setting.json", 1) || {};
|
||||
s.brightness = 0;
|
||||
|
|
@ -8,6 +8,7 @@ require("Storage").writeJSON("setting.json", s);
|
|||
|
||||
|
||||
|
||||
let unlockedWithLongPress = false;
|
||||
const longPressTime=400; //(ms)
|
||||
|
||||
Bangle.on('lock', function(isLocked) {
|
||||
|
|
@ -17,10 +18,10 @@ Bangle.on('lock', function(isLocked) {
|
|||
// Just unlocked — give a short delay and check if BTN1 is still pressed
|
||||
setTimeout(() => {
|
||||
if (digitalRead(BTN1)) {
|
||||
unlockedWithLongPress = true;
|
||||
//set brightness until. locked.
|
||||
Bangle.setLCDBrightness(0.1);
|
||||
setTimeout(()=>{
|
||||
Bangle.setLCDBrightness(0);
|
||||
},s.lcdTimeout*1000);
|
||||
|
||||
} else {
|
||||
Bangle.setLCDBrightness(0);
|
||||
}
|
||||
|
|
@ -28,6 +29,4 @@ Bangle.on('lock', function(isLocked) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue