compacted the nested if using ternary operator

This commit is contained in:
isseysandei 2025-01-20 09:36:30 +01:00
parent fb01e72d04
commit 65d2b5d26c
2 changed files with 8 additions and 13 deletions

@ -1 +1 @@
Subproject commit fde27e4ef0fcee967063ba353422ed5f9a1c4790
Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4

View File

@ -2660,19 +2660,14 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
return 0;
}
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
// If auto carousel is disabled, the focus doesn't chage on the incoming message
{
if (config.display.auto_screen_carousel_secs != 0) {
if (showingNormalScreen) {
// Outgoing message
if (packet->from == 0)
setFrames(FOCUS_PRESERVE); // Return to same frame (quietly hiding the rx text message frame)
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet) {
// 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;