This is the output that seems to cause the issue. So imagine these sequence of events are handled by the firmware. The second time of 'pressed' :
line 685 jswrap_bangle.c
if (!lcdPowerOn && state) {
bangleTasks |= JSBT_LCD_ON;
lcdWakeButton = button;
return; // don't push button event if the LCD is off
}
It won't return here, because lcdPowerOn is already On? So then it propagates this '2nd' press.
line 1614 jswrap_bangle.c:
if (bangleTasks & JSBT_LCD_ON) jswrap_banglejs_setLCDPower(1);
which is part of function : jswrap_banglejs_idle
which translates to : jswIdle() in line 2155 of jsinteractive.c
So if the sequence is press -> press -> release or rising -> rising -> falling, I'm arguing that the second rising does get propagated because the function can't return because the lcdPowerOn variable is true. Its just a theory that seems probable.
Temporary solution could be to move the screen turning on 'action' , to the keyUp event instead of KeyDown. This way the lcdPowerOn will not be true and those keyDowns can be properly consumed/blocked from propagating.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I tested it a bit further.
This is the output that seems to cause the issue. So imagine these sequence of events are handled by the firmware. The second time of 'pressed' :
line 685 jswrap_bangle.c
It won't return here, because lcdPowerOn is already On? So then it propagates this '2nd' press.
line 1614 jswrap_bangle.c:
which is part of function : jswrap_banglejs_idle
which translates to : jswIdle() in line 2155 of jsinteractive.c
So if the sequence is press -> press -> release or rising -> rising -> falling, I'm arguing that the second rising does get propagated because the function can't return because the lcdPowerOn variable is true. Its just a theory that seems probable.
Temporary solution could be to move the screen turning on 'action' , to the keyUp event instead of KeyDown. This way the lcdPowerOn will not be true and those keyDowns can be properly consumed/blocked from propagating.