updates to the display

This commit is contained in:
CodeCrafter912 2018-07-07 22:00:53 +02:00
parent 3e3d04a755
commit bf2176ed83

View file

@ -328,19 +328,28 @@ void update_screen(timer_state_e timer_state){
char content_to_char[50]; char content_to_char[50];
char footer_to_char[50]; char footer_to_char[50];
float curr_time_test = 0.0;
switch(timer_state){ switch(timer_state){
case TIMER_INIT: case TIMER_INIT:
header = "Init"; header = "Init";
content = "...";
footer = "please wait";
break; break;
case TIMER_READY: case TIMER_READY:
header = "Ready!"; header = "Ready!";
content = "00:00";
footer = "Waiting for climber";
break; break;
case TIMER_STARTED: case TIMER_STARTED:
header = "Started ..."; header = "Starting ...";
content = "00:00";
footer = "...";
break; break;
case TIMER_RUNNING: case TIMER_RUNNING:
header = "Running ..."; header = "Running ...";
content = millis() - start_time; curr_time_test = (millis() - start_time)/1000.0;
content = curr_time_test;
break; break;
case TIMER_CANCELLED: case TIMER_CANCELLED:
header = "Cancelled!"; header = "Cancelled!";
@ -358,7 +367,9 @@ void update_screen(timer_state_e timer_state){
scr_update = false; scr_update = false;
break; break;
} }
if(timer_new_state != timer_state){
display.clear();
}
if(scr_update == true){ if(scr_update == true){
//snprintf( string_to_char, sizeof(string_to_char),"%s", header); //snprintf( string_to_char, sizeof(string_to_char),"%s", header);
header.toCharArray(header_to_char, sizeof(header_to_char)); header.toCharArray(header_to_char, sizeof(header_to_char));
@ -385,7 +396,8 @@ void update_screen(timer_state_e timer_state){
display.set1X(); display.set1X();
display.setCursor(0,6); display.setCursor(0,6);
display.print("___________________________"); display.print("___________________________");
display.setCursor(64 - (display.strWidth(footer_to_char) / 2), 4); display.setCursor(64 - (display.strWidth(footer_to_char) / 2), 7);
display.print(footer_to_char);
} }
} }