From 13e1f99c7e6ce507028f19282ab987701257d182 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 05:58:47 -0500 Subject: [PATCH 1/7] Upgrade trunk (#8078) Co-authored-by: vidplace7 <1779290+vidplace7@users.noreply.github.com> --- .trunk/trunk.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f23c41810..4dd040287 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,14 +9,14 @@ plugins: lint: enabled: - checkov@3.2.471 - - renovate@41.115.6 + - renovate@41.118.1 - prettier@3.6.2 - - trufflehog@3.90.6 + - trufflehog@3.90.8 - yamllint@1.37.1 - bandit@1.8.6 - trivy@0.66.0 - taplo@0.10.0 - - ruff@0.13.0 + - ruff@0.13.1 - isort@6.0.1 - markdownlint@0.45.0 - oxipng@9.1.5 @@ -26,7 +26,7 @@ lint: - hadolint@2.13.1 - shfmt@3.6.0 - shellcheck@0.11.0 - - black@25.1.0 + - black@25.9.0 - git-diff-check - gitleaks@8.28.0 - clang-format@16.0.3 From db941bff3b0f7ecad1825bd8611876ff520f132a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 22 Sep 2025 12:00:01 -0500 Subject: [PATCH 2/7] portduino bump to fix gpiod bug (#8083) An earlier portduino causes problems with initializing gpiod lines. This pulls in the fix. --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 95c3bf3d9..f3fd00de7 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -2,7 +2,7 @@ [portduino_base] platform = # renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop - https://github.com/meshtastic/platform-native/archive/c490bcd019e0658404088a61b96e653c9da22c45.zip + https://github.com/meshtastic/platform-native/archive/d3f6e339534233c7217818867368767590ce549e.zip framework = arduino build_src_filter = From e1485b530ffc6525981260d2d56aee6905ea7035 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 22 Sep 2025 19:59:05 -0500 Subject: [PATCH 3/7] Handle ext. notification module things even if not enabled (#8089) --- src/modules/Modules.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index b3c15e764..bd8997493 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -293,9 +293,7 @@ void setupModules() #endif #endif #if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION - if (moduleConfig.has_external_notification && moduleConfig.external_notification.enabled) { - externalNotificationModule = new ExternalNotificationModule(); - } + externalNotificationModule = new ExternalNotificationModule(); #endif #if !MESHTASTIC_EXCLUDE_RANGETEST && !MESHTASTIC_EXCLUDE_GPS if (moduleConfig.has_range_test && moduleConfig.range_test.enabled) From 07b58a82d516e404691956436e3ed6a5401e224d Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 22 Sep 2025 21:06:23 -0500 Subject: [PATCH 4/7] tlora-pager wake on button, and kb backlight toggling (#8090) --- src/graphics/Screen.cpp | 18 ++++++++++++++++++ src/graphics/Screen.h | 10 +--------- src/input/TCA8418KeyboardBase.cpp | 5 +++++ src/input/TCA8418KeyboardBase.h | 2 ++ src/input/TLoraPagerKeyboard.cpp | 16 +++++++++------- src/input/TLoraPagerKeyboard.h | 1 + src/input/kbI2cBase.cpp | 10 +++++++++- src/input/kbI2cBase.h | 1 + src/main.cpp | 1 + src/sleep.cpp | 17 +++++++++++++---- 10 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 007ce56ea..d52b3dfb7 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -83,6 +83,11 @@ extern uint16_t TFT_MESH; #include "platform/portduino/PortduinoGlue.h" #endif +#if defined(T_LORA_PAGER) +// KB backlight control +#include "input/cardKbI2cImpl.h" +#endif + using namespace meshtastic; /** @todo remove */ namespace graphics @@ -617,6 +622,19 @@ void Screen::setup() MeshModule::observeUIEvents(&uiFrameEventObserver); } +void Screen::setOn(bool on, FrameCallback einkScreensaver) +{ +#if defined(T_LORA_PAGER) + if (cardKbI2cImpl) + cardKbI2cImpl->toggleBacklight(on); +#endif + if (!on) + // We handle off commands immediately, because they might be called because the CPU is shutting down + handleSetOn(false, einkScreensaver); + else + enqueueCmd(ScreenCmd{.cmd = Cmd::SET_ON}); +} + void Screen::forceDisplay(bool forceUiUpdate) { // Nasty hack to force epaper updates for 'key' frames. FIXME, cleanup. diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 262ba4175..35058903b 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -259,15 +259,7 @@ class Screen : public concurrency::OSThread void setup(); /// Turns the screen on/off. Optionally, pass a custom screensaver frame for E-Ink - void setOn(bool on, FrameCallback einkScreensaver = NULL) - { - if (!on) - // We handle off commands immediately, because they might be called because the CPU is shutting down - handleSetOn(false, einkScreensaver); - else - enqueueCmd(ScreenCmd{.cmd = Cmd::SET_ON}); - } - + void setOn(bool on, FrameCallback einkScreensaver = NULL); /** * Prepare the display for the unit going to the lowest power mode possible. Most screens will just * poweroff, but eink screens will show a "I'm sleeping" graphic, possibly with a QR code diff --git a/src/input/TCA8418KeyboardBase.cpp b/src/input/TCA8418KeyboardBase.cpp index aafc4c36c..00aed9962 100644 --- a/src/input/TCA8418KeyboardBase.cpp +++ b/src/input/TCA8418KeyboardBase.cpp @@ -200,6 +200,11 @@ uint8_t TCA8418KeyboardBase::flush() return count; } +void TCA8418KeyboardBase::clearInt() +{ + writeRegister(TCA8418_REG_INT_STAT, 3); +} + uint8_t TCA8418KeyboardBase::digitalRead(uint8_t pinnum) const { if (pinnum > TCA8418_COL9) diff --git a/src/input/TCA8418KeyboardBase.h b/src/input/TCA8418KeyboardBase.h index 5d6c4f7e9..8e509ac7e 100644 --- a/src/input/TCA8418KeyboardBase.h +++ b/src/input/TCA8418KeyboardBase.h @@ -37,6 +37,8 @@ class TCA8418KeyboardBase virtual void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = TCA8418_KB_ADDR); virtual void reset(void); + void clearInt(void); + virtual void trigger(void); virtual void setBacklight(bool on); diff --git a/src/input/TLoraPagerKeyboard.cpp b/src/input/TLoraPagerKeyboard.cpp index b3f62a36c..9a4fd8679 100644 --- a/src/input/TLoraPagerKeyboard.cpp +++ b/src/input/TLoraPagerKeyboard.cpp @@ -105,7 +105,14 @@ void TLoraPagerKeyboard::trigger() void TLoraPagerKeyboard::setBacklight(bool on) { - toggleBacklight(!on); + uint32_t _brightness = 0; + if (on) + _brightness = brightness; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) + ledcWrite(KB_BL_PIN, _brightness); +#else + ledcWrite(LEDC_BACKLIGHT_CHANNEL, _brightness); +#endif } void TLoraPagerKeyboard::pressed(uint8_t key) @@ -192,7 +199,6 @@ void TLoraPagerKeyboard::hapticFeedback() // toggle brightness of the backlight in three steps void TLoraPagerKeyboard::toggleBacklight(bool off) { - static uint32_t brightness = 0; if (off) { brightness = 0; } else { @@ -206,11 +212,7 @@ void TLoraPagerKeyboard::toggleBacklight(bool off) } LOG_DEBUG("Toggle backlight: %d", brightness); -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) - ledcWrite(KB_BL_PIN, brightness); -#else - ledcWrite(LEDC_BACKLIGHT_CHANNEL, brightness); -#endif + setBacklight(true); } void TLoraPagerKeyboard::updateModifierFlag(uint8_t key) diff --git a/src/input/TLoraPagerKeyboard.h b/src/input/TLoraPagerKeyboard.h index 4dabbac64..f04d2ce6a 100644 --- a/src/input/TLoraPagerKeyboard.h +++ b/src/input/TLoraPagerKeyboard.h @@ -26,4 +26,5 @@ class TLoraPagerKeyboard : public TCA8418KeyboardBase uint32_t last_tap; uint8_t char_idx; int32_t tap_interval; + uint32_t brightness = 0; }; diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 3f5d4d184..0ed2df116 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -333,6 +333,7 @@ int32_t KbI2cBase::runOnce() } TCAKeyboard.trigger(); } + TCAKeyboard.clearInt(); break; } case 0x02: { @@ -519,4 +520,11 @@ int32_t KbI2cBase::runOnce() LOG_WARN("Unknown kb_model 0x%02x", kb_model); } return 300; -} \ No newline at end of file +} + +void KbI2cBase::toggleBacklight(bool on) +{ +#if defined(T_LORA_PAGER) + TCAKeyboard.setBacklight(on); +#endif +} diff --git a/src/input/kbI2cBase.h b/src/input/kbI2cBase.h index af7602979..ae769dff8 100644 --- a/src/input/kbI2cBase.h +++ b/src/input/kbI2cBase.h @@ -12,6 +12,7 @@ class KbI2cBase : public Observable, public concurrency::OST { public: explicit KbI2cBase(const char *name); + void toggleBacklight(bool on); protected: virtual int32_t runOnce() override; diff --git a/src/main.cpp b/src/main.cpp index 107944dd5..ecaea26f7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -367,6 +367,7 @@ void setup() digitalWrite(SDCARD_CS, HIGH); pinMode(TFT_CS, OUTPUT); digitalWrite(TFT_CS, HIGH); + pinMode(KB_INT, INPUT_PULLUP); // io expander io.begin(Wire, XL9555_SLAVE_ADDRESS0, SDA, SCL); io.pinMode(EXPANDS_DRV_EN, OUTPUT); diff --git a/src/sleep.cpp b/src/sleep.cpp index d6eb865e5..0f8931292 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -411,12 +411,16 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r // assert(uart_set_wakeup_threshold(UART_NUM_0, 3) == ESP_OK); // assert(esp_sleep_enable_uart_wakeup(0) == ESP_OK); #endif -#ifdef BUTTON_PIN +#ifdef ROTARY_PRESS // The enableLoraInterrupt() method is using ext0_wakeup, so we are forced to use GPIO wakeup + gpio_wakeup_enable((gpio_num_t)ROTARY_PRESS, GPIO_INTR_LOW_LEVEL); +#endif +#ifdef KB_INT + gpio_wakeup_enable((gpio_num_t)KB_INT, GPIO_INTR_LOW_LEVEL); +#endif +#ifdef BUTTON_PIN gpio_num_t pin = (gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN); - gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL); - esp_sleep_enable_gpio_wakeup(); #endif #ifdef INPUTDRIVER_ENCODER_BTN gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL); @@ -450,7 +454,12 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r // commented out because it's not that crucial; // if it sporadically happens the node will go into light sleep during the next round // assert(res == ESP_OK); - +#ifdef ROTARY_PRESS + gpio_wakeup_disable((gpio_num_t)ROTARY_PRESS); +#endif +#ifdef KB_INT + gpio_wakeup_disable((gpio_num_t)KB_INT); +#endif #ifdef BUTTON_PIN // Disable wake-on-button interrupt. Re-attach normal button-interrupts gpio_wakeup_disable(pin); From f77ca2533bfa85d841efc81c614826cecfa1c79f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 22 Sep 2025 21:46:35 -0500 Subject: [PATCH 5/7] Try-fix: Unstick that PhoneAPI state (#8091) Co-authored-by: Jonathan Bennett --- src/mesh/PhoneAPI.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 9fb1b589f..f6f1bc027 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -250,6 +250,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) if (config_nonce == SPECIAL_NONCE_ONLY_NODES) { // If client only wants node info, jump directly to sending nodes state = STATE_SEND_OTHER_NODEINFOS; + onNowHasData(0); } else { state = STATE_SEND_METADATA; } @@ -423,6 +424,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) state = STATE_SEND_FILEMANIFEST; } else { state = STATE_SEND_OTHER_NODEINFOS; + onNowHasData(0); } config_state = 0; } @@ -588,6 +590,7 @@ bool PhoneAPI::available() nodeInfoForPhone.snr = isUs ? 0 : nodeInfoForPhone.snr; nodeInfoForPhone.via_mqtt = isUs ? false : nodeInfoForPhone.via_mqtt; nodeInfoForPhone.is_favorite = nodeInfoForPhone.is_favorite || isUs; // Our node is always a favorite + onNowHasData(0); } } return true; // Always say we have something, because we might need to advance our state machine From a8c66547cce2a96a3429087ec17fcfa1292a3d8f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 22 Sep 2025 21:46:57 -0500 Subject: [PATCH 6/7] Also pull a deviceID from esp32c6 devices (#8092) --- src/mesh/NodeDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 237b4286c..97dfb3e52 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -204,7 +204,7 @@ NodeDB::NodeDB() int saveWhat = 0; // Get device unique id -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) uint32_t unique_id[4]; // ESP32 factory burns a unique id in efuse for S2+ series and evidently C3+ series // This is used for HMACs in the esp-rainmaker AIOT platform and seems to be a good choice for us From 91efaba3890275d992f9d61125e4dd20dce731c3 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 22 Sep 2025 21:59:00 -0500 Subject: [PATCH 7/7] Remove line from BLE pin screen, to make pin readible on tiny screens --- src/nimble/NimbleBluetooth.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index accf6c5dc..13446be45 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -174,11 +174,11 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks display->setTextAlignment(TEXT_ALIGN_CENTER); display->setFont(FONT_MEDIUM); display->drawString(x_offset + x, y_offset + y, "Bluetooth"); - +#if !defined(M5STACK_UNITC6L) display->setFont(FONT_SMALL); y_offset = display->height() == 64 ? y_offset + FONT_HEIGHT_MEDIUM - 4 : y_offset + FONT_HEIGHT_MEDIUM + 5; display->drawString(x_offset + x, y_offset + y, "Enter this code"); - +#endif display->setFont(FONT_LARGE); char pin[8]; snprintf(pin, sizeof(pin), "%.3s %.3s", btPIN, btPIN + 3);