Browse Source
Merge pull request #314 from seagull9000/RTTTL-tweaks1
RTTTL on message types
pull/315/head
ripplebiz
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
32 additions and
10 deletions
-
examples/companion_radio/UITask.cpp
-
examples/companion_radio/UITask.h
-
examples/companion_radio/main.cpp
-
src/helpers/ui/buzzer.cpp
-
src/helpers/ui/buzzer.h
|
|
|
@ -59,12 +59,23 @@ void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs, const char* bu |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void UITask::soundBuzzer() { |
|
|
|
void UITask::soundBuzzer(UIEventType 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 UIEventType::contactMessage: |
|
|
|
// gemini's pick
|
|
|
|
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); |
|
|
|
break; |
|
|
|
case UIEventType::channelMessage: |
|
|
|
case UIEventType::roomMessage: |
|
|
|
case UIEventType::newContactMessage: |
|
|
|
case UIEventType::none: |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
#endif |
|
|
|
// Serial.print("DBG: Buzzzzzz -> ");
|
|
|
|
// Serial.println((int) bet);
|
|
|
|
} |
|
|
|
|
|
|
|
void UITask::msgRead(int msgcount) { |
|
|
|
|
|
|
|
@ -10,6 +10,15 @@ |
|
|
|
|
|
|
|
#include "NodePrefs.h" |
|
|
|
|
|
|
|
enum class UIEventType |
|
|
|
{ |
|
|
|
none, |
|
|
|
contactMessage, |
|
|
|
channelMessage, |
|
|
|
roomMessage, |
|
|
|
newContactMessage |
|
|
|
}; |
|
|
|
|
|
|
|
class UITask { |
|
|
|
DisplayDriver* _display; |
|
|
|
mesh::MainBoard* _board; |
|
|
|
@ -31,6 +40,7 @@ class UITask { |
|
|
|
void userLedHandler(); |
|
|
|
void renderBatteryIndicator(uint16_t batteryMilliVolts); |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) { |
|
|
|
@ -44,6 +54,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(UIEventType bet = UIEventType::none); |
|
|
|
void loop(); |
|
|
|
}; |
|
|
|
|
|
|
|
@ -520,7 +520,7 @@ protected: |
|
|
|
} |
|
|
|
} else { |
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
ui_task.soundBuzzer(); |
|
|
|
ui_task.soundBuzzer(UIEventType::newContactMessage); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
@ -583,7 +583,7 @@ protected: |
|
|
|
_serial->writeFrame(frame, 1); |
|
|
|
} else { |
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
ui_task.soundBuzzer(); |
|
|
|
ui_task.soundBuzzer(UIEventType::contactMessage); |
|
|
|
#endif |
|
|
|
} |
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
@ -636,7 +636,7 @@ protected: |
|
|
|
_serial->writeFrame(frame, 1); |
|
|
|
} else { |
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
ui_task.soundBuzzer(); |
|
|
|
ui_task.soundBuzzer(UIEventType::channelMessage); |
|
|
|
#endif |
|
|
|
} |
|
|
|
#ifdef DISPLAY_CLASS |
|
|
|
|
|
|
|
@ -2,8 +2,8 @@ |
|
|
|
#include "buzzer.h" |
|
|
|
|
|
|
|
void genericBuzzer::begin() { |
|
|
|
Serial.print("DBG: Setting up buzzer on pin "); |
|
|
|
Serial.println(PIN_BUZZER); |
|
|
|
// Serial.print("DBG: Setting up buzzer on pin ");
|
|
|
|
// Serial.println(PIN_BUZZER);
|
|
|
|
#ifdef PIN_BUZZER_EN |
|
|
|
pinMode(PIN_BUZZER_EN, OUTPUT); |
|
|
|
digitalWrite(PIN_BUZZER_EN, HIGH); |
|
|
|
|
|
|
|
@ -15,6 +15,7 @@ |
|
|
|
- make message ring tone configurable |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
class genericBuzzer |
|
|
|
{ |
|
|
|
public: |
|
|
|
|