From 5559a1edb0d672f1c8d8fb303718f1b823a923d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 13 Oct 2022 15:22:57 +0200 Subject: [PATCH 1/3] Display looks better that way... --- src/modules/CannedMessageModule.cpp | 15 +++++++++------ src/modules/CannedMessageModule.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 29ea20257..84960e130 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -430,6 +430,8 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st { displayedNodeNum = 0; // Not currently showing a node pane + char buffer[50]; + if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE) { display->setTextAlignment(TEXT_ALIGN_CENTER); display->setFont(FONT_MEDIUM); @@ -445,7 +447,6 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); } - char buffer[50]; display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest)); // used chars right aligned sprintf(buffer, "%d left", Constants_DATA_PAYLOAD_LEN - this->freetext.length()); @@ -456,11 +457,13 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st if (this->messagesCount > 0) { display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - display->drawString(0 + x, 0 + y, cannedMessageModule->getPrevMessage()); - display->setFont(FONT_MEDIUM); - display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->getCurrentMessage()); - display->setFont(FONT_SMALL); - display->drawString(0 + x, 0 + y + FONT_HEIGHT_MEDIUM, cannedMessageModule->getNextMessage()); + display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest)); + 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->setColor(BLACK); + display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, cannedMessageModule->getCurrentMessage()); + display->setColor(WHITE); + display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 3, cannedMessageModule->getNextMessage()); } } } diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index b9ef5c413..248e20de2 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,5 +1,5 @@ #pragma once -#if HAS_SCREEN +#ifdef HAS_SCREEN #include "ProtobufModule.h" #include "input/InputBroker.h" From 8734751bc4d627ba3ce2f1de949e9c8eed11f437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 13 Oct 2022 15:31:57 +0200 Subject: [PATCH 2/3] make screen timeout work again --- src/modules/CannedMessageModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 84960e130..b00dfb796 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -225,7 +225,7 @@ int32_t CannedMessageModule::runOnce() this->cursor = 0; this->destSelect = false; this->notifyObservers(&e); - } else if (((this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT)) && (millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS) { + } else if (((this->runState == CANNED_MESSAGE_RUN_STATE_ACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT)) && ((millis() - this->lastTouchMillis) > INACTIVATE_AFTER_MS)) { // Reset module DEBUG_MSG("Reset due to lack of activity.\n"); e.frameChanged = true; From b25ace14e5acac31e8f9e2e192738761f79cdde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 13 Oct 2022 15:44:27 +0200 Subject: [PATCH 3/3] Update CannedMessageModule.h --- src/modules/CannedMessageModule.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 248e20de2..2edef4655 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,5 +1,5 @@ #pragma once -#ifdef HAS_SCREEN +#if HAS_SCREEN #include "ProtobufModule.h" #include "input/InputBroker.h" @@ -87,4 +87,4 @@ class CannedMessageModule : }; extern CannedMessageModule *cannedMessageModule; -#endif \ No newline at end of file +#endif