diff --git a/examples/companion_radio/UITask.cpp b/examples/companion_radio/UITask.cpp index 7a031b76..7d0fb613 100644 --- a/examples/companion_radio/UITask.cpp +++ b/examples/companion_radio/UITask.cpp @@ -59,12 +59,23 @@ void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs, const char* bu #endif } -void UITask::soundBuzzer() { +void UITask::soundBuzzer(buzzerEventType bet) { #if defined(PIN_BUZZER) - // gemini's pick - buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); - //Serial.println("DBG: Buzzzzzz"); +switch(bet){ + case buzzerEventType::contactMessage: + // gemini's pick + buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); + break; + case buzzerEventType::channelMessage: + case buzzerEventType::roomMessage: + case buzzerEventType::newContactMessage: + case buzzerEventType::noBuzzer: + default: + break; +} #endif + Serial.print("DBG: Buzzzzzz -> "); + Serial.println((int) bet); } void UITask::msgRead(int msgcount) { diff --git a/examples/companion_radio/UITask.h b/examples/companion_radio/UITask.h index 30374145..02125e6f 100644 --- a/examples/companion_radio/UITask.h +++ b/examples/companion_radio/UITask.h @@ -44,6 +44,6 @@ public: void clearMsgPreview(); void msgRead(int msgcount); void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount); - void soundBuzzer(); + void soundBuzzer(buzzerEventType bet = buzzerEventType::noBuzzer); void loop(); }; diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index c71fcd81..14676ad8 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -520,7 +520,7 @@ protected: } } else { #ifdef DISPLAY_CLASS - ui_task.soundBuzzer(); + ui_task.soundBuzzer(buzzerEventType::newContactMessage); #endif } @@ -583,7 +583,7 @@ protected: _serial->writeFrame(frame, 1); } else { #ifdef DISPLAY_CLASS - ui_task.soundBuzzer(); + ui_task.soundBuzzer(buzzerEventType::contactMessage); #endif } #ifdef DISPLAY_CLASS diff --git a/src/helpers/ui/buzzer.h b/src/helpers/ui/buzzer.h index 9f3f3fd3..aa3e418c 100644 --- a/src/helpers/ui/buzzer.h +++ b/src/helpers/ui/buzzer.h @@ -15,6 +15,16 @@ - make message ring tone configurable */ + +enum class buzzerEventType +{ + noBuzzer, + contactMessage, + channelMessage, + roomMessage, + newContactMessage +}; + class genericBuzzer { public: