mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 23:34:03 +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
|
#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
|
// Disable message persistence to flash if you’re short on space
|
||||||
#ifndef ENABLE_MESSAGE_PERSISTENCE
|
#ifndef ENABLE_MESSAGE_PERSISTENCE
|
||||||
#define ENABLE_MESSAGE_PERSISTENCE 1
|
#define ENABLE_MESSAGE_PERSISTENCE 1
|
||||||
|
|||||||
@ -722,16 +722,11 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
hasUnreadMessage = true;
|
hasUnreadMessage = true;
|
||||||
|
|
||||||
// Determine if message belongs to a muted channel
|
// Determine if message belongs to a muted channel
|
||||||
bool isMuted = false;
|
bool isChannelMuted = false;
|
||||||
if (sm.type == MessageType::BROADCAST) {
|
if (sm.type == MessageType::BROADCAST) {
|
||||||
const meshtastic_Channel channel = channels.getByIndex(packet.channel ? packet.channel : channels.getPrimaryIndex());
|
const meshtastic_Channel channel = channels.getByIndex(packet.channel ? packet.channel : channels.getPrimaryIndex());
|
||||||
if (channel.settings.mute)
|
if (channel.settings.mute)
|
||||||
isMuted = true;
|
isChannelMuted = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldWakeOnReceivedMessage()) {
|
|
||||||
screen->setOn(true);
|
|
||||||
// screen->forceDisplay(); <-- remove, let Screen handle this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Banner logic
|
// Banner logic
|
||||||
@ -760,7 +755,7 @@ void handleNewMessage(const StoredMessage &sm, const meshtastic_MeshPacket &pack
|
|||||||
strcpy(banner, "Alert Received");
|
strcpy(banner, "Alert Received");
|
||||||
} else {
|
} else {
|
||||||
// Skip muted channels unless it's an alert
|
// Skip muted channels unless it's an alert
|
||||||
if (isMuted)
|
if (isChannelMuted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (longName && longName[0]) {
|
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)
|
// Shorter banner if already in a conversation (Channel or Direct)
|
||||||
bool inThread = (getThreadMode() != ThreadMode::ALL);
|
bool inThread = (getThreadMode() != ThreadMode::ALL);
|
||||||
|
|
||||||
#if defined(M5STACK_UNITC6L)
|
if (shouldWakeOnReceivedMessage()) {
|
||||||
screen->setOn(true);
|
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();
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
|
screen->showSimpleBanner(banner, inThread ? 1000 : 3000);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No setFrames() here anymore
|
// No setFrames() here anymore
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user