espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.74k stars 741 forks source link

btnHandlerCommon block when LCD off #2383

Closed d3nd3 closed 1 year ago

d3nd3 commented 1 year ago

btnHandlerCommon blocking when screen off. I created a pull request: #2384

Bangle 1 user.

gfwilliams commented 1 year ago

Not sure I understand exactly what you're saying here? Do you have an example of what isn't working before and what it fixes?

That if the screen is locked, the button presses don't go through? Because that one's expected behaviour - with WAKE_ON_BTNx the relevant button wakes the device and others are ignored.

It was done specifically because users on Bangle.js 1 would tend to catch BTN1 on clothing/etc and it was helpful to have a way to stop that - taking that behaviour out seems like a step back. That was the whole point of adding a 'lock' feature to the watch.

... Or is the issue that what you actually want to keep the watch unlocked permanently, but have the screen wake and turn off as normal? That feels like what you're really after here?

d3nd3 commented 1 year ago

Hi, I didn't see you posted here.

I understand that the default desire is that the watch functions best like that. That state is preserved, if lockTimeout is the same value as lcdPowerTimeout, the device locks and turns display off at same time. I see that this gives more flexibility to the lockTimeout for users who do not want to use that default safer state.

Hope that it makes more sense.

d3nd3 commented 1 year ago

But the backlight stuff will solve this posts issue: https://forum.espruino.com/conversations/387477/#comment17014744

And another stab at explaining the need for the lock thing: If I have lcd power save on (any of lockTimeout,backlightTimeout,lcdTimeout > 0 ) ... then the code at : https://github.com/espruino/Espruino/blob/491288d9ffb88150e4213f94c4ed30c99380b90b/libs/banglejs/jswrap_bangle.c#LL1598C1-L1605C4 is hit.

So the only way to get unlock whilst screen is off, is to have all (lockTimeout,backlightTimeout,lcdTimeout == 0) , equivalent to setLCDTimeout(0). I do not want to call setLCDTimeout(0), I want to invidually control the timeouts, eg. lcdTimeout 5000, lockTimeout 0. But currently not possible, because of that particular lcd off line which lives inside the if lockTimeout or lcdTimeout or backlightTimeout.

gfwilliams commented 1 year ago

Thanks for that explanation - that makes a lot more sense. To try and avoid some duplication, I'll just write a reply on #2384

gfwilliams commented 1 year ago

I think this can be closed now?