mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 07:13:25 +00:00
Clean up how muting works along with when we wake the screen
This commit is contained in:
parent
6069dc2ad8
commit
6d899c9fd9
@ -2,11 +2,6 @@
|
||||
|
||||
#if HAS_SCREEN
|
||||
|
||||
// Disable debug logging entirely on release builds
|
||||
#if !defined(DEBUG)
|
||||
#define LOG_DEBUG(...)
|
||||
#endif
|
||||
|
||||
// Disable message persistence to flash if you’re short on space
|
||||
#ifndef ENABLE_MESSAGE_PERSISTENCE
|
||||
#define ENABLE_MESSAGE_PERSISTENCE 1
|
||||
|
||||
@ -722,16 +722,11 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
||||
hasUnreadMessage = true;
|
||||
|
||||
// Determine if message belongs to a muted channel
|
||||
bool isMuted = false;
|
||||
bool isChannelMuted = 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
|
||||
isChannelMuted = true;
|
||||
}
|
||||
|
||||
// Banner logic
|
||||
@ -760,7 +755,7 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
||||
strcpy(banner, "Alert Received");
|
||||
} else {
|
||||
// Skip muted channels unless it's an alert
|
||||
if (isMuted)
|
||||
if (isChannelMuted)
|
||||
return;
|
||||
|
||||
if (longName && longName[0]) {
|
||||
@ -809,18 +804,11 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
||||
// Shorter banner if already in a conversation (Channel or Direct)
|
||||
bool inThread = (getThreadMode() != ThreadMode::ALL);
|
||||
|
||||
#if defined(M5STACK_UNITC6L)
|
||||
screen->setOn(true);
|
||||
screen->showSimpleBanner(banner, inThread ? 1000 : 1500);
|
||||
|
||||
// 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();
|
||||
if (shouldWakeOnReceivedMessage()) {
|
||||
screen->setOn(true);
|
||||
}
|
||||
#else
|
||||
|
||||
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
|
||||
#endif
|
||||
}
|
||||
|
||||
// No setFrames() here anymore
|
||||
|
||||
Loading…
Reference in New Issue
Block a user