fix location and naming of enum

This commit is contained in:
seagull9000
2025-05-20 19:33:21 +12:00
parent f82844f43f
commit 7507f889a5
5 changed files with 24 additions and 23 deletions

View File

@@ -59,23 +59,23 @@ void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs, const char* bu
#endif #endif
} }
void UITask::soundBuzzer(buzzerEventType bet) { void UITask::soundBuzzer(UIEventType bet) {
#if defined(PIN_BUZZER) #if defined(PIN_BUZZER)
switch(bet){ switch(bet){
case buzzerEventType::contactMessage: case UIEventType::contactMessage:
// gemini's pick // gemini's pick
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7");
break; break;
case buzzerEventType::channelMessage: case UIEventType::channelMessage:
case buzzerEventType::roomMessage: case UIEventType::roomMessage:
case buzzerEventType::newContactMessage: case UIEventType::newContactMessage:
case buzzerEventType::noBuzzer: case UIEventType::none:
default: default:
break; break;
} }
#endif #endif
Serial.print("DBG: Buzzzzzz -> "); // Serial.print("DBG: Buzzzzzz -> ");
Serial.println((int) bet); // Serial.println((int) bet);
} }
void UITask::msgRead(int msgcount) { void UITask::msgRead(int msgcount) {

View File

@@ -10,6 +10,15 @@
#include "NodePrefs.h" #include "NodePrefs.h"
enum class UIEventType
{
none,
contactMessage,
channelMessage,
roomMessage,
newContactMessage
};
class UITask { class UITask {
DisplayDriver* _display; DisplayDriver* _display;
mesh::MainBoard* _board; mesh::MainBoard* _board;
@@ -31,6 +40,7 @@ class UITask {
void userLedHandler(); void userLedHandler();
void renderBatteryIndicator(uint16_t batteryMilliVolts); void renderBatteryIndicator(uint16_t batteryMilliVolts);
public: public:
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) { UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
@@ -44,6 +54,6 @@ public:
void clearMsgPreview(); void clearMsgPreview();
void msgRead(int msgcount); void msgRead(int msgcount);
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount); void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount);
void soundBuzzer(buzzerEventType bet = buzzerEventType::noBuzzer); void soundBuzzer(UIEventType bet = UIEventType::none);
void loop(); void loop();
}; };

View File

@@ -520,7 +520,7 @@ protected:
} }
} else { } else {
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
ui_task.soundBuzzer(buzzerEventType::newContactMessage); ui_task.soundBuzzer(UIEventType::newContactMessage);
#endif #endif
} }
@@ -583,7 +583,7 @@ protected:
_serial->writeFrame(frame, 1); _serial->writeFrame(frame, 1);
} else { } else {
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
ui_task.soundBuzzer(buzzerEventType::contactMessage); ui_task.soundBuzzer(UIEventType::contactMessage);
#endif #endif
} }
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
@@ -636,7 +636,7 @@ protected:
_serial->writeFrame(frame, 1); _serial->writeFrame(frame, 1);
} else { } else {
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
ui_task.soundBuzzer(); ui_task.soundBuzzer(UIEventType::channelMessage);
#endif #endif
} }
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS

View File

@@ -2,8 +2,8 @@
#include "buzzer.h" #include "buzzer.h"
void genericBuzzer::begin() { void genericBuzzer::begin() {
Serial.print("DBG: Setting up buzzer on pin "); // Serial.print("DBG: Setting up buzzer on pin ");
Serial.println(PIN_BUZZER); // Serial.println(PIN_BUZZER);
#ifdef PIN_BUZZER_EN #ifdef PIN_BUZZER_EN
pinMode(PIN_BUZZER_EN, OUTPUT); pinMode(PIN_BUZZER_EN, OUTPUT);
digitalWrite(PIN_BUZZER_EN, HIGH); digitalWrite(PIN_BUZZER_EN, HIGH);

View File

@@ -16,15 +16,6 @@
*/ */
enum class buzzerEventType
{
noBuzzer,
contactMessage,
channelMessage,
roomMessage,
newContactMessage
};
class genericBuzzer class genericBuzzer
{ {
public: public: