No focus on new messages if auto-carousel is off (#5881)

* no focus on messages if screen carousel is disabled

* trunk + comment

* compacted the nested if using ternary operator

* trunk
This commit is contained in:
isseysandei 2025-01-20 17:47:47 +01:00 committed by GitHub
parent c1beb44678
commit 0f981153eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2662,14 +2662,13 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
{
if (showingNormalScreen) {
// Outgoing message
if (packet->from == 0)
setFrames(FOCUS_PRESERVE); // Return to same frame (quietly hiding the rx text message frame)
// If auto carousel is disabled -> return 0 and skip new messages handling
if (config.display.auto_screen_carousel_secs == 0)
return 0;
// Incoming message
else
setFrames(FOCUS_TEXTMESSAGE); // Focus on the new message
// Handle focus change based on message type
if (showingNormalScreen) {
setFrames(packet->from == 0 ? FOCUS_PRESERVE : FOCUS_TEXTMESSAGE);
}
return 0;