Stefan Schuermans commited on 2012-04-05 21:59:29
Showing 1 changed files, with 4 additions and 5 deletions.
... | ... |
@@ -7,7 +7,7 @@ |
7 | 7 |
#include "switches.h" |
8 | 8 |
|
9 | 9 |
/// last value of rotary knob |
10 |
-static unsigned int menu_cur_rot_val = 0; |
|
10 |
+static int menu_cur_rot_cnt = 0; |
|
11 | 11 |
|
12 | 12 |
/// current screen |
13 | 13 |
static int menu_cur_screen = 0; |
... | ... |
@@ -152,10 +152,9 @@ void menu_init(void) |
152 | 152 |
void menu_task(void) |
153 | 153 |
{ |
154 | 154 |
// get new screen to show |
155 |
- unsigned int new_rot_cnt = switches_get_rot_cnt(); |
|
156 |
- unsigned int new_rot_val = (new_rot_cnt + 2) / 4; // 1 click is 4 steps |
|
157 |
- int delta = new_rot_val - menu_cur_rot_val; |
|
158 |
- menu_cur_rot_val = new_rot_val; |
|
155 |
+ int new_rot_cnt = switches_get_rot_cnt(); |
|
156 |
+ int delta = (new_rot_cnt - menu_cur_rot_cnt) / 4; // 1 click is 4 steps |
|
157 |
+ menu_cur_rot_cnt += delta * 4; |
|
159 | 158 |
int new_screen = menu_cur_screen + delta; |
160 | 159 |
if (new_screen < 0) |
161 | 160 |
new_screen = count(menu_screens) - (-new_screen % count(menu_screens)); |
162 | 161 |