keyRepeatTimer stuck after “low battery” popup

I was recently playing and happened on a bug: While playing, the “only 10% battery remaining” popup appeared and paused the game. I must have had the right button pressed at that time, because once I dismissed the popup (with the buttons released in the meantime) and the game continued, its keyRepeatTimer continued firing, as if the button was stuck down, and I could not get it unstuck.

I was unable to reproduce the problem by pausing the game with the menu button: Pressing right, pressing and releasing menu to pause, releasing right, and pressing and releasing menu again to exit the menu would correctly stop the keyRepeatTimer and I could continue playing normally.

Since I see no code in the game that would explicitly do that (there is no gameWillPause or gameWillResume), I conclude that the OS automatically does it, by (as I experimentally verified afterward) synthesizing a rightButtonUp() call when the menu is closed.

So, there appears to be a bug in the OS (1.13.7) in that the “low battery” popup does not synthesize ButtonUp calls, as the menu does. It is obviously a bit inconvenient to reproduce, since you need to run down the battery to 10%, but I imagine it should not be hard to verify in the code.

Hi Christian! What version of the OS you were running when you saw this? You can check your current version by going to Settings > System > Device Info.

1.13.7, as mentioned.

Oh so you did, sorry about that!

I haven't had luck reproducing this yet, but I have filed an issue so we will look into it further! Thank you for the bug report.

OK, I’ll see if I can reproduce it with a minimal application, when I have time. I have saved that effort up to now in case it would be obvious. Thanks for checking!

I’ve just gotten my battery down to 10% and now I can’t reproduce the problem anymore, neither with Rainblocks nor with my own program. In my own program, I can confirm that I do get the playdate.rightButtonUp() call I thought was missing when the “10% Battery” popup closes. (And, for that matter, also the playdate.gameWillPause() I would expect, so the documentation that states that this only happens when the menu button is pushed is inaccurate.) So I don’t know what glitch it was that caused my original observation – maybe a race condition when the button is pressed or released at the exact moment the popup appears, or something hard to reproduce like that. You can probably close the issue.

Thanks for the follow-up! That sounds like what I was seeing in my tests too. I'll close the issue for now but will keep an eye out for weird behavior around this in the future!