Fixed some stopp issues
This commit is contained in:
parent
a49f0f7d52
commit
c6cad0bd1d
1 changed files with 15 additions and 5 deletions
|
@ -287,14 +287,17 @@ void loop(void) {
|
||||||
if(digitalRead(CANCELBUTTON_IN) == CANCELBUTTON_PRESSED){
|
if(digitalRead(CANCELBUTTON_IN) == CANCELBUTTON_PRESSED){
|
||||||
timer_new_state = TIMER_CANCELLED;
|
timer_new_state = TIMER_CANCELLED;
|
||||||
}
|
}
|
||||||
|
Serial.println(radio_data.topbuttonpressedtime);
|
||||||
|
if(radio_data.topbuttonpressedtime > running_time_offset){
|
||||||
if((radio_data.topbuttonpressedtime - running_time_offset) > start_time){
|
if((radio_data.topbuttonpressedtime - running_time_offset) > start_time){
|
||||||
|
run_time = (radio_data.topbuttonpressedtime - running_time_offset) - start_time;
|
||||||
|
runner_run_time = runner_start_time - run_time;
|
||||||
timer_new_state = TIMER_STOPPED;
|
timer_new_state = TIMER_STOPPED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIMER_STOPPED:
|
case TIMER_STOPPED:
|
||||||
//calculate the run_time and switch to WAIT
|
//calculate the run_time and switch to WAIT
|
||||||
run_time = (radio_data.topbuttonpressedtime - running_time_offset) - start_time;
|
|
||||||
runner_run_time = runner_start_time - run_time;
|
|
||||||
delay(10);
|
delay(10);
|
||||||
if(digitalRead(CANCELBUTTON_IN) != CANCELBUTTON_PRESSED){
|
if(digitalRead(CANCELBUTTON_IN) != CANCELBUTTON_PRESSED){
|
||||||
timer_new_state = TIMER_WAIT;
|
timer_new_state = TIMER_WAIT;
|
||||||
|
@ -429,9 +432,16 @@ void update_screen(timer_state_e state){
|
||||||
break;
|
break;
|
||||||
case TIMER_STOPPED:
|
case TIMER_STOPPED:
|
||||||
header = "Stopped!";
|
header = "Stopped!";
|
||||||
|
curr_time_local = run_time/1000.000;
|
||||||
|
content = curr_time_local;
|
||||||
|
content += " sec";
|
||||||
|
curr_time_local = (runner_start_time - start_time)/1000.000;
|
||||||
|
footer = "Reaction time: ";
|
||||||
|
footer += curr_time_local;
|
||||||
|
footer += " sec";
|
||||||
break;
|
break;
|
||||||
case TIMER_TIMEDOUT:
|
case TIMER_TIMEDOUT:
|
||||||
header = "Time out!";
|
header = "Timed out!";
|
||||||
content = "Invalid!";
|
content = "Invalid!";
|
||||||
break;
|
break;
|
||||||
case TIMER_FAIL:
|
case TIMER_FAIL:
|
||||||
|
|
Reference in a new issue