added connection Indication to the display header

This commit is contained in:
CodeCrafter912 2018-07-08 10:20:54 +02:00
parent c6cad0bd1d
commit 3d76b56598
2 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,7 @@ typedef struct transcv_struct{
#define STOPBUTTON_PRESSED LOW // this the signal level the top button will be at as soon as pressed
#define MIN_DELAY_BETWEEN_PRESSED_MS 1000 // this defines the time in milliseconds before the button is expected to be pressed again. We do this to avaoid keybouncing
#define MIN_DELAY_BETWEEN_SEND_MS 100 // this defines the time in milliseconds before the next set of data will be send to the base station - except the button was pressed.
#define CONN_TIMEOUT 10000
#define STARTBUTTON_IN 4 // start button
#define STARTBUTTON_PRESSED LOW

View File

@ -30,9 +30,11 @@ unsigned long runner_start_time = 0; // this is the time the runner lef
signed long runner_run_time = 0; // this is the time the runner really needed or the time started to early - depending on sign ...
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
unsigned long connection_established = 0;
boolean topbuttonwaspressed = false;
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 ...
@ -170,6 +172,7 @@ void loop(void) {
// read data from TOP_STATION ...
if( radio.available()){
// check if radio data is available - if so read the data
connection_established = millis();
while( radio.available(&pipeNo)){ // Read all available payloads
radio.read( &radio_data, sizeof(radio_data) ); // Read the data the TOPSTATION sent
}
@ -182,7 +185,6 @@ void loop(void) {
Serial.println(current_time_offset);
Serial.print(F(" Button was pressed last time on client in millis: "));
Serial.println(radio_data.topbuttonpressedtime);
}
// offset calculation ... only needed if the variation is bigger than allowed or not enough values available already ...
@ -475,9 +477,17 @@ void update_screen(timer_state_e state){
display.setLetterSpacing(1);
display.setCursor(64 - (display.strWidth(header_to_char) / 2), 0);
display.print(header_to_char);
display.setCursor(1,0);
if(millis() - connection_established >= CONN_TIMEOUT || connection_established == 0){
display.print(" ");
}
else {
display.print("Y");
}
display.setCursor(0,1);
display.setLetterSpacing(0);
display.print("----------------------------");
//end of the Header
//display.setLetterSpacing(1);
display.set2X();