From 0f981153ebbad06675f04bd9b0dd6170c7f08352 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Mon, 20 Jan 2025 17:47:47 +0100 Subject: [PATCH] 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 --- src/graphics/Screen.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 198dcc235..b7253ca17 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -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; @@ -2756,4 +2755,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN +#endif // HAS_SCREEN \ No newline at end of file