diff options
-rw-r--r-- | firmware/target/arm/as3525/dbop-as3525.c | 40 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 13 |
2 files changed, 52 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/dbop-as3525.c b/firmware/target/arm/as3525/dbop-as3525.c index 5ca551ca70..66202b70b7 100644 --- a/firmware/target/arm/as3525/dbop-as3525.c +++ b/firmware/target/arm/as3525/dbop-as3525.c | |||
@@ -34,9 +34,49 @@ | |||
34 | /* doesn't work with the new ams sansas so far and is not needed */ | 34 | /* doesn't work with the new ams sansas so far and is not needed */ |
35 | static short int dbop_input_value = 0; | 35 | static short int dbop_input_value = 0; |
36 | 36 | ||
37 | #if defined(SANSA_C200V2) | ||
38 | /* | ||
39 | * workaround DBOP noise issue cause it's really annoying if your | ||
40 | * buttons don't work in the debug menu... | ||
41 | */ | ||
42 | static short int input_value_tmp[2]; | ||
43 | int dbop_denoise_reject = 0; | ||
44 | int dbop_denoise_accept = 0; | ||
45 | #endif | ||
46 | |||
37 | /* read the DBOP data pins */ | 47 | /* read the DBOP data pins */ |
48 | #if defined(SANSA_C200V2) | ||
49 | unsigned short dbop_read_input_once(void); | ||
50 | |||
38 | unsigned short dbop_read_input(void) | 51 | unsigned short dbop_read_input(void) |
39 | { | 52 | { |
53 | int i; | ||
54 | |||
55 | while (1) { | ||
56 | for (i=0; i<2; i++) { | ||
57 | input_value_tmp[i] = dbop_read_input_once(); | ||
58 | } | ||
59 | /* noise rejection */ | ||
60 | if (input_value_tmp[0] == input_value_tmp[1]) { | ||
61 | dbop_denoise_accept++; | ||
62 | break; | ||
63 | } else { | ||
64 | dbop_denoise_reject++; | ||
65 | } | ||
66 | } | ||
67 | if (dbop_denoise_accept + dbop_denoise_reject > 1000) { | ||
68 | dbop_denoise_accept /= 2; | ||
69 | dbop_denoise_reject /= 2; | ||
70 | } | ||
71 | |||
72 | return dbop_input_value; | ||
73 | } | ||
74 | |||
75 | unsigned short dbop_read_input_once(void) | ||
76 | #else | ||
77 | unsigned short dbop_read_input(void) | ||
78 | #endif | ||
79 | { | ||
40 | unsigned int dbop_ctrl_old = DBOP_CTRL; | 80 | unsigned int dbop_ctrl_old = DBOP_CTRL; |
41 | unsigned int dbop_timpol23_old = DBOP_TIMPOL_23; | 81 | unsigned int dbop_timpol23_old = DBOP_TIMPOL_23; |
42 | 82 | ||
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 06c22c027c..cfd7c37b16 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -257,12 +257,23 @@ bool __dbg_hw_info(void) | |||
257 | while(1) | 257 | while(1) |
258 | { | 258 | { |
259 | #ifdef SANSA_C200V2 | 259 | #ifdef SANSA_C200V2 |
260 | extern int dbop_denoise_accept; | ||
261 | extern int dbop_denoise_reject; | ||
262 | |||
260 | lcd_clear_display(); | 263 | lcd_clear_display(); |
261 | line = 0; | 264 | line = 0; |
262 | lcd_puts(0, line++, "[Submodel:]"); | 265 | lcd_puts(0, line++, "[Submodel:]"); |
263 | lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); | 266 | lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant); |
267 | if (dbop_denoise_accept) { | ||
268 | lcd_putsf(0, line++, "DBOP noise: %d%%", | ||
269 | (100*dbop_denoise_reject)/dbop_denoise_accept); | ||
270 | } else { | ||
271 | lcd_puts(0, line++, "DBOP noise: oo"); | ||
272 | } | ||
273 | lcd_putsf(0, line++, "reject: %d", dbop_denoise_reject); | ||
274 | lcd_putsf(0, line++, "accept: %d", dbop_denoise_accept); | ||
264 | lcd_update(); | 275 | lcd_update(); |
265 | int btn = button_get(1); | 276 | int btn = button_get_w_tmo(HZ/10); |
266 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | 277 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) |
267 | goto end; | 278 | goto end; |
268 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | 279 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) |