diff --git a/speedclock.ino b/speedclock.ino index 1c8d2c3..9614a09 100644 --- a/speedclock.ino +++ b/speedclock.ino @@ -31,6 +31,7 @@ signed long runner_run_time = 0; // this is the time the runner rea unsigned long run_time = 0; // if the timer is running this is that start time ... boolean warn_during_run = false; // will be set to true if there is a warning during the run - usually an offset sync error + timer_state_e timer_state = TIMER_WAIT; // timer needs to be initialized ... timer_state_e timer_new_state = TIMER_INIT; // timer needs to be initialized ... @@ -346,7 +347,7 @@ void update_screen(timer_state_e state){ char content_to_char[50]; char footer_to_char[50]; - float curr_time_test = 0.0; + float curr_time_local = 0.0; switch(state){ case TIMER_INIT: @@ -361,8 +362,8 @@ void update_screen(timer_state_e state){ break; case TIMER_READY: header = "Ready!"; - content = "00:00"; - footer = "Press Startbuton to run ..."; + content = "00.00 sek."; + footer = "Waiting for start"; break; case TIMER_STARTED: header = "Starting ..."; @@ -371,9 +372,13 @@ void update_screen(timer_state_e state){ break; case TIMER_RUNNING: header = "Running ..."; - curr_time_test = (millis() - start_time)/1000.0; - content = curr_time_test; - footer = "sek."; + curr_time_local = (millis() - start_time)/1000.000; + content = curr_time_local; + content += " sek."; + curr_time_local = (runner_start_time - start_time)/1000.000; + footer = "started "; + footer += curr_time_local; + footer += " too late"; break; case TIMER_CANCELLED: header = "Cancelled!"; @@ -387,8 +392,9 @@ void update_screen(timer_state_e state){ break; case TIMER_FAIL: header = "False start!"; - content = runner_start_time - start_time; - footer = "milliseconds too early"; + curr_time_local = (start_time - runner_start_time)/1000.000; + content = curr_time_local; + footer = "seconds too early"; break; default: scr_update = false; @@ -427,13 +433,15 @@ void update_screen(timer_state_e state){ display.setLetterSpacing(0); display.print("----------------------------"); //end of the Header + //display.setLetterSpacing(1); display.set2X(); display.setCursor(64 - (display.strWidth(content_to_char) / 2), 3); display.print(content_to_char); //end of the Content display.set1X(); display.setCursor(0,6); - display.print("___________________________"); + display.setLetterSpacing(0); + display.print("----------------------------"); display.setCursor(64 - (display.strWidth(footer_to_char) / 2), 7); display.print(footer_to_char); }