lockTimeout not working as expected on BangleJS 2

Posted on
  • 👋 I'm trying to disable the backlight but keep the screen active to touches and the physical button clickable.

    With the following code, the screen stays active to touches after the backlight turns off, which is great. However, the button stops responding and has to be clicked twice after the screen has" gone dark" (according to the LCD timeout value in seconds):

    Bangle.setLocked(false);
    Bangle.setOptions({ lockTimeout: 0 });
    

    The only way to keep the button responsive after the lock timeout passed, is to add:

    Bangle.setLCDTimeout(0);
    

    Is there a way to keep the screen off but the button still responsive? I feel like that is how setting lockTimeout: 0 should behave.

  • Maybe you can find a solution by studying "Light Switch Widget"-code .

    EDIT: Or can you settle for just setting a really high number of ms until it times out? I don't now what the upper limit is for that.

  • Ahh, thanks - that is interesting. We intentionally 'eat' the first button press if it would have caused any state change (eg backlight), but I guess in reality what we should do is only ignore it if we were locked.

    I filed an issue here: https://github.com/espruino/Espruino/iss­ues/2263

    Maybe you could just not lock or turn the backlight off at all (set all to 0) and then turn the backlight off yourself with Bangle.setLCDBrightness?

    It's worth noting that the lock behaviour is there to save battery as well as accidental presses. Keeping the touchscreen on uses 1-2mA of power, so may drop your battery life down to ~4 days if left on

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

lockTimeout not working as expected on BangleJS 2

Posted by Avatar for khromov @khromov

Actions