mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-21 20:51:00 +00:00
* Fixed Canned Messages send to non broadcast * Small fix * Fix formatting for singular canned message * Trunk fmt --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
ea4ce8d827
commit
644849126c
@ -483,7 +483,7 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
#if defined(USE_VIRTUAL_KEYBOARD)
|
#if defined(USE_VIRTUAL_KEYBOARD)
|
||||||
sendText(this->dest, indexChannels[this->channel], this->messages[this->currentMessageIndex], true);
|
sendText(this->dest, indexChannels[this->channel], this->messages[this->currentMessageIndex], true);
|
||||||
#else
|
#else
|
||||||
sendText(NODENUM_BROADCAST, channels.getPrimaryIndex(), this->messages[this->currentMessageIndex], true);
|
sendText(this->dest, indexChannels[this->channel], this->messages[this->currentMessageIndex], true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
|
this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
|
||||||
@ -1114,20 +1114,19 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
|
|||||||
display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest));
|
display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest));
|
||||||
int lines = (display->getHeight() / FONT_HEIGHT_SMALL) - 1;
|
int lines = (display->getHeight() / FONT_HEIGHT_SMALL) - 1;
|
||||||
if (lines == 3) {
|
if (lines == 3) {
|
||||||
// static (old) behavior for small displays
|
|
||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->getPrevMessage());
|
|
||||||
display->fillRect(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
display->fillRect(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||||
display->setColor(BLACK);
|
display->setColor(BLACK);
|
||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, cannedMessageModule->getCurrentMessage());
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, cannedMessageModule->getCurrentMessage());
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
|
if (this->messagesCount > 1) {
|
||||||
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->getPrevMessage());
|
||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 3, cannedMessageModule->getNextMessage());
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 3, cannedMessageModule->getNextMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// use entire display height for larger displays
|
|
||||||
int topMsg = (messagesCount > lines && currentMessageIndex >= lines - 1) ? currentMessageIndex - lines + 2 : 0;
|
int topMsg = (messagesCount > lines && currentMessageIndex >= lines - 1) ? currentMessageIndex - lines + 2 : 0;
|
||||||
for (int i = 0; i < std::min(messagesCount, lines); i++) {
|
for (int i = 0; i < std::min(messagesCount, lines); i++) {
|
||||||
if (i == currentMessageIndex - topMsg) {
|
if (i == currentMessageIndex - topMsg) {
|
||||||
#ifdef USE_EINK
|
#ifdef USE_EINK
|
||||||
// Avoid drawing solid black with fillRect: harder to clear for E-Ink
|
|
||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), ">");
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), ">");
|
||||||
display->drawString(12 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1),
|
display->drawString(12 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1),
|
||||||
cannedMessageModule->getCurrentMessage());
|
cannedMessageModule->getCurrentMessage());
|
||||||
@ -1138,7 +1137,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st
|
|||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), cannedMessageModule->getCurrentMessage());
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), cannedMessageModule->getCurrentMessage());
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else if (messagesCount > 1) { // Only draw others if there are multiple messages
|
||||||
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1),
|
display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1),
|
||||||
cannedMessageModule->getMessageByIndex(topMsg + i));
|
cannedMessageModule->getMessageByIndex(topMsg + i));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user