@@ -100,7 +100,7 @@ namespace graphics
100100#define NUM_EXTRA_FRAMES 3 // text message and debug frame
101101// if defined a pixel will blink to show redraws
102102// #define SHOW_REDRAWS
103-
103+ # define ASCII_BELL ' \x07 '
104104// A text message frame + debug frame + all the node infos
105105FrameCallback *normalFrames;
106106static uint32_t targetFramerate = IDLE_FRAMERATE;
@@ -1458,28 +1458,36 @@ int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
14581458 }
14591459 // === Prepare banner content ===
14601460 const meshtastic_NodeInfoLite *node = nodeDB->getMeshNode (packet->from );
1461+ const meshtastic_Channel channel =
1462+ channels.getByIndex (packet->channel ? packet->channel : channels.getPrimaryIndex ());
14611463 const char *longName = (node && node->has_user ) ? node->user .long_name : nullptr ;
14621464
14631465 const char *msgRaw = reinterpret_cast <const char *>(packet->decoded .payload .bytes );
14641466
14651467 char banner[256 ];
14661468
1467- // Check for bell character in message to determine alert type
14681469 bool isAlert = false ;
1469- for (size_t i = 0 ; i < packet->decoded .payload .size && i < 100 ; i++) {
1470- if (msgRaw[i] == ' \x07 ' ) {
1471- isAlert = true ;
1472- break ;
1470+
1471+ if (moduleConfig.external_notification .alert_bell || moduleConfig.external_notification .alert_bell_vibra ||
1472+ moduleConfig.external_notification .alert_bell_buzzer )
1473+ // Check for bell character to determine if this message is an alert
1474+ for (size_t i = 0 ; i < packet->decoded .payload .size && i < 100 ; i++) {
1475+ if (msgRaw[i] == ASCII_BELL) {
1476+ isAlert = true ;
1477+ break ;
1478+ }
14731479 }
1474- }
14751480
1481+ // Unlike generic messages, alerts (when enabled via the ext notif module) ignore any
1482+ // 'mute' preferences set to any specific node or channel.
14761483 if (isAlert) {
14771484 if (longName && longName[0 ]) {
14781485 snprintf (banner, sizeof (banner), " Alert Received from\n %s" , longName);
14791486 } else {
14801487 strcpy (banner, " Alert Received" );
14811488 }
1482- } else {
1489+ screen->showSimpleBanner (banner, 3000 );
1490+ } else if (!channel.settings .mute ) {
14831491 if (longName && longName[0 ]) {
14841492#if defined(M5STACK_UNITC6L)
14851493 strcpy (banner, " New Message" );
@@ -1490,20 +1498,21 @@ int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
14901498 } else {
14911499 strcpy (banner, " New Message" );
14921500 }
1493- }
14941501#if defined(M5STACK_UNITC6L)
1495- screen->setOn (true );
1496- screen->showSimpleBanner (banner, 1500 );
1497- if (config.device .buzzer_mode != meshtastic_Config_DeviceConfig_BuzzerMode_DIRECT_MSG_ONLY ||
1498- (isAlert && moduleConfig.external_notification .alert_bell_buzzer ) || (!isBroadcast (packet->to ) && isToUs (p))) {
1499- // Beep if not in DIRECT_MSG_ONLY mode or if in DIRECT_MSG_ONLY mode and either
1500- // - packet contains an alert and alert bell buzzer is enabled
1501- // - packet is a non-broadcast that is addressed to this node
1502- playLongBeep ();
1503- }
1502+ screen->setOn (true );
1503+ screen->showSimpleBanner (banner, 1500 );
1504+ if (config.device .buzzer_mode != meshtastic_Config_DeviceConfig_BuzzerMode_DIRECT_MSG_ONLY ||
1505+ (isAlert && moduleConfig.external_notification .alert_bell_buzzer ) ||
1506+ (!isBroadcast (packet->to ) && isToUs (p))) {
1507+ // Beep if not in DIRECT_MSG_ONLY mode or if in DIRECT_MSG_ONLY mode and either
1508+ // - packet contains an alert and alert bell buzzer is enabled
1509+ // - packet is a non-broadcast that is addressed to this node
1510+ playLongBeep ();
1511+ }
15041512#else
1505- screen->showSimpleBanner (banner, 3000 );
1513+ screen->showSimpleBanner (banner, 3000 );
15061514#endif
1515+ }
15071516 }
15081517 }
15091518
0 commit comments