summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2017-05-04 13:11:35 +0100
committerVasil Zlatanov <v@skozl.com>2017-05-04 13:11:35 +0100
commitef7a7f41583126f9d6010747a4d58637ce1de23e (patch)
tree28501e38864656e26471d2e3fe5c52094cc6b483
parent023907a7e67c01e4b2d263b57377c55f3101aec7 (diff)
downloade2-switch-ef7a7f41583126f9d6010747a4d58637ce1de23e.tar.gz
e2-switch-ef7a7f41583126f9d6010747a4d58637ce1de23e.tar.bz2
e2-switch-ef7a7f41583126f9d6010747a4d58637ce1de23e.zip
Hardcode boundaries
-rw-r--r--src/main.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8deca7b..5520a8e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,7 +23,6 @@ volatile uint16_t last_pressed[4] = { 0, 0, 0, 0 };
uint16_t current_f[4] = { 0, 0, 0, 0 };
volatile uint16_t update = 0;
-uint16_t max_count[4];
// Initialise display
SPInit gSpi(D_MOSI_PIN, NC, D_CLK_PIN);
@@ -84,12 +83,9 @@ void tout(void)
last_pressed[i] = switch_pressed[i];
- if (max_count[i] < switch_count[i])
- max_count[i] = switch_count[i];
-
- if (switch_count[i] < (3*max_count[i])/5)
+ if (switch_count[i] < 600)
switch_pressed[i] = 1;
- else if (switch_count[i] > (4*max_count[i])/5)
+ else if (switch_count[i] > 700)
switch_pressed[i] = 0;
}
// Update display