Mute channel fix

This commit is contained in:
HarukiToreda 2025-10-09 20:25:48 -04:00
parent 334089aa97
commit e6093533ab
2 changed files with 31 additions and 6 deletions

View File

@ -721,6 +721,15 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
if (packet.from != 0) {
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()) {
screen->setOn(true);
// screen->forceDisplay(); <-- remove, let Screen handle this
@ -733,10 +742,16 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
char banner[256];
bool isAlert = false;
for (size_t i = 0; i < packet.decoded.payload.size && i < 100; i++) {
if (msgRaw[i] == '\x07') {
isAlert = true;
break;
// Check if alert detection is enabled via external notification module
if (moduleConfig.external_notification.alert_bell ||
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
strcpy(banner, "Alert Received");
} else {
// Skip muted channels unless it's an alert
if (isMuted)
return;
if (longName && longName[0]) {
#if defined(M5STACK_UNITC6L)
strcpy(banner, "New Message");
@ -795,7 +814,13 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
#if defined(M5STACK_UNITC6L)
screen->setOn(true);
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
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
#endif

View File

@ -47,7 +47,7 @@ build_flags = ${heltec_mesh_solar_base.build_flags}
-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_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 =
${heltec_mesh_solar_base.lib_deps}
https://github.com/meshtastic/GxEPD2/archive/a05c11c02862624266b61599b0d6ba93e33c6f24.zip