This commit is contained in:
CodeCrafter912 2018-07-08 00:04:47 +02:00
commit a610358e22
2 changed files with 15 additions and 4 deletions

View File

@ -93,6 +93,7 @@ void set_state_LEDs(timer_state_e state, boolean warn);
void startSequence(void);
void update_statemessage(timer_state_e timer_state);
void failSequence(void);
void wait(unsigned long ms);
#endif

View File

@ -467,25 +467,25 @@ void startSequence(void)
// this is sequence of usually three tones after a wait time 1sec , in between the tones there is also a delay of 1 sec. Each tone is 200ms seconds long, except the last
update_statemessage(timer_new_state);
if(timer_new_state == TIMER_RUNNING){
delay(STARTSEQ_STARTPAUSE_MS);
wait(STARTSEQ_STARTPAUSE_MS);
}
// first tone
update_statemessage(timer_new_state);
if(timer_new_state == TIMER_RUNNING){
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
delay(STARTSEQ_TONEPAUSE_MS);
wait(STARTSEQ_TONEPAUSE_MS);
}
//second tone
update_statemessage(timer_new_state);
if(timer_new_state == TIMER_RUNNING){
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
delay(STARTSEQ_TONEPAUSE_MS);
wait(STARTSEQ_TONEPAUSE_MS);
}
//third tone
update_statemessage(timer_new_state);
if(timer_new_state == TIMER_RUNNING){
tone(PIEZO_PIN, STARTSEQ_TON_3_FREQUENCY,STARTSEQ_TON_3_LENGTH_MS );
delay(STARTSEQ_TON_3_LENGTH_MS);
wait(STARTSEQ_TON_3_LENGTH_MS);
}
}
@ -519,3 +519,13 @@ void false_start_isr(void)
}
}
}
void wait(unsigned long ms){
unsigned long current = 0;
unsigned long started = millis();
do{
current = millis()-started;
}while(current < ms);
}