FS#10151 - e200v2: scrollwheel acceleration by Dustin Skoracki. Improves the scroll wheel acceleration on the e200v2 mainly by not decrementing the counter which which causes the acceleration if a wheel read was missed due to lcd operation.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20822 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-04-29 20:50:12 +00:00
parent 0a1baa36b1
commit 3c5e67516b

View file

@ -32,8 +32,11 @@ static bool hold_button = false;
static bool hold_button_old = false;
#endif
static unsigned short _dbop_din = 0;
/* read_missed is true if buttons could not
* be read (see lcd_button_support) */
static bool read_missed = false;
#define WHEEL_REPEAT_INTERVAL (HZ/5)
#define WHEEL_REPEAT_INTERVAL (HZ/4)
/* in the lcd driver */
extern bool lcd_button_support(void);
@ -108,10 +111,10 @@ static void scrollwheel(unsigned short dbop_din)
if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL))
{
btn |= BUTTON_REPEAT;
wheel_delta = repeat>>2;
wheel_delta = repeat>>1;
}
repeat += 2;
repeat += 3;
/* the wheel is more reliable if we don't send ever change,
* every 2th is basically one "physical click" is
* 1 item in the rockbox menus */
@ -125,7 +128,7 @@ static void scrollwheel(unsigned short dbop_din)
last_wheel_post = current_tick;
}
}
if (repeat > 0)
if (repeat > 0 && !read_missed)
repeat--;
old_wheel_value = wheel_value;
@ -136,8 +139,11 @@ unsigned short button_read_dbop(void)
{
/*write a red pixel */
if (!lcd_button_support())
return _dbop_din;
{
read_missed = true;
}
if (!read_missed)
{
/* Set up dbop for input */
while (!(DBOP_STAT & (1<<10))); /* Wait for fifo to empty */
DBOP_CTRL |= (1<<19); /* Tri-state DBOP on read cycle */
@ -155,9 +161,11 @@ unsigned short button_read_dbop(void)
DBOP_TIMPOL_23 = 0xa167e06f; /* Set Timing & Polarity regs 2 & 3 */
DBOP_CTRL |= (1<<16); /* Enable output (0:write disable) */
DBOP_CTRL &= ~(1<<19); /* Tri-state when no active write */
}
#if !defined(BOOTLOADER) && defined(HAVE_SCROLLWHEEL)
scrollwheel(_dbop_din);
#endif
read_missed = false;
return _dbop_din;
}