Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 14867) +++ apps/debug_menu.c (working copy) @@ -87,6 +87,7 @@ #include "ds2411.h" #endif #include "hwcompat.h" +#include "button.h" #if defined(HAVE_DIRCACHE) || defined(HAVE_TAGCACHE) || CONFIG_TUNER #define MAX_DEBUG_MESSAGES 16 @@ -2241,6 +2242,59 @@ } #endif +#if (defined(HAVE_SCROLLWHEEL) && (CONFIG_KEYPAD==IPOD_4G_PAD)) +extern bool wheel_is_touched; +extern int old_wheel_value; +extern int new_wheel_value; +extern int wheel_delta; +extern int accumulated_wheel_delta; +extern long wheel_velocity; +static bool dgb_scrollwheel(void) +{ + char buf[64]; + unsigned int config = global_settings.wheel_accel_start; + unsigned int speed; + + lcd_setmargins(0, 0); + lcd_setfont(FONT_SYSFIXED); + + while (1) + { + if (action_userabort(HZ/10)) + return false; + + lcd_clear_display(); + + /* show internal variables of scrollwheel driver */ + snprintf(buf, sizeof(buf), "wheel touched: %s", (wheel_is_touched) ? "true" : "false"); + lcd_puts(0, 0, buf); + snprintf(buf, sizeof(buf), "new position: %2d", new_wheel_value); + lcd_puts(0, 1, buf); + snprintf(buf, sizeof(buf), "old position: %2d", old_wheel_value); + lcd_puts(0, 2, buf); + snprintf(buf, sizeof(buf), "wheel delta: %2d", wheel_delta); + lcd_puts(0, 3, buf); + snprintf(buf, sizeof(buf), "accumulated delta: %2d", accumulated_wheel_delta); + lcd_puts(0, 4, buf); + snprintf(buf, sizeof(buf), "velo [deg/s]: %4d", (int)wheel_velocity); + lcd_puts(0, 5, buf); + + /* show effective scrollspeed for 3 different acceleration configurations */ + speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity, config, 1); + snprintf(buf, sizeof(buf), "speed at v^2: %4d", speed); + lcd_puts(0, 7, buf); + speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity, config, 2); + snprintf(buf, sizeof(buf), "speed at v^3: %4d", speed); + lcd_puts(0, 8, buf); + speed = button_apply_acceleration( (1<<31)|(1<<24)|wheel_velocity, config, 3); + snprintf(buf, sizeof(buf), "speed at v^4: %4d", speed); + lcd_puts(0, 9, buf); + + lcd_update(); + } + return false; +} +#endif /****** The menu *********/ @@ -2313,6 +2367,9 @@ #ifdef CPU_BOOST_LOGGING {"cpu_boost log",cpu_boost_log}, #endif +#ifdef HAVE_SCROLLWHEEL + {"Debug scrollwheel", dgb_scrollwheel}, +#endif }; static int menu_action_callback(int btn, struct action_callback_info *info) {