FS#11675 - Resistor plugin - led resistor calculator does not wait for keypress

Attached to Project: Rockbox
Opened by Michael Chicoine (mc2739) - Thursday, 14 October 2010, 04:06 GMT
Last edited by Boris Gjenero (dreamlayers) - Friday, 02 December 2011, 02:04 GMT
Task Type Bugs
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



Fails on device and sim (e200v1 and e200v2)

1. start the resistor plugin
2. select "LED resistor calculator"
3. select "2v (Common red, orange)"
4. select "20mA - Most common..."
5. use the virtual keyboard to input a supply voltage - I used "5"

After leaving the virtual keyboard, a resistor image is drawn and plugin immediately returns to menu.

At this point, the scrollwheel does not work until button is pressed. The button is ignored and the scrollwheel starts to work. This scrollwheel/button behavior has been previously documented in several other Flyspray tasks: FS#8816,  FS#10097 , FS#10883 (and others)
This task depends upon

Closed by  Boris Gjenero (dreamlayers)
Friday, 02 December 2011, 02:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in r31107
Comment by Matteo Italia (MItaly) - Saturday, 30 October 2010, 12:16 GMT
I created a duplicated of this entry because by error (
Anyhow, I post here too the patch I posted there (since this is the "real" entry for this bug), it should fix the problem by waiting 200 msec (to let the user release the button) and flushing the input buffer before waiting for keypress to exit.
Comment by Matteo Italia (MItaly) - Saturday, 30 October 2010, 12:16 GMT
s/because by/by/ :S
Comment by Calvin Walden (clone4crw) - Sunday, 07 November 2010, 15:41 GMT
It's still a problem in the 3.7 release. This really ought to be committed.
Comment by Frank Gevaerts (fg) - Sunday, 07 November 2010, 15:46 GMT
I don't think clearing the queue all the time is a good idea. This patch looks more like a workaround than a fix to me.
Comment by Matteo Italia (MItaly) - Sunday, 07 November 2010, 17:21 GMT
I can't think about a better solution, if the key remains pressed even for a very small time after the virtual keyboard is closed, the keypress will remain in the queue; since the resistor screen waits for any keypress to exit, if the queue isn't emptied it will close immediately.
(Disclaimer: I don't know exactly how the RockBox input queue is designed, I'm just guessing :-) )
Comment by Alex vanHeuvelen (alexvh) - Thursday, 04 August 2011, 04:48 GMT
The problem occurs when inputing a value from the keyboard as the last step, so I switched the order of the inputs. This seems to fix the problem.
Comment by Boris Gjenero (dreamlayers) - Thursday, 01 December 2011, 05:11 GMT
This also happens on the 5G iPod and sim. At that point in the sim, button_press is 0x02000040, meaning BUTTON_REL | BUTTON_PLAY. The text entry screen exits when the play button is pressed, and the resistor display exits when the play button is released. Simply holding the button doesn't work as a workaround, probably because longer presses get interpreted differently. It's easy to ignore the release with a while loop. I'm attaching a simple patch. It fixes the problem on the 5G iPod and its sim.
Comment by Michael Chicoine (mc2739) - Thursday, 01 December 2011, 12:52 GMT

Your patch works fine for me on e200