From 042622fa1b8e6841ce8c3aa03a565c6ce6243ccb Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Thu, 4 May 2017 02:35:49 +0100 Subject: Print switch status --- src/main.cpp | 7 ++++--- 1 file 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 -- cgit v1.2.3-54-g00ecf