diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 3f3d02e4c..591d52bd0 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -143,7 +143,7 @@ jobs: merge-multiple: true - name: Test Report - uses: dorny/test-reporter@v2.1.1 + uses: dorny/test-reporter@v2.2.0 with: name: PlatformIO Tests path: testreport.xml diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 46916bf29..1fd8790f2 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,15 +8,15 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - checkov@3.2.489 - - renovate@41.169.1 + - checkov@3.2.492 + - renovate@42.5.4 - prettier@3.6.2 - - trufflehog@3.90.12 + - trufflehog@3.90.13 - yamllint@1.37.1 - bandit@1.8.6 - trivy@0.67.2 - taplo@0.10.0 - - ruff@0.14.3 + - ruff@0.14.4 - isort@7.0.0 - markdownlint@0.45.0 - oxipng@9.1.5 @@ -26,9 +26,9 @@ lint: - hadolint@2.14.0 - shfmt@3.6.0 - shellcheck@0.11.0 - - black@25.9.0 + - black@25.11.0 - git-diff-check - - gitleaks@8.28.0 + - gitleaks@8.29.0 - clang-format@16.0.3 ignore: - linters: [ALL] diff --git a/README.md b/README.md index a53fe9646..f34bf1839 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,3 @@ Join our community and help improve Meshtastic! ๐Ÿš€ ## Stats ![Alt](https://repobeats.axiom.co/api/embed/8025e56c482ec63541593cc5bd322c19d5c0bdcf.svg "Repobeats analytics image") - diff --git a/debian/changelog b/debian/changelog index e5b84d134..5a0f543eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ meshtasticd (2.7.16.0) unstable; urgency=medium -- GitHub Actions Wed, 19 Nov 2025 16:12:32 +0000 + meshtasticd (2.7.15.0) unstable; urgency=medium * Version 2.7.15 diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index f3b2e6960..b9152c4a3 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -50,6 +50,13 @@ BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(libinput) BuildRequires: pkgconfig(xkbcommon-x11) +# libbsd is needed on older Fedora/RHEL to provide 'strlcpy' +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 +BuildRequires: glibc-devel >= 2.38 +%else +BuildRequires: pkgconfig(libbsd-overlay) +%endif + Requires: systemd-udev %description diff --git a/platformio.ini b/platformio.ini index f9e2dd898..d6ff155e4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -62,7 +62,7 @@ monitor_speed = 115200 monitor_filters = direct lib_deps = # renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master - https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0cbc26b1f8f61957af0475f486b362eafe7cc4e2.zip + https://github.com/meshtastic/esp8266-oled-ssd1306/archive/2887bf4a19f64d92c984dcc8fd5ca7429e425e4a.zip # renovate: datasource=git-refs depName=meshtastic-OneButton packageName=https://github.com/meshtastic/OneButton gitBranch=master https://github.com/meshtastic/OneButton/archive/fa352d668c53f290cfa480a5f79ad422cd828c70.zip # renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master @@ -121,7 +121,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/19b7855e9a1d9deff37391659ca7194e4ef57c43.zip + https://github.com/meshtastic/device-ui/archive/28167c67dfd13015a0b5eef1828f95fe8e3ab7c3.zip ; Common libs for environmental measurements in telemetry module [environmental_base] diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index b662869dd..87593b0d4 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -427,33 +427,35 @@ static LGFX *tft = nullptr; #include "lgfx/v1/Touch.hpp" namespace lgfx { - inline namespace v1 - { +inline namespace v1 +{ class TOUCH_CHSC6X : public ITouch { -public: + public: TOUCH_CHSC6X(void) { - _cfg.i2c_addr = TOUCH_SLAVE_ADDRESS; - _cfg.x_min = 0; - _cfg.x_max = 240; - _cfg.y_min = 0; - _cfg.y_max = 320; + _cfg.i2c_addr = TOUCH_SLAVE_ADDRESS; + _cfg.x_min = 0; + _cfg.x_max = 240; + _cfg.y_min = 0; + _cfg.y_max = 320; }; - bool init(void) override { - if(chsc6xTouch==nullptr) { - chsc6xTouch=new chsc6x(&Wire1,TOUCH_SDA_PIN,TOUCH_SCL_PIN,TOUCH_INT_PIN,TOUCH_RST_PIN); + bool init(void) override + { + if (chsc6xTouch == nullptr) { + chsc6xTouch = new chsc6x(&Wire1, TOUCH_SDA_PIN, TOUCH_SCL_PIN, TOUCH_INT_PIN, TOUCH_RST_PIN); } chsc6xTouch->chsc6x_init(); return true; }; - uint_fast8_t getTouchRaw(touch_point_t* tp, uint_fast8_t count) override { - uint16_t raw_x,raw_y; - if (chsc6xTouch->chsc6x_read_touch_info(&raw_x, &raw_y)==0) { - tp[0].x = 320-1-raw_y; - tp[0].y = 240-1-raw_x ; + uint_fast8_t getTouchRaw(touch_point_t *tp, uint_fast8_t count) override + { + uint16_t raw_x, raw_y; + if (chsc6xTouch->chsc6x_read_touch_info(&raw_x, &raw_y) == 0) { + tp[0].x = 320 - 1 - raw_y; + tp[0].y = 240 - 1 - raw_x; tp[0].size = 1; tp[0].id = 1; return 1; @@ -462,13 +464,14 @@ public: return 0; }; - void wakeup(void) override {}; - void sleep(void) override {}; + void wakeup(void) override{}; + void sleep(void) override{}; + private: - chsc6x *chsc6xTouch=nullptr; - }; -} -} + chsc6x *chsc6xTouch = nullptr; +}; +} // namespace v1 +} // namespace lgfx #endif class LGFX : public lgfx::LGFX_Device { @@ -513,9 +516,9 @@ class LGFX : public lgfx::LGFX_Device { // Set the display panel control. auto cfg = _panel_instance.config(); // Gets a structure for display panel settings. - cfg.pin_cs = ST7789_CS; // Pin number where CS is connected (-1 = disable) - cfg.pin_rst = ST7789_RESET; // Pin number where RST is connected (-1 = disable) - cfg.pin_busy = ST7789_BUSY; // Pin number where BUSY is connected (-1 = disable) + cfg.pin_cs = ST7789_CS; // Pin number where CS is connected (-1 = disable) + cfg.pin_rst = ST7789_RESET; // Pin number where RST is connected (-1 = disable) + cfg.pin_busy = ST7789_BUSY; // Pin number where BUSY is connected (-1 = disable) // The following setting values โ€‹โ€‹are general initial values โ€‹โ€‹for each panel, so please comment out any // unknown items and try them. diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 2d9b775ab..d13cf4919 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -1312,7 +1312,9 @@ void menuHandler::BluetoothToggleMenu() bannerOptions.optionsArrayPtr = optionsArray; bannerOptions.optionsCount = 3; bannerOptions.bannerCallback = [](int selected) -> void { - if (selected == 1 || selected == 2) { + if (selected == 0) + return; + else if (selected != (config.bluetooth.enabled ? 1 : 2)) { InputEvent event = {.inputEvent = (input_broker_event)170, .kbchar = 170, .touchX = 0, .touchY = 0}; inputBroker->injectInputEvent(&event); } @@ -1729,7 +1731,7 @@ void menuHandler::screenOptionsMenu() optionsEnumArray[options++] = ScreenColor; #endif - optionsArray[options] = "Frame Visiblity Toggle"; + optionsArray[options] = "Frame Visibility Toggle"; optionsEnumArray[options++] = FrameToggles; optionsArray[options] = "Display Units"; diff --git a/src/graphics/niche/README.md b/src/graphics/niche/README.md index e87464abc..e58578f6b 100644 --- a/src/graphics/niche/README.md +++ b/src/graphics/niche/README.md @@ -5,7 +5,6 @@ A pattern / collection of resources for creating custom UIs, to target small gro For an example, see the `heltec-vision-master-e290-inkhud` platformio env. - platformio.ini - - suppress default Meshtastic components (Screen, ButtonThread, etc) - define `MESHTASTIC_INCLUDE_NICHE_GRAPHICS` - (possibly) Edit `build_src_filter` to include our new nicheGraphics.h file diff --git a/src/input/InputBroker.cpp b/src/input/InputBroker.cpp index 7e3ff3de9..0aa78e2b8 100644 --- a/src/input/InputBroker.cpp +++ b/src/input/InputBroker.cpp @@ -52,7 +52,7 @@ int InputBroker::handleInputEvent(const InputEvent *event) powerFSM.trigger(EVENT_INPUT); // todo: not every input should wake, like long hold release if (event && event->inputEvent != INPUT_BROKER_NONE && externalNotificationModule && - moduleConfig.external_notification.enabled) { + moduleConfig.external_notification.enabled && externalNotificationModule->nagging()) { externalNotificationModule->stopNow(); } diff --git a/src/main.cpp b/src/main.cpp index 8fec62953..fd376ea51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -477,6 +477,10 @@ void setup() #ifdef RESET_OLED pinMode(RESET_OLED, OUTPUT); digitalWrite(RESET_OLED, 1); + delay(2); + digitalWrite(RESET_OLED, 0); + delay(10); + digitalWrite(RESET_OLED, 1); #endif #ifdef SENSOR_POWER_CTRL_PIN diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6291fa4cc..d8146c4a3 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -653,7 +653,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32); #if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR) || \ - defined(ELECROW_PANEL)||defined(HELTEC_V4_TFT)) && \ + defined(ELECROW_PANEL) || defined(HELTEC_V4_TFT)) && \ HAS_TFT // switch BT off by default; use TFT programming mode or hotkey to enable config.bluetooth.enabled = false; diff --git a/src/modules/SystemCommandsModule.cpp b/src/modules/SystemCommandsModule.cpp index 1e6d5523e..d0bd64144 100644 --- a/src/modules/SystemCommandsModule.cpp +++ b/src/modules/SystemCommandsModule.cpp @@ -88,10 +88,8 @@ int SystemCommandsModule::handleInputEvent(const InputEvent *event) switch (event->inputEvent) { // GPS case INPUT_BROKER_GPS_TOGGLE: - LOG_WARN("GPS Toggle"); #if !MESHTASTIC_EXCLUDE_GPS if (gps) { - LOG_WARN("GPS Toggle2"); if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED && config.position.fixed_position == false) { nodeDB->clearLocalPosition(); diff --git a/src/modules/TraceRouteModule.cpp b/src/modules/TraceRouteModule.cpp index 5bdde1919..87a2f1bd2 100644 --- a/src/modules/TraceRouteModule.cpp +++ b/src/modules/TraceRouteModule.cpp @@ -11,6 +11,113 @@ extern graphics::Screen *screen; TraceRouteModule *traceRouteModule; +void TraceRouteModule::setResultText(const String &text) +{ + resultText = text; + resultLines.clear(); + resultLinesDirty = true; +} + +void TraceRouteModule::clearResultLines() +{ + resultLines.clear(); + resultLinesDirty = false; +} +#if HAS_SCREEN +void TraceRouteModule::rebuildResultLines(OLEDDisplay *display) +{ + if (!display) { + resultLinesDirty = false; + return; + } + + resultLines.clear(); + + if (resultText.length() == 0) { + resultLinesDirty = false; + return; + } + + int maxWidth = display->getWidth() - 4; + if (maxWidth <= 0) { + resultLinesDirty = false; + return; + } + + int start = 0; + int textLength = resultText.length(); + + while (start <= textLength) { + int newlinePos = resultText.indexOf('\n', start); + String segment; + + if (newlinePos != -1) { + segment = resultText.substring(start, newlinePos); + start = newlinePos + 1; + } else { + segment = resultText.substring(start); + start = textLength + 1; + } + + if (segment.length() == 0) { + resultLines.push_back(""); + continue; + } + + if (display->getStringWidth(segment) <= maxWidth) { + resultLines.push_back(segment); + continue; + } + + String remaining = segment; + + while (remaining.length() > 0) { + String tempLine = ""; + int lastGoodBreak = -1; + bool lineComplete = false; + + for (int i = 0; i < static_cast(remaining.length()); i++) { + char ch = remaining.charAt(i); + String testLine = tempLine + ch; + + if (display->getStringWidth(testLine) > maxWidth) { + if (lastGoodBreak >= 0) { + resultLines.push_back(remaining.substring(0, lastGoodBreak + 1)); + remaining = remaining.substring(lastGoodBreak + 1); + lineComplete = true; + break; + } else if (tempLine.length() > 0) { + resultLines.push_back(tempLine); + remaining = remaining.substring(i); + lineComplete = true; + break; + } else { + resultLines.push_back(String(ch)); + remaining = remaining.substring(i + 1); + lineComplete = true; + break; + } + } else { + tempLine = testLine; + if (ch == ' ' || ch == '>' || ch == '<' || ch == '-' || ch == '(' || ch == ')' || ch == ',') { + lastGoodBreak = i; + } + } + } + + if (!lineComplete) { + if (tempLine.length() > 0) { + resultLines.push_back(tempLine); + } + break; + } + } + } + + resultLinesDirty = false; +} +#endif + bool TraceRouteModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) { // We only alter the packet in alterReceivedProtobuf() @@ -406,7 +513,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) if (node == 0 || node == NODENUM_BROADCAST) { LOG_ERROR("Invalid node number for trace route: 0x%08x", node); runState = TRACEROUTE_STATE_RESULT; - resultText = "Invalid node"; + setResultText("Invalid node"); resultShowTime = millis(); tracingNode = 0; @@ -420,7 +527,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) if (node == nodeDB->getNodeNum()) { LOG_ERROR("Cannot trace route to self: 0x%08x", node); runState = TRACEROUTE_STATE_RESULT; - resultText = "Cannot trace self"; + setResultText("Cannot trace self"); resultShowTime = millis(); tracingNode = 0; @@ -447,6 +554,8 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) unsigned long wait = (cooldownMs - (now - lastTraceRouteTime)) / 1000; bannerText = String("Wait for ") + String(wait) + String("s"); runState = TRACEROUTE_STATE_COOLDOWN; + resultText = ""; + clearResultLines(); requestFocus(); UIFrameEvent e; @@ -459,6 +568,8 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) tracingNode = node; lastTraceRouteTime = now; runState = TRACEROUTE_STATE_TRACKING; + resultText = ""; + clearResultLines(); bannerText = String("Tracing ") + getNodeName(node); LOG_INFO("TraceRoute UI: Starting trace route to node 0x%08x, requesting focus", node); @@ -501,7 +612,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) } else { LOG_ERROR("MeshService is NULL!"); runState = TRACEROUTE_STATE_RESULT; - resultText = "Service unavailable"; + setResultText("Service unavailable"); resultShowTime = millis(); tracingNode = 0; @@ -514,7 +625,7 @@ bool TraceRouteModule::startTraceRoute(NodeNum node) } else { LOG_ERROR("Failed to allocate TraceRoute packet from router"); runState = TRACEROUTE_STATE_RESULT; - resultText = "Failed to send"; + setResultText("Failed to send"); resultShowTime = millis(); tracingNode = 0; @@ -532,7 +643,7 @@ void TraceRouteModule::launch(NodeNum node) if (node == 0 || node == NODENUM_BROADCAST) { LOG_ERROR("Invalid node number for trace route: 0x%08x", node); runState = TRACEROUTE_STATE_RESULT; - resultText = "Invalid node"; + setResultText("Invalid node"); resultShowTime = millis(); tracingNode = 0; @@ -546,7 +657,7 @@ void TraceRouteModule::launch(NodeNum node) if (node == nodeDB->getNodeNum()) { LOG_ERROR("Cannot trace route to self: 0x%08x", node); runState = TRACEROUTE_STATE_RESULT; - resultText = "Cannot trace self"; + setResultText("Cannot trace self"); resultShowTime = millis(); tracingNode = 0; @@ -568,6 +679,8 @@ void TraceRouteModule::launch(NodeNum node) unsigned long wait = (cooldownMs - (now - lastTraceRouteTime)) / 1000; bannerText = String("Wait for ") + String(wait) + String("s"); runState = TRACEROUTE_STATE_COOLDOWN; + resultText = ""; + clearResultLines(); requestFocus(); UIFrameEvent e; @@ -580,6 +693,8 @@ void TraceRouteModule::launch(NodeNum node) runState = TRACEROUTE_STATE_TRACKING; tracingNode = node; lastTraceRouteTime = now; + resultText = ""; + clearResultLines(); bannerText = String("Tracing ") + getNodeName(node); requestFocus(); @@ -614,14 +729,14 @@ void TraceRouteModule::launch(NodeNum node) } else { LOG_ERROR("MeshService is NULL!"); runState = TRACEROUTE_STATE_RESULT; - resultText = "Service unavailable"; + setResultText("Service unavailable"); resultShowTime = millis(); tracingNode = 0; } } else { LOG_ERROR("Failed to allocate TraceRoute packet from router"); runState = TRACEROUTE_STATE_RESULT; - resultText = "Failed to send"; + setResultText("Failed to send"); resultShowTime = millis(); tracingNode = 0; } @@ -629,7 +744,7 @@ void TraceRouteModule::launch(NodeNum node) void TraceRouteModule::handleTraceRouteResult(const String &result) { - resultText = result; + setResultText(result); runState = TRACEROUTE_STATE_RESULT; resultShowTime = millis(); tracingNode = 0; @@ -679,83 +794,15 @@ void TraceRouteModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state display->setFont(FONT_SMALL); if (resultText.length() > 0) { - std::vector lines; - String currentLine = ""; - int maxWidth = display->getWidth() - 4; - - int start = 0; - int newlinePos = resultText.indexOf('\n', start); - - while (newlinePos != -1 || start < static_cast(resultText.length())) { - String segment; - if (newlinePos != -1) { - segment = resultText.substring(start, newlinePos); - start = newlinePos + 1; - newlinePos = resultText.indexOf('\n', start); - } else { - segment = resultText.substring(start); - start = resultText.length(); - } - - if (display->getStringWidth(segment) <= maxWidth) { - lines.push_back(segment); - } else { - // Try to break at better positions (space, >, <, -) - String remaining = segment; - - while (remaining.length() > 0) { - String tempLine = ""; - int lastGoodBreak = -1; - bool lineComplete = false; - - for (int i = 0; i < static_cast(remaining.length()); i++) { - char ch = remaining.charAt(i); - String testLine = tempLine + ch; - - if (display->getStringWidth(testLine) > maxWidth) { - if (lastGoodBreak >= 0) { - // Break at the last good position - lines.push_back(remaining.substring(0, lastGoodBreak + 1)); - remaining = remaining.substring(lastGoodBreak + 1); - lineComplete = true; - break; - } else if (tempLine.length() > 0) { - lines.push_back(tempLine); - remaining = remaining.substring(i); - lineComplete = true; - break; - } else { - // Single character exceeds width - lines.push_back(String(ch)); - remaining = remaining.substring(i + 1); - lineComplete = true; - break; - } - } else { - tempLine = testLine; - // Mark good break positions - if (ch == ' ' || ch == '>' || ch == '<' || ch == '-' || ch == '(' || ch == ')') { - lastGoodBreak = i; - } - } - } - - if (!lineComplete) { - // Reached end of remaining text - if (tempLine.length() > 0) { - lines.push_back(tempLine); - } - break; - } - } - } + if (resultLinesDirty) { + rebuildResultLines(display); } int lineHeight = FONT_HEIGHT_SMALL + 1; // Use proper font height with 1px spacing - for (size_t i = 0; i < lines.size(); i++) { + for (size_t i = 0; i < resultLines.size(); i++) { int lineY = contentStartY + (i * lineHeight); if (lineY + FONT_HEIGHT_SMALL <= display->getHeight()) { - display->drawString(x + 2, lineY, lines[i]); + display->drawString(x + 2, lineY, resultLines[i]); } } } @@ -779,7 +826,7 @@ int32_t TraceRouteModule::runOnce() if (runState == TRACEROUTE_STATE_TRACKING && now - lastTraceRouteTime > trackingTimeoutMs) { LOG_INFO("TraceRoute timeout, no response received"); runState = TRACEROUTE_STATE_RESULT; - resultText = "No response received"; + setResultText("No response received"); resultShowTime = now; tracingNode = 0; @@ -815,6 +862,8 @@ int32_t TraceRouteModule::runOnce() // Cooldown finished LOG_INFO("TraceRoute cooldown finished, returning to IDLE"); runState = TRACEROUTE_STATE_IDLE; + resultText = ""; + clearResultLines(); bannerText = ""; UIFrameEvent e; e.action = UIFrameEvent::Action::REGENERATE_FRAMESET; @@ -828,6 +877,7 @@ int32_t TraceRouteModule::runOnce() LOG_INFO("TraceRoute result display timeout, returning to IDLE"); runState = TRACEROUTE_STATE_IDLE; resultText = ""; + clearResultLines(); bannerText = ""; tracingNode = 0; UIFrameEvent e; diff --git a/src/modules/TraceRouteModule.h b/src/modules/TraceRouteModule.h index dac422388..a40ed7733 100644 --- a/src/modules/TraceRouteModule.h +++ b/src/modules/TraceRouteModule.h @@ -7,6 +7,7 @@ #if HAS_SCREEN #include "OLEDDisplayUi.h" #endif +#include #define ROUTE_SIZE sizeof(((meshtastic_RouteDiscovery *)0)->route) / sizeof(((meshtastic_RouteDiscovery *)0)->route[0]) @@ -49,6 +50,11 @@ class TraceRouteModule : public ProtobufModule, virtual int32_t runOnce() override; private: + void setResultText(const String &text); + void clearResultLines(); +#if HAS_SCREEN + void rebuildResultLines(OLEDDisplay *display); +#endif // Call to add unknown hops (e.g. when a node couldn't decrypt it) to the route based on hopStart and current hopLimit void insertUnknownHops(meshtastic_MeshPacket &p, meshtastic_RouteDiscovery *r, bool isTowardsDestination); @@ -74,6 +80,8 @@ class TraceRouteModule : public ProtobufModule, unsigned long trackingTimeoutMs = 10000; String bannerText; String resultText; + std::vector resultLines; + bool resultLinesDirty = false; NodeNum tracingNode = 0; bool initialized = false; }; diff --git a/src/motion/BMX160Sensor.cpp b/src/motion/BMX160Sensor.cpp index 003ee850c..56f794306 100755 --- a/src/motion/BMX160Sensor.cpp +++ b/src/motion/BMX160Sensor.cpp @@ -116,6 +116,7 @@ void BMX160Sensor::calibrate(uint16_t forSeconds) { #if !defined(MESHTASTIC_EXCLUDE_SCREEN) LOG_DEBUG("BMX160 calibration started for %is", forSeconds); + highestX = 0, lowestX = 0, highestY = 0, lowestY = 0, highestZ = 0, lowestZ = 0; doCalibration = true; uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided @@ -127,4 +128,4 @@ void BMX160Sensor::calibrate(uint16_t forSeconds) #endif -#endif \ No newline at end of file +#endif diff --git a/src/motion/ICM20948Sensor.cpp b/src/motion/ICM20948Sensor.cpp index 76ba8e8cf..ebb0f7b66 100755 --- a/src/motion/ICM20948Sensor.cpp +++ b/src/motion/ICM20948Sensor.cpp @@ -157,6 +157,7 @@ void ICM20948Sensor::calibrate(uint16_t forSeconds) { #if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN LOG_DEBUG("BMX160 calibration started for %is", forSeconds); + highestX = 0, lowestX = 0, highestY = 0, lowestY = 0, highestZ = 0, lowestZ = 0; doCalibration = true; uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided @@ -295,4 +296,4 @@ bool ICM20948Singleton::setWakeOnMotion() return true; } -#endif \ No newline at end of file +#endif diff --git a/src/motion/MotionSensor.cpp b/src/motion/MotionSensor.cpp index b00460aff..d0bfe4e2c 100755 --- a/src/motion/MotionSensor.cpp +++ b/src/motion/MotionSensor.cpp @@ -69,7 +69,8 @@ void MotionSensor::wakeScreen() { if (powerFSM.getState() == &stateDARK) { LOG_DEBUG("Motion wakeScreen detected"); - powerFSM.trigger(EVENT_INPUT); + if (config.display.wake_on_tap_or_motion) + powerFSM.trigger(EVENT_INPUT); } } @@ -87,4 +88,4 @@ void MotionSensor::buttonPress() {} #endif -#endif \ No newline at end of file +#endif diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index babbcfd7c..ad35e152a 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -692,7 +692,10 @@ void MQTT::publishNodeInfo() } void MQTT::publishQueuedMessages() { - if (mqttQueue.isEmpty() || !isConnected) + if (mqttQueue.isEmpty()) + return; + + if (!moduleConfig.mqtt.proxy_to_client_enabled && !isConnected) return; LOG_DEBUG("Publish enqueued MQTT message"); diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 76cde3cae..69da25884 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -20,13 +20,14 @@ #include "PowerStatus.h" #endif -#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) #if defined(CONFIG_NIMBLE_CPP_IDF) #include "host/ble_gap.h" #else #include "nimble/nimble/host/include/host/ble_gap.h" #endif +#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) + namespace { constexpr uint16_t kPreferredBleMtu = 517; @@ -776,16 +777,35 @@ bool NimbleBluetooth::isConnected() int NimbleBluetooth::getRssi() { - if (bleServer && isConnected()) { - auto service = bleServer->getServiceByUUID(MESH_SERVICE_UUID); - uint16_t handle = service->getHandle(); -#ifdef NIMBLE_TWO - return NimBLEDevice::getClientByHandle(handle)->getRssi(); -#else - return NimBLEDevice::getClientByID(handle)->getRssi(); -#endif +#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) + if (!bleServer || !isConnected()) { + return 0; // No active BLE connection } - return 0; // FIXME figure out where to source this + + uint16_t connHandle = nimbleBluetoothConnHandle.load(); + + if (connHandle == BLE_HS_CONN_HANDLE_NONE) { + const auto peers = bleServer->getPeerDevices(); + if (!peers.empty()) { + connHandle = peers.front(); + nimbleBluetoothConnHandle = connHandle; + } + } + + if (connHandle == BLE_HS_CONN_HANDLE_NONE) { + return 0; // Connection handle not available yet + } + + int8_t rssi = 0; + const int rc = ble_gap_conn_rssi(connHandle, &rssi); + + if (rc == 0) { + return rssi; + } + LOG_DEBUG("BLE RSSI read failed, rc=%d", rc); +#endif + + return 0; } void NimbleBluetooth::setup() diff --git a/version.properties b/version.properties index 3dde9b1a3..05d8a493f 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 7 -build = 16 +build = 16 \ No newline at end of file