FS#6787 - Button filter

Attached to Project: Rockbox
Opened by Nicolas GIF (salokyn) - Saturday, 10 March 2007, 16:01 GMT
Last edited by Alex Parker (BigBambi) - Saturday, 05 June 2010, 23:01 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


Here is a /firmware/target/coldfire/iaudio/x5/button-x5.c containing my button filter I made for my X5.
It consists in storing button data in an array (each new value erase the older one). The average of the values is validated if the difference between the lower and the higher values is not too big.
I think it can be ported to any Jukebox and the filter strength can be configurable.
This task depends upon

Closed by  Alex Parker (BigBambi)
Saturday, 05 June 2010, 23:01 GMT
Reason for closing:  Fixed
Comment by Nicolas GIF (salokyn) - Friday, 23 March 2007, 08:29 GMT
Well, this patch is full of bugs (I forgave that value > 0x80 can be negative !!), and a bit too complicated !! So foreget it for now.

I began to write another one still working with an array in oder to configure the filter strength (by modifying the array size). And if I can, maybe I could add a new entry in the settings menu.
Comment by Nicolas GIF (salokyn) - Sunday, 25 March 2007, 09:09 GMT
Finally I just changed button-x5.c (should work on M5 without changes)
Comment by Nicolas GIF (salokyn) - Sunday, 25 March 2007, 09:24 GMT
Removed abs()
Comment by Nicolas GIF (salokyn) - Sunday, 25 March 2007, 11:34 GMT
Removed last_valid trick that makes more problems than it solves.
Comment by Rani Hod (RaeNye) - Sunday, 05 August 2007, 13:38 GMT
What is the purpose of this patch?
(what problem does it solve?)
Comment by Nicolas GIF (salokyn) - Friday, 21 September 2007, 12:02 GMT
Well, the joystick of X5 players is not stable. When you push it in one direction, the "keycode" that hardware returns may be varying that much that Rockbox can understand another direction. Then the solution is to make a filter to reduce bounce.

The patch as still a problem : what to return when keypress in not validated by filter ? Nothing or the last valid keypress ? Both in fact depending of the context. I have to watch for it.