Update boot to use its own block
parent
aae381e787
commit
c588a254d0
|
|
@ -1,33 +1,32 @@
|
|||
|
||||
//Set LCD to zero every reboot
|
||||
let s = require("Storage").readJSON("setting.json", 1) || {};
|
||||
s.brightness = 0;
|
||||
if (!("lcdTimeout" in s)) s.lcdTimeout = 5; // fallback so logic doesn't break
|
||||
require("Storage").writeJSON("setting.json", s);
|
||||
{
|
||||
//Set LCD to zero every reboot
|
||||
let s = require("Storage").readJSON("setting.json", 1) || {};
|
||||
s.brightness = 0;
|
||||
if (!("lcdTimeout" in s)) s.lcdTimeout = 5; // fallback so logic doesn't break
|
||||
require("Storage").writeJSON("setting.json", s);
|
||||
|
||||
|
||||
|
||||
|
||||
const longPressTime=400; //(ms)
|
||||
let unlockedWithLongPress = false;
|
||||
const longPressTime=400; //(ms)
|
||||
|
||||
Bangle.on('lock', function(isLocked) {
|
||||
Bangle.setLCDBrightness(0);
|
||||
Bangle.on('lock', function(isLocked) {
|
||||
Bangle.setLCDBrightness(0);
|
||||
|
||||
if (!isLocked) {
|
||||
// Just unlocked — give a short delay and check if BTN1 is still pressed
|
||||
setTimeout(() => {
|
||||
if (digitalRead(BTN1)) {
|
||||
Bangle.setLCDBrightness(0.1);
|
||||
setTimeout(()=>{
|
||||
if (!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);
|
||||
|
||||
} else {
|
||||
Bangle.setLCDBrightness(0);
|
||||
},s.lcdTimeout*1000);
|
||||
} else {
|
||||
Bangle.setLCDBrightness(0);
|
||||
}
|
||||
}, longPressTime); // Slight delay to allow unlock to settle
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}, longPressTime); // Slight delay to allow unlock to settle
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue