mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
♻️ refactor: unify UI notification methods into single notify() function
Consolidates soundBuzzer() and triggerVibration() into a unified notify() method that handles both audio and haptic feedback based on UIEventType.
This commit is contained in:
parent
2da50882c0
commit
043f37a08e
6 changed files with 26 additions and 40 deletions
|
|
@ -243,12 +243,7 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
|
|||
}
|
||||
} else {
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) _ui->soundBuzzer(UIEventType::newContactMessage);
|
||||
if (_ui) {
|
||||
#ifdef PIN_VIBRATION
|
||||
if (is_new) _ui->triggerVibration();
|
||||
#endif
|
||||
}
|
||||
if (_ui) _ui->notify(UIEventType::newContactMessage);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +353,7 @@ void MyMesh::queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packe
|
|||
if (should_display && _ui) {
|
||||
_ui->newMsg(path_len, from.name, text, offline_queue_len);
|
||||
if (!_serial->isConnected()) {
|
||||
_ui->soundBuzzer(UIEventType::contactMessage);
|
||||
_ui->notify(UIEventType::contactMessage);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -417,7 +412,7 @@ void MyMesh::onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packe
|
|||
_serial->writeFrame(frame, 1);
|
||||
} else {
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (_ui) _ui->soundBuzzer(UIEventType::channelMessage);
|
||||
if (_ui) _ui->notify(UIEventType::channelMessage);
|
||||
#endif
|
||||
}
|
||||
#ifdef DISPLAY_CLASS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue