mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 07:13:25 +00:00
Mute channel fix
This commit is contained in:
parent
334089aa97
commit
e6093533ab
@ -721,6 +721,15 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
if (packet.from != 0) {
|
if (packet.from != 0) {
|
||||||
hasUnreadMessage = true;
|
hasUnreadMessage = true;
|
||||||
|
|
||||||
|
// Determine if message belongs to a muted channel
|
||||||
|
bool isMuted = false;
|
||||||
|
if (sm.type == MessageType::BROADCAST) {
|
||||||
|
const meshtastic_Channel channel =
|
||||||
|
channels.getByIndex(packet.channel ? packet.channel : channels.getPrimaryIndex());
|
||||||
|
if (channel.settings.mute)
|
||||||
|
isMuted = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldWakeOnReceivedMessage()) {
|
if (shouldWakeOnReceivedMessage()) {
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
// screen->forceDisplay(); <-- remove, let Screen handle this
|
// screen->forceDisplay(); <-- remove, let Screen handle this
|
||||||
@ -733,10 +742,16 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
|
|
||||||
char banner[256];
|
char banner[256];
|
||||||
bool isAlert = false;
|
bool isAlert = false;
|
||||||
for (size_t i = 0; i < packet.decoded.payload.size && i < 100; i++) {
|
|
||||||
if (msgRaw[i] == '\x07') {
|
// Check if alert detection is enabled via external notification module
|
||||||
isAlert = true;
|
if (moduleConfig.external_notification.alert_bell ||
|
||||||
break;
|
moduleConfig.external_notification.alert_bell_vibra ||
|
||||||
|
moduleConfig.external_notification.alert_bell_buzzer) {
|
||||||
|
for (size_t i = 0; i < packet.decoded.payload.size && i < 100; i++) {
|
||||||
|
if (msgRaw[i] == '\x07') {
|
||||||
|
isAlert = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,6 +761,10 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
else
|
else
|
||||||
strcpy(banner, "Alert Received");
|
strcpy(banner, "Alert Received");
|
||||||
} else {
|
} else {
|
||||||
|
// Skip muted channels unless it's an alert
|
||||||
|
if (isMuted)
|
||||||
|
return;
|
||||||
|
|
||||||
if (longName && longName[0]) {
|
if (longName && longName[0]) {
|
||||||
#if defined(M5STACK_UNITC6L)
|
#if defined(M5STACK_UNITC6L)
|
||||||
strcpy(banner, "New Message");
|
strcpy(banner, "New Message");
|
||||||
@ -795,7 +814,13 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
#if defined(M5STACK_UNITC6L)
|
#if defined(M5STACK_UNITC6L)
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
screen->showSimpleBanner(banner, inThread ? 1000 : 1500);
|
screen->showSimpleBanner(banner, inThread ? 1000 : 1500);
|
||||||
playLongBeep();
|
|
||||||
|
// Only beep if allowed by device settings or alert rules
|
||||||
|
if (config.device.buzzer_mode != meshtastic_Config_DeviceConfig_BuzzerMode_DIRECT_MSG_ONLY ||
|
||||||
|
(isAlert && moduleConfig.external_notification.alert_bell_buzzer) ||
|
||||||
|
(!isBroadcast(packet.to) && isToUs(packet))) {
|
||||||
|
playLongBeep();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
|
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -47,7 +47,7 @@ build_flags = ${heltec_mesh_solar_base.build_flags}
|
|||||||
-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates
|
-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates
|
||||||
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
|
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
|
||||||
-DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
|
-DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting"
|
||||||
-DENABLE_MESSAGE_PERSISTENCE=0 ; isable flash persistence for space-limited build
|
-DENABLE_MESSAGE_PERSISTENCE=0 ; Disable flash persistence for space-limited build
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${heltec_mesh_solar_base.lib_deps}
|
${heltec_mesh_solar_base.lib_deps}
|
||||||
https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip
|
https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user