summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-19 17:34:12 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-19 17:34:12 +0000
commit0b28594036f0350bd2e9d3074a8284b38e36fadd (patch)
treefee3f199277263b68b43e92e7eed207698f29252 /firmware
parent9c774b3849b397345040fa064081368e17ed663e (diff)
downloadrockbox-0b28594036f0350bd2e9d3074a8284b38e36fadd.tar.gz
rockbox-0b28594036f0350bd2e9d3074a8284b38e36fadd.zip
Revert r26060. A better fix was found. The acceleration should be fixed once for all now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26175 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config/sansafuzev2.h2
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c23
2 files changed, 11 insertions, 14 deletions
diff --git a/firmware/export/config/sansafuzev2.h b/firmware/export/config/sansafuzev2.h
index 8b2ffb3d93..a21eb34f94 100644
--- a/firmware/export/config/sansafuzev2.h
+++ b/firmware/export/config/sansafuzev2.h
@@ -73,7 +73,7 @@
73/* define to activate advanced wheel acceleration code */ 73/* define to activate advanced wheel acceleration code */
74#define HAVE_WHEEL_ACCELERATION 74#define HAVE_WHEEL_ACCELERATION
75/* define from which rotation speed [degree/sec] on the acceleration starts */ 75/* define from which rotation speed [degree/sec] on the acceleration starts */
76#define WHEEL_ACCEL_START 540 76#define WHEEL_ACCEL_START 720
77/* define type of acceleration (1 = ^2, 2 = ^3, 3 = ^4) */ 77/* define type of acceleration (1 = ^2, 2 = ^3, 3 = ^4) */
78#define WHEEL_ACCELERATION 1 78#define WHEEL_ACCELERATION 1
79 79
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index f454867cfc..060933d0ac 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -34,7 +34,6 @@ static bool hold_button = false;
34#define TIMER_TICK (KERNEL_TIMER_FREQ/HZ)/* how long a tick lasts */ 34#define TIMER_TICK (KERNEL_TIMER_FREQ/HZ)/* how long a tick lasts */
35#define TIMER_MS (TIMER_TICK/(1000/HZ))/* how long a ms lasts */ 35#define TIMER_MS (TIMER_TICK/(1000/HZ))/* how long a ms lasts */
36 36
37#define WHEEL_LOOP_INTERVAL ( 3*TIMER_MS) /* 3 ms */
38#define WHEEL_REPEAT_INTERVAL (300*TIMER_MS) /* 300ms */ 37#define WHEEL_REPEAT_INTERVAL (300*TIMER_MS) /* 300ms */
39#define WHEEL_FAST_ON_INTERVAL ( 20*TIMER_MS) /* 20ms */ 38#define WHEEL_FAST_ON_INTERVAL ( 20*TIMER_MS) /* 20ms */
40#define WHEEL_FAST_OFF_INTERVAL ( 60*TIMER_MS) /* 60ms */ 39#define WHEEL_FAST_OFF_INTERVAL ( 60*TIMER_MS) /* 60ms */
@@ -77,18 +76,6 @@ static void scrollwheel(unsigned int wheel_value)
77 { 1, 3, 0, 2 }, /* Counter-clockwise */ 76 { 1, 3, 0, 2 }, /* Counter-clockwise */
78 }; 77 };
79 78
80 int repeat = 1; /* assume repeat */
81 long time = TIMER2_VALUE + current_tick*TIMER_TICK; /* to timer unit */
82 long v = (time - last_wheel_post);
83 if (v < WHEEL_LOOP_INTERVAL) /* avoid too frequent updates */
84 return ;
85
86 /* interpolate velocity in timer_freq/timer_unit == 1/s */
87 if (v) v = TIMER_FREQ / v;
88
89 /* accumulate velocities over time with each v */
90 wheel_velocity = (7*wheel_velocity + v) / 8;
91
92 unsigned int btn = BUTTON_NONE; 79 unsigned int btn = BUTTON_NONE;
93 80
94 if (old_wheel_value == wheel_tbl[0][wheel_value]) 81 if (old_wheel_value == wheel_tbl[0][wheel_value])
@@ -102,6 +89,16 @@ static void scrollwheel(unsigned int wheel_value)
102 return; 89 return;
103 } 90 }
104 91
92 int repeat = 1; /* assume repeat */
93 long time = (TIMER_TICK - TIMER2_VALUE) + current_tick*TIMER_TICK; /* to timer unit */
94 long v = (time - last_wheel_post);
95
96 /* interpolate velocity in timer_freq/timer_unit == 1/s */
97 if (v) v = TIMER_FREQ / v;
98
99 /* accumulate velocities over time with each v */
100 wheel_velocity = (7*wheel_velocity + v) / 8;
101
105 if (btn != wheel_repeat) 102 if (btn != wheel_repeat)
106 { 103 {
107 /* direction reversals nullify all fast mode states */ 104 /* direction reversals nullify all fast mode states */