From 247e05bb10ff93520b17b44b0705381ef48ff4bc Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Jun 2025 16:59:04 -0500 Subject: [PATCH 1/6] Get the unphone to stop bootlooping: increase MAX_THREADS everywhere (#7106) --- platformio.ini | 1 + variants/heltec_vision_master_e213/platformio.ini | 1 - variants/heltec_vision_master_e290/platformio.ini | 1 - variants/heltec_wireless_paper/platformio.ini | 1 - variants/mesh-tab/platformio.ini | 1 - variants/t-deck/platformio.ini | 1 - variants/tlora_t3s3_epaper/platformio.ini | 1 - variants/unphone/variant.h | 3 +-- 8 files changed, 2 insertions(+), 8 deletions(-) diff --git a/platformio.ini b/platformio.ini index debc77a92..5a95648bc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -51,6 +51,7 @@ build_flags = -Wno-missing-field-initializers -DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1 -DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware -DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1 + -D MAX_THREADS=40 ; As we've split modules, we have more threads to manage #-DBUILD_EPOCH=$UNIX_TIME #-D OLED_PL=1 diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 037d10168..34cebb6e3 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -32,7 +32,6 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_vision_master_e213 -D HELTEC_VISION_MASTER_E213 - -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index 6952e9f9e..cda3fde00 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -36,7 +36,6 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_vision_master_e290 -D HELTEC_VISION_MASTER_E290 - -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index 51430ebff..ce5b5e533 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -33,7 +33,6 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_wireless_paper -D HELTEC_WIRELESS_PAPER - -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 728fa5100..beeb58a48 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -28,7 +28,6 @@ build_flags = ${esp32s3_base.build_flags} -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D RADIOLIB_SPI_PARANOID=0 - -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 -D USE_PIN_BUZZER diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index c00ab5e04..04e305abb 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -9,7 +9,6 @@ upload_protocol = esptool build_flags = ${esp32s3_base.build_flags} -DT_DECK -DBOARD_HAS_PSRAM - -DMAX_THREADS=40 -DGPS_POWER_TOGGLE -Ivariants/t-deck diff --git a/variants/tlora_t3s3_epaper/platformio.ini b/variants/tlora_t3s3_epaper/platformio.ini index 957c37b95..0750b5bbb 100644 --- a/variants/tlora_t3s3_epaper/platformio.ini +++ b/variants/tlora_t3s3_epaper/platformio.ini @@ -31,7 +31,6 @@ build_flags = ${inkhud.build_flags} -I variants/tlora_t3s3_epaper -D TLORA_T3S3_EPAPER - -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} \ No newline at end of file diff --git a/variants/unphone/variant.h b/variants/unphone/variant.h index aef650278..e186b5740 100644 --- a/variants/unphone/variant.h +++ b/variants/unphone/variant.h @@ -57,8 +57,7 @@ #define LED_PIN 13 // the red part of the RGB LED #define LED_STATE_ON 0 // State when LED is lit -#define ALT_BUTTON_PIN 21 // Button 3 - square - top button in landscape mode -#define BUTTON_NEED_PULLUP2 TB_UP +#define ALT_BUTTON_PIN 21 // Button 3 - square - top button in landscape mode #define BUTTON_PIN 0 // Circle button #define BUTTON_NEED_PULLUP // we do need a helping hand up #define CANCEL_BUTTON_PIN 45 // Button 1 - triangle - bottom button in landscape mode From 0808f5215ffa3beb8240349170eca65dfadb5b24 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Jun 2025 18:48:16 -0500 Subject: [PATCH 2/6] fix mismatch between Exclude FSM include names (#7107) --- src/PowerFSM.cpp | 2 +- src/PowerFSM.h | 2 +- src/PowerFSMThread.h | 2 +- src/modules/AdminModule.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index b3a6b17ef..3b3f8080d 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -26,7 +26,7 @@ #ifndef SLEEP_TIME #define SLEEP_TIME 30 #endif -#if EXCLUDE_POWER_FSM +#if MESHTASTIC_EXCLUDE_POWER_FSM FakeFsm powerFSM; void PowerFSM_setup(){}; #else diff --git a/src/PowerFSM.h b/src/PowerFSM.h index beb233f11..6330a5fc6 100644 --- a/src/PowerFSM.h +++ b/src/PowerFSM.h @@ -22,7 +22,7 @@ #define EVENT_SHUTDOWN 16 // force a full shutdown now (not just sleep) #define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen -#if EXCLUDE_POWER_FSM +#if MESHTASTIC_EXCLUDE_POWER_FSM class FakeFsm { public: diff --git a/src/PowerFSMThread.h b/src/PowerFSMThread.h index c842f4515..135f53298 100644 --- a/src/PowerFSMThread.h +++ b/src/PowerFSMThread.h @@ -18,7 +18,7 @@ class PowerFSMThread : public OSThread protected: int32_t runOnce() override { -#if !EXCLUDE_POWER_FSM +#if !MESHTASTIC_EXCLUDE_POWER_FSM powerFSM.run_machine(); /// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index b68a3a1a4..d489231ad 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -1137,7 +1137,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r #endif #endif conn.has_serial = true; // No serial-less devices -#if !EXCLUDE_POWER_FSM +#if !MESHTASTIC_EXCLUDE_POWER_FSM conn.serial.is_connected = powerFSM.getState() == &stateSERIAL; #else conn.serial.is_connected = powerFSM.getState(); From 012f88e56fa13c36a9fee5c0a7d4a680f9db77cb Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 22 Jun 2025 20:57:39 -0500 Subject: [PATCH 3/6] Make the 4-way on the L1 work on press instead of release (#7108) --- src/input/TrackballInterruptBase.cpp | 21 ++++++++--------- src/input/TrackballInterruptBase.h | 14 ++++++++---- src/input/TrackballInterruptImpl1.cpp | 30 ++++++++++++++++++++----- variants/seeed_wio_tracker_L1/variant.h | 1 + 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/input/TrackballInterruptBase.cpp b/src/input/TrackballInterruptBase.cpp index 41045ee8e..d41ad2fd6 100644 --- a/src/input/TrackballInterruptBase.cpp +++ b/src/input/TrackballInterruptBase.cpp @@ -12,6 +12,7 @@ void TrackballInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLef this->_pinUp = pinUp; this->_pinLeft = pinLeft; this->_pinRight = pinRight; + this->_pinPress = pinPress; this->_eventDown = eventDown; this->_eventUp = eventUp; this->_eventLeft = eventLeft; @@ -20,23 +21,23 @@ void TrackballInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLef if (pinPress != 255) { pinMode(pinPress, INPUT_PULLUP); - attachInterrupt(pinPress, onIntPress, RISING); + attachInterrupt(pinPress, onIntPress, TB_DIRECTION); } if (this->_pinDown != 255) { pinMode(this->_pinDown, INPUT_PULLUP); - attachInterrupt(this->_pinDown, onIntDown, RISING); + attachInterrupt(this->_pinDown, onIntDown, TB_DIRECTION); } if (this->_pinUp != 255) { pinMode(this->_pinUp, INPUT_PULLUP); - attachInterrupt(this->_pinUp, onIntUp, RISING); + attachInterrupt(this->_pinUp, onIntUp, TB_DIRECTION); } if (this->_pinLeft != 255) { pinMode(this->_pinLeft, INPUT_PULLUP); - attachInterrupt(this->_pinLeft, onIntLeft, RISING); + attachInterrupt(this->_pinLeft, onIntLeft, TB_DIRECTION); } if (this->_pinRight != 255) { pinMode(this->_pinRight, INPUT_PULLUP); - attachInterrupt(this->_pinRight, onIntRight, RISING); + attachInterrupt(this->_pinRight, onIntRight, TB_DIRECTION); } LOG_DEBUG("Trackball GPIO initialized (%d, %d, %d, %d, %d)", this->_pinUp, this->_pinDown, this->_pinLeft, this->_pinRight, @@ -67,19 +68,19 @@ int32_t TrackballInterruptBase::runOnce() e.inputEvent = this->_eventRight; } #else - if (this->action == TB_ACTION_PRESSED) { + if (this->action == TB_ACTION_PRESSED && !digitalRead(_pinPress)) { // LOG_DEBUG("Trackball event Press"); e.inputEvent = this->_eventPressed; - } else if (this->action == TB_ACTION_UP) { + } else if (this->action == TB_ACTION_UP && !digitalRead(_pinUp)) { // LOG_DEBUG("Trackball event UP"); e.inputEvent = this->_eventUp; - } else if (this->action == TB_ACTION_DOWN) { + } else if (this->action == TB_ACTION_DOWN && !digitalRead(_pinDown)) { // LOG_DEBUG("Trackball event DOWN"); e.inputEvent = this->_eventDown; - } else if (this->action == TB_ACTION_LEFT) { + } else if (this->action == TB_ACTION_LEFT && !digitalRead(_pinLeft)) { // LOG_DEBUG("Trackball event LEFT"); e.inputEvent = this->_eventLeft; - } else if (this->action == TB_ACTION_RIGHT) { + } else if (this->action == TB_ACTION_RIGHT && !digitalRead(_pinRight)) { // LOG_DEBUG("Trackball event RIGHT"); e.inputEvent = this->_eventRight; } diff --git a/src/input/TrackballInterruptBase.h b/src/input/TrackballInterruptBase.h index dac31a137..2397839b9 100644 --- a/src/input/TrackballInterruptBase.h +++ b/src/input/TrackballInterruptBase.h @@ -3,6 +3,10 @@ #include "InputBroker.h" #include "mesh/NodeDB.h" +#ifndef TB_DIRECTION +#define TB_DIRECTION RISING +#endif + class TrackballInterruptBase : public Observable, public concurrency::OSThread { public: @@ -16,6 +20,7 @@ class TrackballInterruptBase : public Observable, public con void intUpHandler(); void intLeftHandler(); void intRightHandler(); + uint32_t lastTime = 0; virtual int32_t runOnce() override; @@ -28,14 +33,15 @@ class TrackballInterruptBase : public Observable, public con TB_ACTION_LEFT, TB_ACTION_RIGHT }; - - volatile TrackballInterruptBaseActionType action = TB_ACTION_NONE; - - private: uint8_t _pinDown = 0; uint8_t _pinUp = 0; uint8_t _pinLeft = 0; uint8_t _pinRight = 0; + uint8_t _pinPress = 0; + + volatile TrackballInterruptBaseActionType action = TB_ACTION_NONE; + + private: input_broker_event _eventDown = INPUT_BROKER_NONE; input_broker_event _eventUp = INPUT_BROKER_NONE; input_broker_event _eventLeft = INPUT_BROKER_NONE; diff --git a/src/input/TrackballInterruptImpl1.cpp b/src/input/TrackballInterruptImpl1.cpp index c6d21ac2b..896238f38 100644 --- a/src/input/TrackballInterruptImpl1.cpp +++ b/src/input/TrackballInterruptImpl1.cpp @@ -23,21 +23,41 @@ void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLe void TrackballInterruptImpl1::handleIntDown() { - trackballInterruptImpl1->intDownHandler(); + if (TB_DIRECTION == RISING || millis() > trackballInterruptImpl1->lastTime + 10) { + trackballInterruptImpl1->lastTime = millis(); + trackballInterruptImpl1->intDownHandler(); + trackballInterruptImpl1->setIntervalFromNow(20); + } } void TrackballInterruptImpl1::handleIntUp() { - trackballInterruptImpl1->intUpHandler(); + if (TB_DIRECTION == RISING || millis() > trackballInterruptImpl1->lastTime + 10) { + trackballInterruptImpl1->lastTime = millis(); + trackballInterruptImpl1->intUpHandler(); + trackballInterruptImpl1->setIntervalFromNow(20); + } } void TrackballInterruptImpl1::handleIntLeft() { - trackballInterruptImpl1->intLeftHandler(); + if (TB_DIRECTION == RISING || millis() > trackballInterruptImpl1->lastTime + 10) { + trackballInterruptImpl1->lastTime = millis(); + trackballInterruptImpl1->intLeftHandler(); + trackballInterruptImpl1->setIntervalFromNow(20); + } } void TrackballInterruptImpl1::handleIntRight() { - trackballInterruptImpl1->intRightHandler(); + if (TB_DIRECTION == RISING || millis() > trackballInterruptImpl1->lastTime + 10) { + trackballInterruptImpl1->lastTime = millis(); + trackballInterruptImpl1->intRightHandler(); + trackballInterruptImpl1->setIntervalFromNow(20); + } } void TrackballInterruptImpl1::handleIntPressed() { - trackballInterruptImpl1->intPressHandler(); + if (TB_DIRECTION == RISING || millis() > trackballInterruptImpl1->lastTime + 10) { + trackballInterruptImpl1->lastTime = millis(); + trackballInterruptImpl1->intPressHandler(); + trackballInterruptImpl1->setIntervalFromNow(20); + } } diff --git a/variants/seeed_wio_tracker_L1/variant.h b/variants/seeed_wio_tracker_L1/variant.h index daa6afb8e..0c5964c5a 100644 --- a/variants/seeed_wio_tracker_L1/variant.h +++ b/variants/seeed_wio_tracker_L1/variant.h @@ -169,6 +169,7 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define TB_LEFT 27 #define TB_RIGHT 28 #define TB_PRESS 29 +#define TB_DIRECTION FALLING // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // Compatibility Definitions // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ From 38896198f2c5291da4bf8e47d385053b0bbd83ab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:04:55 -0500 Subject: [PATCH 4/6] chore(deps): update meshtastic/device-ui digest to cdc6e5b (#7112) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 5a95648bc..abb23fb22 100644 --- a/platformio.ini +++ b/platformio.ini @@ -109,7 +109,7 @@ lib_deps = [device-ui_base] lib_deps = # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master - https://github.com/meshtastic/device-ui/archive/d99edaf43775c9b235aab20521b034c99e04e4a8.zip + https://github.com/meshtastic/device-ui/archive/cdc6e5bdeedb8293d10e4a02be6ca64e95a7c515.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 4802cef3ca890cf8315b3b8bb4429c164a86774b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:56:02 +1000 Subject: [PATCH 5/6] chore(deps): update radiolib to v7.2.0 (#7098) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index abb23fb22..693fdc9c3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -104,7 +104,7 @@ lib_deps = [radiolib_base] lib_deps = # renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib - jgromes/RadioLib@7.1.2 + jgromes/RadioLib@7.2.0 [device-ui_base] lib_deps = From 91bcf072a080b071a30f90d49b54d24c0264ed11 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 24 Jun 2025 05:27:40 -0500 Subject: [PATCH 6/6] Tweak interval trottling (#7113) --- src/mesh/Default.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesh/Default.h b/src/mesh/Default.h index 208f992c8..fd3f10668 100644 --- a/src/mesh/Default.h +++ b/src/mesh/Default.h @@ -61,12 +61,17 @@ class Default throttlingFactor = 0.04; else if (config.lora.use_preset && config.lora.modem_preset == meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST) throttlingFactor = 0.02; - else if (config.lora.use_preset && config.lora.modem_preset == meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW) - throttlingFactor = 0.01; else if (config.lora.use_preset && IS_ONE_OF(config.lora.modem_preset, meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST, - meshtastic_Config_LoRaConfig_ModemPreset_SHORT_TURBO)) - return 1.0; // Don't bother throttling for highest bandwidth presets + meshtastic_Config_LoRaConfig_ModemPreset_SHORT_TURBO, + meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW)) + throttlingFactor = 0.01; + +#if USERPREFS_EVENT_MODE + // If we are in event mode, scale down the throttling factor + throttlingFactor = 0.04; +#endif + // Scaling up traffic based on number of nodes over 40 int nodesOverForty = (numOnlineNodes - 40); return 1.0 + (nodesOverForty * throttlingFactor); // Each number of online node scales by 0.075 (default)