updates to the display

This commit is contained in:
CodeCrafter912 2018-07-07 22:00:53 +02:00
parent 3e3d04a755
commit bf2176ed83
1 changed files with 16 additions and 4 deletions

View File

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