mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-29 19:03:52 +00:00
Format received message screen like sender in canned messages.
This commit is contained in:
parent
1a0d51495d
commit
f3d6f26a28
@ -360,6 +360,9 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
{
|
{
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
displayedNodeNum = 0; // Not currently showing a node pane
|
||||||
|
|
||||||
|
// the max length of this buffer is much longer than we can possibly print
|
||||||
|
static char tempBuf[237];
|
||||||
|
|
||||||
MeshPacket &mp = devicestate.rx_text_message;
|
MeshPacket &mp = devicestate.rx_text_message;
|
||||||
NodeInfo *node = nodeDB.getNode(getFrom(&mp));
|
NodeInfo *node = nodeDB.getNode(getFrom(&mp));
|
||||||
// DEBUG_MSG("drawing text message from 0x%x: %s\n", mp.from,
|
// DEBUG_MSG("drawing text message from 0x%x: %s\n", mp.from,
|
||||||
@ -369,16 +372,13 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
// with the third parameter you can define the width after which words will
|
// with the third parameter you can define the width after which words will
|
||||||
// be wrapped. Currently only spaces and "-" are allowed for wrapping
|
// be wrapped. Currently only spaces and "-" are allowed for wrapping
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display->setFont(FONT_MEDIUM);
|
|
||||||
String sender = (node && node->has_user) ? node->user.short_name : "???";
|
|
||||||
display->drawString(0 + x, 0 + y, sender);
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||||
// the max length of this buffer is much longer than we can possibly print
|
display->setColor(BLACK);
|
||||||
static char tempBuf[96];
|
display->drawStringf(0 + x, 0 + y, tempBuf, "From: %s", (node && node->has_user) ? node->user.short_name : "???");
|
||||||
snprintf(tempBuf, sizeof(tempBuf), " %s", mp.decoded.payload.bytes);
|
display->setColor(WHITE);
|
||||||
|
snprintf(tempBuf, sizeof(tempBuf), "%s", mp.decoded.payload.bytes);
|
||||||
display->drawStringMaxWidth(4 + x, 10 + y, SCREEN_WIDTH - (6 + x), tempBuf);
|
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), tempBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a series of fields in a column, wrapping to multiple colums if needed
|
/// Draw a series of fields in a column, wrapping to multiple colums if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user