merged conflicts

This commit is contained in:
Fenoglio 2018-07-08 13:44:57 +02:00
commit 0e83e04035
2 changed files with 24 additions and 12 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 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_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 1000 // 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 MIN_DELAY_BETWEEN_SEND_MS 1000 // 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_IN 4 // start button
#define STARTBUTTON_PRESSED LOW #define STARTBUTTON_PRESSED LOW
@ -95,5 +96,3 @@ void update_statemessage(timer_state_e timer_state);
void failSequence(void); void failSequence(void);
void wait(unsigned long ms); void wait(unsigned long ms);
#endif #endif

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 ... 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 ... 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 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; boolean topbuttonwaspressed = false;
timer_state_e timer_state = TIMER_WAIT; // timer needs to be initialized ... 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 ... 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 ... // read data from TOP_STATION ...
if( radio.available()){ if( radio.available()){
// check if radio data is available - if so read the data // check if radio data is available - if so read the data
connection_established = millis();
while( radio.available(&pipeNo)){ // Read all available payloads while( radio.available(&pipeNo)){ // Read all available payloads
radio.read( &radio_data, sizeof(radio_data) ); // Read the data the TOPSTATION sent 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.println(current_time_offset);
Serial.print(F(" Button was pressed last time on client in millis: ")); Serial.print(F(" Button was pressed last time on client in millis: "));
Serial.println(radio_data.topbuttonpressedtime); Serial.println(radio_data.topbuttonpressedtime);
} }
// offset calculation ... only needed if the variation is bigger than allowed or not enough values available already ... // offset calculation ... only needed if the variation is bigger than allowed or not enough values available already ...
@ -475,9 +477,20 @@ void update_screen(timer_state_e state){
display.setLetterSpacing(1); display.setLetterSpacing(1);
display.setCursor(64 - (display.strWidth(header_to_char) / 2), 0); display.setCursor(64 - (display.strWidth(header_to_char) / 2), 0);
display.print(header_to_char); display.print(header_to_char);
display.setCursor(1,0);
//check if there is a connection to the topstation
if(millis() - connection_established >= CONN_TIMEOUT || connection_established == 0){
//if not remove the "Y"
display.print(" ");
}
else {
//if print the "Y"
display.print("Y");
}
display.setCursor(0,1); display.setCursor(0,1);
display.setLetterSpacing(0); display.setLetterSpacing(0);
display.print("----------------------------"); display.print("----------------------------");
//end of the Header //end of the Header
//display.setLetterSpacing(1); //display.setLetterSpacing(1);
display.set2X(); display.set2X();