Index: firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c =================================================================== --- firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c (Revision 20747) +++ firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c (Arbeitskopie) @@ -32,6 +32,7 @@ static bool hold_button_old = false; #endif static short _dbop_din = 0; +static bool missed_read = false; #define WHEEL_REPEAT_INTERVAL (HZ/5) /* in the lcd driver */ @@ -108,10 +109,10 @@ 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 +126,7 @@ last_wheel_post = current_tick; } } - if (repeat > 0) + if (repeat > 0 && !missed_read) repeat--; old_wheel_value = wheel_value; @@ -135,26 +136,28 @@ short button_read_dbop(void) { /*write a red pixel */ - if (!lcd_button_support()) - return _dbop_din; + missed_read = !lcd_button_support(); - /* 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 */ - DBOP_CTRL &= ~(1<<16); /* disable output (1:write enabled) */ - DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */ - DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */ + if (!missed_read) + { + /* 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 */ + DBOP_CTRL &= ~(1<<16); /* disable output (1:write enabled) */ + DBOP_TIMPOL_01 = 0xe167e167; /* Set Timing & Polarity regs 0 & 1 */ + DBOP_TIMPOL_23 = 0xe167006e; /* Set Timing & Polarity regs 2 & 3 */ - DBOP_CTRL |= (1<<15); /* start read */ - while (!(DBOP_STAT & (1<<16))); /* wait for valid data */ + DBOP_CTRL |= (1<<15); /* start read */ + while (!(DBOP_STAT & (1<<16))); /* wait for valid data */ - _dbop_din = DBOP_DIN; /* Read dbop data*/ + _dbop_din = DBOP_DIN; /* Read dbop data*/ - /* Reset dbop for output */ - DBOP_TIMPOL_01 = 0x6e167; /* Set Timing & Polarity regs 0 & 1 */ - 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 */ + /* Reset dbop for output */ + DBOP_TIMPOL_01 = 0x6e167; /* Set Timing & Polarity regs 0 & 1 */ + 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 @@ -235,3 +238,4 @@ /* The int_btn variable is set in the button interrupt handler */ return btn; } +