diff --git a/src/MessageStore.cpp b/src/MessageStore.cpp index 6bb20c368..3152cb7c6 100644 --- a/src/MessageStore.cpp +++ b/src/MessageStore.cpp @@ -169,7 +169,7 @@ struct __attribute__((packed)) StoredMessageRecord { uint8_t ackStatus; // static_cast(AckStatus) uint8_t type; // static_cast(MessageType) uint16_t textLength; // message length - char text[MAX_MESSAGE_SIZE]; // <-- store actual text here + char text[MAX_MESSAGE_SIZE]; // store actual text here }; // Serialize one StoredMessage to flash diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 1b2af082d..7dbf89ff7 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -17,6 +17,8 @@ #include "modules/NodeInfoModule.h" #include "modules/PositionModule.h" #include "modules/RoutingModule.h" +#include "MessageStore.h" +#include "graphics/draw/MessageRenderer.h" #include "power.h" #include #include @@ -192,8 +194,17 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p) p.id = generatePacketId(); // If the phone didn't supply one, then pick one p.rx_time = getValidTime(RTCQualityFromNet); // Record the time the packet arrived from the phone - // (so we update our nodedb for the local node) +#if HAS_SCREEN + if (p.decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP && + p.decoded.payload.size > 0 && + p.to != NODENUM_BROADCAST && p.to != 0) // DM only + { + perhapsDecode(&p); + const StoredMessage &sm = messageStore.addFromPacket(p); + graphics::MessageRenderer::handleNewMessage(nullptr, sm, p); // notify UI + } +#endif // Send the packet into the mesh DEBUG_HEAP_BEFORE; auto a = packetPool.allocCopy(p);