mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-05 06:33:56 +00:00
compacted the nested if using ternary operator
This commit is contained in:
parent
fb01e72d04
commit
65d2b5d26c
@ -1 +1 @@
|
|||||||
Subproject commit fde27e4ef0fcee967063ba353422ed5f9a1c4790
|
Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4
|
@ -2660,19 +2660,14 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet)
|
int Screen::handleTextMessage(const meshtastic_MeshPacket *packet) {
|
||||||
// If auto carousel is disabled, the focus doesn't chage on the incoming message
|
// If auto carousel is disabled -> return 0 and skip new messages handling
|
||||||
{
|
if (config.display.auto_screen_carousel_secs == 0)
|
||||||
if (config.display.auto_screen_carousel_secs != 0) {
|
return 0;
|
||||||
if (showingNormalScreen) {
|
|
||||||
// Outgoing message
|
|
||||||
if (packet->from == 0)
|
|
||||||
setFrames(FOCUS_PRESERVE); // Return to same frame (quietly hiding the rx text message frame)
|
|
||||||
|
|
||||||
// Incoming message
|
// Handle focus change based on message type
|
||||||
else
|
if (showingNormalScreen) {
|
||||||
setFrames(FOCUS_TEXTMESSAGE); // Focus on the new message
|
setFrames(packet->from == 0 ? FOCUS_PRESERVE : FOCUS_TEXTMESSAGE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user