summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2017-05-04 02:35:49 +0100
committerVasil Zlatanov <v@skozl.com>2017-05-04 02:35:49 +0100
commit042622fa1b8e6841ce8c3aa03a565c6ce6243ccb (patch)
tree289d6ee198ae809f509ccad14454a1346100dbbd /src/main.cpp
parent89e4d40bbb35b1786d9b7bd0e40aeb0ef50901a6 (diff)
downloade2-switch-042622fa1b8e6841ce8c3aa03a565c6ce6243ccb.tar.gz
e2-switch-042622fa1b8e6841ce8c3aa03a565c6ce6243ccb.tar.bz2
e2-switch-042622fa1b8e6841ce8c3aa03a565c6ce6243ccb.zip
Print switch status
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bd942f5..5163508 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -47,9 +47,10 @@ int main(void)
//Write the latest switch osciallor count
for (int i = 0; i < 3; ++i) {
- oled.printf("\n%05u ", switch_count[i]);
+ oled.printf("\nS:%u C:%05u", switch_pressed[i], switch_count[i]);
}
+
//Copy the display buffer to the display
oled.display();
@@ -71,9 +72,9 @@ void tout(void)
if (max_count[i] < switch_count[i])
max_count[i] = switch_count[i];
- if (switch_count[i] < (3/5)*max_count[i])
+ if (switch_count[i] < (3*max_count[i])/5)
switch_pressed[i] = 1;
- else if (switch_count[i] > (4/5)*max_count[i])
+ else if (switch_count[i] > (4*max_count[i])/5)
switch_pressed[i] = 0;
}
// Update display