Skip to content

Commit 0914056

Browse files
committed
tidy logic for devices with display
1 parent 7ea6a98 commit 0914056

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

examples/companion_radio/MyMesh.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,23 +315,20 @@ void MyMesh::queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packe
315315
i += tlen;
316316
addToOfflineQueue(out_frame, i);
317317

318-
// we only want to show text messages on display, not cli data
319-
bool should_display = txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN;
320-
321318
if (_serial->isConnected()) {
322319
uint8_t frame[1];
323320
frame[0] = PUSH_CODE_MSG_WAITING; // send push 'tickle'
324321
_serial->writeFrame(frame, 1);
325-
} else {
326-
#ifdef DISPLAY_CLASS
327-
if(should_display){
328-
ui_task.soundBuzzer(UIEventType::contactMessage);
329-
}
330-
#endif
331322
}
323+
332324
#ifdef DISPLAY_CLASS
333-
if(should_display){
325+
// we only want to show text messages on display, not cli data
326+
bool should_display = txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN;
327+
if (should_display) {
334328
ui_task.newMsg(path_len, from.name, text, offline_queue_len);
329+
if (!_serial->isConnected()) {
330+
ui_task.soundBuzzer(UIEventType::contactMessage);
331+
}
335332
}
336333
#endif
337334
}

0 commit comments

Comments
 (0)