Modified Tone and ISR
This commit is contained in:
parent
0414b7d938
commit
5389049a1f
1 changed files with 6 additions and 4 deletions
|
@ -401,16 +401,17 @@ void startSequence(void)
|
||||||
// first tone
|
// first tone
|
||||||
if(timer_new_state == TIMER_RUNNING){
|
if(timer_new_state == TIMER_RUNNING){
|
||||||
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
|
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
|
||||||
delay(STARTSEQ_TONEPAUSE_MS);
|
delay(STARTSEQ_TONEPAUSE_MS + STARTSEQ_TON_1_2_LENGTH_MS);
|
||||||
}
|
}
|
||||||
//second tone
|
//second tone
|
||||||
if(timer_new_state == TIMER_RUNNING){
|
if(timer_new_state == TIMER_RUNNING){
|
||||||
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
|
tone(PIEZO_PIN, STARTSEQ_TON_1_2_FREQUENCY,STARTSEQ_TON_1_2_LENGTH_MS );
|
||||||
delay(STARTSEQ_TONEPAUSE_MS);
|
delay(STARTSEQ_TONEPAUSE_MS + STARTSEQ_TON_1_2_LENGTH_MS );
|
||||||
}
|
}
|
||||||
//third tone
|
//third tone
|
||||||
if(timer_new_state == TIMER_RUNNING){
|
if(timer_new_state == TIMER_RUNNING){
|
||||||
tone(PIEZO_PIN, STARTSEQ_TON_3_FREQUENCY,STARTSEQ_TON_3_LENGTH_MS );
|
tone(PIEZO_PIN, STARTSEQ_TON_3_FREQUENCY,STARTSEQ_TON_3_LENGTH_MS );
|
||||||
|
delay(STARTSEQ_TON_3_LENGTH_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,12 +432,13 @@ void false_start_isr(void)
|
||||||
// this will save the time when the runner is really started
|
// this will save the time when the runner is really started
|
||||||
Serial.println("** Interrupt service routine started: false_start_ISR **");
|
Serial.println("** Interrupt service routine started: false_start_ISR **");
|
||||||
runner_start_time = millis();
|
runner_start_time = millis();
|
||||||
if(timer_state == TIMER_STARTED & timer_new_state == TIMER_STARTED){
|
if(timer_state == TIMER_STARTED){
|
||||||
|
Serial.println("** Interrupt service routine set timer_new_state to TIMER_FAIL **");
|
||||||
timer_new_state = TIMER_FAIL;
|
timer_new_state = TIMER_FAIL;
|
||||||
detachInterrupt(digitalPinToInterrupt(FAILSTARTBUTTON_IN));
|
detachInterrupt(digitalPinToInterrupt(FAILSTARTBUTTON_IN));
|
||||||
noTone(PIEZO_PIN);
|
noTone(PIEZO_PIN);
|
||||||
} else {
|
} else {
|
||||||
if(timer_state == TIMER_RUNNING | timer_new_state == TIMER_RUNNING ){
|
if(timer_state == TIMER_RUNNING){
|
||||||
// disable this interrupt;
|
// disable this interrupt;
|
||||||
detachInterrupt(digitalPinToInterrupt(FAILSTARTBUTTON_IN));
|
detachInterrupt(digitalPinToInterrupt(FAILSTARTBUTTON_IN));
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue