optimisation: remove duplicate code

Sound_MakeCustom should play the sound
if critical = true OR the sound is not Silent

Change in memory:
Flash: -16 bytes
SRAM:  0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-02-11 11:14:13 +00:00 committed by DRracer
parent c826ae989f
commit 7799853a05
1 changed files with 3 additions and 18 deletions

View File

@ -65,27 +65,12 @@ Sound_SaveMode();
//if critical is true then silend and once mode is ignored
void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){
backlight_wake();
if (!critical){
if (eSoundMode != e_SOUND_MODE_SILENT){
if(!tone_){
WRITE(BEEPER, HIGH);
_delay(ms);
WRITE(BEEPER, LOW);
}
else{
_tone(BEEPER, tone_);
_delay(ms);
_noTone(BEEPER);
}
}
}
else{
if(!tone_){
if (critical || eSoundMode != e_SOUND_MODE_SILENT) {
if(!tone_) {
WRITE(BEEPER, HIGH);
_delay(ms);
WRITE(BEEPER, LOW);
}
else{
} else {
_tone(BEEPER, tone_);
_delay(ms);
_noTone(BEEPER);