уведомления: режимы по каналам, тихие часы с часовым поясом, отключение автовключения дисплея
Run Unit Tests / test (push) Canceled after 0s
Build and deploy Docs site to GitHub Pages / github-pages (push) Canceled after 0s
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Canceled after 0s
PR Build Check / build (Heltec_v3_repeater) (push) Canceled after 0s
PR Build Check / build (Heltec_v3_room_server) (push) Canceled after 0s
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Canceled after 0s
PR Build Check / build (PicoW_repeater) (push) Canceled after 0s
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Canceled after 0s
PR Build Check / build (RAK_4631_companion_radio_ethernet) (push) Canceled after 0s
PR Build Check / build (RAK_4631_repeater) (push) Canceled after 0s
PR Build Check / build (RAK_4631_repeater_ethernet) (push) Canceled after 0s
PR Build Check / build (RAK_4631_room_server) (push) Canceled after 0s
PR Build Check / build (RAK_4631_room_server_ethernet) (push) Canceled after 0s
PR Build Check / build (Tbeam_SX1276_repeater) (push) Canceled after 0s
PR Build Check / build (wio-e5-mini_repeater) (push) Canceled after 0s
PR Build Check / build (wio_wm1110_repeater) (push) Canceled after 0s

This commit is contained in:
2026-10-08 20:28:59 +03:00
parent 76e754f7ad
commit 28e802dcf0
5 changed files with 382 additions and 20 deletions
+32 -14
View File
@@ -361,7 +361,10 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path
}
} else {
#ifdef DISPLAY_CLASS
if (_ui) _ui->notify(UIEventType::newContactMessage);
// тихие часы глушат и уведомление о новом контакте
if (_ui && !_prefs.isQuietNow(getRTCClock()->getCurrentTime())) {
_ui->notify(UIEventType::newContactMessage);
}
#endif
}
@@ -468,9 +471,13 @@ void MyMesh::queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packe
// we only want to show text messages on display, not cli data
bool should_display = txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN;
if (should_display && _ui) {
_ui->newMsg(path_len, from.name, text, offline_queue_len);
if (!_serial->isConnected()) {
_ui->notify(UIEventType::contactMessage);
bool quiet = _prefs.isQuietNow(getRTCClock()->getCurrentTime());
bool alert = _prefs.msg_popup && !quiet;
if (alert) {
if (!_serial->isConnected()) _ui->notify(UIEventType::contactMessage);
_ui->newMsg(path_len, from.name, text, offline_queue_len);
} else {
_ui->newMsgSilent(path_len, from.name, text, offline_queue_len);
}
}
#endif
@@ -573,19 +580,30 @@ void MyMesh::onChannelMessageRecv(const mesh::GroupChannel &channel, mesh::Packe
uint8_t frame[1];
frame[0] = PUSH_CODE_MSG_WAITING; // send push 'tickle'
_serial->writeFrame(frame, 1);
} else {
#ifdef DISPLAY_CLASS
if (_ui) _ui->notify(UIEventType::channelMessage);
#endif
}
#ifdef DISPLAY_CLASS
// Get the channel name from the channel index
const char *channel_name = "Unknown";
ChannelDetails channel_details;
if (getChannel(channel_idx, channel_details)) {
channel_name = channel_details.name;
// Настройки уведомлений: канал может быть в режиме POPUP / SILENT / OFF,
// плюс тихие часы глушат звук и всплытие для всех входящих.
uint8_t ch_mode = _prefs.getChannelMode(channel_idx);
if (ch_mode != CH_MODE_OFF) {
bool quiet = _prefs.isQuietNow(getRTCClock()->getCurrentTime());
bool alert = (ch_mode == CH_MODE_POPUP) && _prefs.msg_popup && !quiet;
// Get the channel name from the channel index
const char *channel_name = "Unknown";
ChannelDetails channel_details;
if (getChannel(channel_idx, channel_details)) {
channel_name = channel_details.name;
}
if (_ui) {
if (alert) {
if (!_serial->isConnected()) _ui->notify(UIEventType::channelMessage);
_ui->newMsg(path_len, channel_name, text, offline_queue_len);
} else {
_ui->newMsgSilent(path_len, channel_name, text, offline_queue_len);
}
}
}
if (_ui) _ui->newMsg(path_len, channel_name, text, offline_queue_len);
#endif
}