From 87ae2987d8f58c6a57b9e419887794af6ccc1e49 Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Sun, 8 Jun 2025 22:14:30 -0400 Subject: [PATCH 1/5] T-watch screen misalignment fix --- src/graphics/TFTDisplay.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 14787baff..4d5a72934 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -467,7 +467,15 @@ class LGFX : public lgfx::LGFX_Device // The following setting values ​​are general initial values ​​for each panel, so please comment out any // unknown items and try them. - +#if defined(T_WATCH_S3) + cfg.panel_width = 240; + cfg.panel_height = 240; + cfg.memory_width = 240; + cfg.memory_height = 320; + cfg.offset_x = 0; + cfg.offset_y = 0; // No vertical shift needed — panel is top-aligned + cfg.offset_rotation = 2; // Rotate 180° to correct upside-down layout +#else cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC cfg.panel_width = TFT_WIDTH; // actual displayable width @@ -475,6 +483,7 @@ class LGFX : public lgfx::LGFX_Device cfg.offset_x = TFT_OFFSET_X; // Panel offset amount in X direction cfg.offset_y = TFT_OFFSET_Y; // Panel offset amount in Y direction cfg.offset_rotation = TFT_OFFSET_ROTATION; // Rotation direction value offset 0~7 (4~7 is mirrored) +#endif #ifdef TFT_DUMMY_READ_PIXELS cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout #else From 8aabbd4c566a2b88a21b3747baa2852cf2b05b9e Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Sun, 8 Jun 2025 23:17:26 -0400 Subject: [PATCH 2/5] Trunk fix --- src/graphics/TFTDisplay.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 4d5a72934..76fe6b2d3 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -468,26 +468,26 @@ class LGFX : public lgfx::LGFX_Device // The following setting values ​​are general initial values ​​for each panel, so please comment out any // unknown items and try them. #if defined(T_WATCH_S3) - cfg.panel_width = 240; - cfg.panel_height = 240; - cfg.memory_width = 240; - cfg.memory_height = 320; - cfg.offset_x = 0; - cfg.offset_y = 0; // No vertical shift needed — panel is top-aligned - cfg.offset_rotation = 2; // Rotate 180° to correct upside-down layout + cfg.panel_width = 240; + cfg.panel_height = 240; + cfg.memory_width = 240; + cfg.memory_height = 320; + cfg.offset_x = 0; + cfg.offset_y = 0; // No vertical shift needed — panel is top-aligned + cfg.offset_rotation = 2; // Rotate 180° to correct upside-down layout #else - cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC - cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC - cfg.panel_width = TFT_WIDTH; // actual displayable width - cfg.panel_height = TFT_HEIGHT; // actual displayable height - cfg.offset_x = TFT_OFFSET_X; // Panel offset amount in X direction - cfg.offset_y = TFT_OFFSET_Y; // Panel offset amount in Y direction - cfg.offset_rotation = TFT_OFFSET_ROTATION; // Rotation direction value offset 0~7 (4~7 is mirrored) + cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC + cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC + cfg.panel_width = TFT_WIDTH; // actual displayable width + cfg.panel_height = TFT_HEIGHT; // actual displayable height + cfg.offset_x = TFT_OFFSET_X; // Panel offset amount in X direction + cfg.offset_y = TFT_OFFSET_Y; // Panel offset amount in Y direction + cfg.offset_rotation = TFT_OFFSET_ROTATION; // Rotation direction value offset 0~7 (4~7 is mirrored) #endif #ifdef TFT_DUMMY_READ_PIXELS cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout #else - cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout + cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout #endif cfg.dummy_read_bits = 1; // Number of bits for dummy read before non-pixel data read cfg.readable = true; // Set to true if data can be read From 7880d732d9c5a90ccfd5e0448bd93dae02aa8ff4 Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Wed, 23 Jul 2025 01:16:09 -0400 Subject: [PATCH 3/5] Rember Last Receipient Node or channel When a new freetext or preset message is sent and a destination is selected, the next message would forget the previously selected destination and would need to be selected again. With this fix it will remember the last destination selected until changed again. --- src/modules/CannedMessageModule.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index ed930db41..dd001a7b9 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -40,6 +40,9 @@ extern ScanI2C::DeviceAddress cardkb_found; extern bool graphics::isMuted; static const char *cannedMessagesConfigFile = "/prefs/cannedConf.proto"; +static NodeNum lastDest = NODENUM_BROADCAST; +static uint8_t lastChannel = 0; +static bool lastDestSet = false; meshtastic_CannedMessageModuleConfig cannedMessageModuleConfig; @@ -63,8 +66,16 @@ CannedMessageModule::CannedMessageModule() void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChannel) { - dest = newDest; - channel = newChannel; + if (!lastDestSet) { + dest = NODENUM_BROADCAST; + channel = 0; + lastDest = dest; + lastChannel = channel; + lastDestSet = true; + } else { + dest = lastDest; + channel = lastChannel; + } // Always select the first real canned message on activation int firstRealMsgIdx = 0; for (int i = 0; i < messagesCount; ++i) { @@ -479,6 +490,9 @@ int CannedMessageModule::handleDestinationSelectionInput(const InputEvent *event if (destIndex < static_cast(activeChannelIndices.size())) { dest = NODENUM_BROADCAST; channel = activeChannelIndices[destIndex]; + lastDest = dest; + lastChannel = channel; + lastDestSet = true; } else { int nodeIndex = destIndex - static_cast(activeChannelIndices.size()); if (nodeIndex >= 0 && nodeIndex < static_cast(filteredNodes.size())) { @@ -486,6 +500,10 @@ int CannedMessageModule::handleDestinationSelectionInput(const InputEvent *event if (selectedNode) { dest = selectedNode->num; channel = selectedNode->channel; + // Already saves here, but for clarity, also: + lastDest = dest; + lastChannel = channel; + lastDestSet = true; } } } @@ -827,6 +845,9 @@ int CannedMessageModule::handleEmotePickerInput(const InputEvent *event) void CannedMessageModule::sendText(NodeNum dest, ChannelIndex channel, const char *message, bool wantReplies) { + lastDest = dest; + lastChannel = channel; + lastDestSet = true; // === Prepare packet === meshtastic_MeshPacket *p = allocDataPacket(); p->to = dest; From 37bc8318493c9d3850a7c6b08071a5e360e98a1b Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Sat, 26 Jul 2025 23:15:44 -0400 Subject: [PATCH 4/5] Fix for reply function to remember last messaged --- src/modules/CannedMessageModule.cpp | 38 ++++++++++++++++++++++------- src/modules/CannedMessageModule.h | 1 + 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index dd001a7b9..dbe2011b3 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -66,16 +66,18 @@ CannedMessageModule::CannedMessageModule() void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChannel) { - if (!lastDestSet) { - dest = NODENUM_BROADCAST; - channel = 0; - lastDest = dest; - lastChannel = channel; - lastDestSet = true; - } else { - dest = lastDest; - channel = lastChannel; + // Use the requested destination, unless it's "broadcast" and we have a previous node/channel + if (newDest == NODENUM_BROADCAST && lastDestSet) { + newDest = lastDest; + newChannel = lastChannel; } + dest = newDest; + channel = newChannel; + lastDest = dest; + lastChannel = channel; + lastDestSet = true; + + // Rest of function unchanged... // Always select the first real canned message on activation int firstRealMsgIdx = 0; for (int i = 0; i < messagesCount; ++i) { @@ -95,10 +97,28 @@ void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChan notifyObservers(&e); } +void CannedMessageModule::LaunchRepeatDestination() +{ + if (!lastDestSet) { + LaunchWithDestination(NODENUM_BROADCAST, 0); + } else { + LaunchWithDestination(lastDest, lastChannel); + } +} + void CannedMessageModule::LaunchFreetextWithDestination(NodeNum newDest, uint8_t newChannel) { + // Use the requested destination, unless it's "broadcast" and we have a previous node/channel + if (newDest == NODENUM_BROADCAST && lastDestSet) { + newDest = lastDest; + newChannel = lastChannel; + } dest = newDest; channel = newChannel; + lastDest = dest; + lastChannel = channel; + lastDestSet = true; + runState = CANNED_MESSAGE_RUN_STATE_FREETEXT; requestFocus(); UIFrameEvent e; diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 55a0a1185..f65878dec 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -59,6 +59,7 @@ class CannedMessageModule : public SinglePortModule, public Observable Date: Sun, 27 Jul 2025 02:02:21 -0400 Subject: [PATCH 5/5] trunk check --- src/modules/CannedMessageModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index f65878dec..5b0481ac7 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -59,7 +59,7 @@ class CannedMessageModule : public SinglePortModule, public Observable