From 5c005aaed5910f56d6e47aa6c35e2ba86653d049 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Thu, 1 May 2025 12:28:05 +1200 Subject: [PATCH 01/60] Restore InkHUD to defaults on factory reset (#6637) * Erase InkHUD settings on factory reset * Documentation * Captialn't Lower case m. Also move the include statement to .cpp, because it doesn't really need to be in the .h --- src/graphics/Screen.cpp | 3 --- src/graphics/niche/FlashData.h | 23 ++++++++++++++++++ src/graphics/niche/InkHUD/Events.cpp | 31 ++++++++++++++++++++++-- src/graphics/niche/InkHUD/Events.h | 8 ++++++ src/graphics/niche/InkHUD/docs/README.md | 4 +++ src/modules/AdminModule.cpp | 4 ++- 6 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index ad0b94efe..1ee0c0fdd 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -2840,9 +2840,6 @@ int Screen::handleInputEvent(const InputEvent *event) int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) { - // Note: only selected admin messages notify this observer - // If you wish to handle a new type of message, you should modify AdminModule.cpp first - switch (arg->which_payload_variant) { // Node removed manually (i.e. via app) case meshtastic_AdminMessage_remove_by_nodenum_tag: diff --git a/src/graphics/niche/FlashData.h b/src/graphics/niche/FlashData.h index 8a63c6108..a27c4aea0 100644 --- a/src/graphics/niche/FlashData.h +++ b/src/graphics/niche/FlashData.h @@ -135,6 +135,29 @@ template class FlashData } }; +// Erase contents of the NicheGraphics data directory +inline void clearFlashData() +{ + +#ifdef FSCom + File dir = FSCom.open("/NicheGraphics"); // Open the directory + File file = dir.openNextFile(); // Attempt to open the first file in the directory + + // While the directory still contains files + while (file) { + std::string path = "/NicheGraphics/"; + path += file.name(); + LOG_DEBUG("Erasing %s", path.c_str()); + file.close(); + FSCom.remove(path.c_str()); + + file = dir.openNextFile(); + } +#else + LOG_ERROR("ERROR: Filesystem not implemented\n"); +#endif +} + } // namespace NicheGraphics #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Events.cpp b/src/graphics/niche/InkHUD/Events.cpp index ddd01b7e1..d0bd35250 100644 --- a/src/graphics/niche/InkHUD/Events.cpp +++ b/src/graphics/niche/InkHUD/Events.cpp @@ -3,11 +3,13 @@ #include "./Events.h" #include "RTC.h" +#include "modules/AdminModule.h" #include "modules/TextMessageModule.h" #include "sleep.h" #include "./Applet.h" #include "./SystemApplet.h" +#include "graphics/niche/FlashData.h" using namespace NicheGraphics; @@ -25,6 +27,9 @@ void InkHUD::Events::begin() deepSleepObserver.observe(¬ifyDeepSleep); rebootObserver.observe(¬ifyReboot); textMessageObserver.observe(textMessageModule); +#if !MESHTASTIC_EXCLUDE_ADMIN + adminMessageObserver.observe(adminModule); +#endif #ifdef ARCH_ESP32 lightSleepObserver.observe(¬ifyLightSleep); #endif @@ -117,8 +122,13 @@ int InkHUD::Events::beforeReboot(void *unused) sa->onReboot(); } - inkhud->persistence->saveSettings(); - inkhud->persistence->saveLatestMessage(); + // Save settings to flash, or erase if factory reset in progress + if (!eraseOnReboot) { + inkhud->persistence->saveSettings(); + inkhud->persistence->saveLatestMessage(); + } else { + NicheGraphics::clearFlashData(); + } // Note: no forceUpdate call here // We don't have any final screen to draw, although LogoApplet::onReboot did already display a "rebooting" screen @@ -171,6 +181,23 @@ int InkHUD::Events::onReceiveTextMessage(const meshtastic_MeshPacket *packet) return 0; // Tell caller to continue notifying other observers. (No reason to abort this event) } +int InkHUD::Events::onAdminMessage(const meshtastic_AdminMessage *message) +{ + switch (message->which_payload_variant) { + // Factory reset + // Two possible messages. One preserves BLE bonds, other wipes. Both should clear InkHUD data. + case meshtastic_AdminMessage_factory_reset_device_tag: + case meshtastic_AdminMessage_factory_reset_config_tag: + eraseOnReboot = true; + break; + + default: + break; + } + + return 0; // Tell caller to continue notifying other observers. (No reason to abort this event) +} + #ifdef ARCH_ESP32 // Callback for lightSleepObserver // Make sure the display is not partway through an update when we begin light sleep diff --git a/src/graphics/niche/InkHUD/Events.h b/src/graphics/niche/InkHUD/Events.h index 6a6e9d7a2..489135ea3 100644 --- a/src/graphics/niche/InkHUD/Events.h +++ b/src/graphics/niche/InkHUD/Events.h @@ -33,6 +33,7 @@ class Events int beforeDeepSleep(void *unused); // Prepare for shutdown int beforeReboot(void *unused); // Prepare for reboot int onReceiveTextMessage(const meshtastic_MeshPacket *packet); // Store most recent text message + int onAdminMessage(const meshtastic_AdminMessage *message); // Handle incoming admin messages #ifdef ARCH_ESP32 int beforeLightSleep(void *unused); // Prepare for light sleep #endif @@ -52,10 +53,17 @@ class Events CallbackObserver textMessageObserver = CallbackObserver(this, &Events::onReceiveTextMessage); + // Get notified of incoming admin messages, and handle any which are relevant to InkHUD + CallbackObserver adminMessageObserver = + CallbackObserver(this, &Events::onAdminMessage); + #ifdef ARCH_ESP32 // Get notified when the system is entering light sleep CallbackObserver lightSleepObserver = CallbackObserver(this, &Events::beforeLightSleep); #endif + + // If set, InkHUD's data will be erased during onReboot + bool eraseOnReboot = false; }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/docs/README.md b/src/graphics/niche/InkHUD/docs/README.md index 07fe6c942..c3082add1 100644 --- a/src/graphics/niche/InkHUD/docs/README.md +++ b/src/graphics/niche/InkHUD/docs/README.md @@ -502,6 +502,10 @@ Applets themselves do also listen separately for various events, but for the pur Button input is sometimes handled by a system applet. `InkHUD::Events` determines whether the button should be handled by a specific system applet, or should instead trigger a default behavior +#### Factory Reset + +The Events class handles the admin messages(s) which trigger factory reset. We set `Events::eraseOnReboot = true`, which causes `Events::onReboot` to erase the contents of InkHUD's data directory. We do this because some applets (e.g. ThreadedMessageApplet) save their own data to flash, so if we erased earlier, that data would get re-written during reboot. + --- ### `InkHUD::Applet` diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 88109bc78..650910542 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -284,7 +284,6 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta case meshtastic_AdminMessage_remove_by_nodenum_tag: { LOG_INFO("Client received remove_nodenum command"); nodeDB->removeNodeByNum(r->remove_by_nodenum); - this->notifyObservers(r); // Observed by screen break; } case meshtastic_AdminMessage_set_favorite_node_tag: { @@ -444,6 +443,9 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp); } + // Allow any observers (e.g. the UI) to respond to this event + notifyObservers(r); + return handled; } From a8ab6e82e63e7452bd0f197e1e045573f9cd2145 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Thu, 1 May 2025 03:50:30 +0200 Subject: [PATCH 02/60] MUI framebuffer support (#6703) Co-authored-by: Ben Meadors --- src/graphics/tftSetup.cpp | 14 ++++++++--- src/platform/portduino/PortduinoGlue.cpp | 2 ++ src/platform/portduino/PortduinoGlue.h | 2 +- variants/portduino/platformio.ini | 31 ++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/graphics/tftSetup.cpp b/src/graphics/tftSetup.cpp index a8d51bb82..b2e92bdae 100644 --- a/src/graphics/tftSetup.cpp +++ b/src/graphics/tftSetup.cpp @@ -43,10 +43,10 @@ void tftSetup(void) #else if (settingsMap[displayPanel] != no_screen) { DisplayDriverConfig displayConfig; - static char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", - "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"}; + static char *panels[] = {"NOSCREEN", "X11", "FB", "ST7789", "ST7735", "ST7735S", + "ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"}; static char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; -#ifdef USE_X11 +#if defined(USE_X11) if (settingsMap[displayPanel] == x11) { if (settingsMap[displayWidth] && settingsMap[displayHeight]) displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::X11, (uint16_t)settingsMap[displayWidth], @@ -54,6 +54,14 @@ void tftSetup(void) else displayConfig.device(DisplayDriverConfig::device_t::X11); } else +#elif defined(USE_FRAMEBUFFER) + if (settingsMap[displayPanel] == fb) { + if (settingsMap[displayWidth] && settingsMap[displayHeight]) + displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::FB, (uint16_t)settingsMap[displayWidth], + (uint16_t)settingsMap[displayHeight]); + else + displayConfig.device(DisplayDriverConfig::device_t::FB); + } else #endif { displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 6d0972dc3..4b96e662a 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -531,6 +531,8 @@ bool loadConfig(const char *configPath) settingsMap[displayPanel] = hx8357d; else if (yamlConfig["Display"]["Panel"].as("") == "X11") settingsMap[displayPanel] = x11; + else if (yamlConfig["Display"]["Panel"].as("") == "FB") + settingsMap[displayPanel] = fb; settingsMap[displayHeight] = yamlConfig["Display"]["Height"].as(0); settingsMap[displayWidth] = yamlConfig["Display"]["Width"].as(0); settingsMap[displayDC] = yamlConfig["Display"]["DC"].as(-1); diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index f7239cb73..6393d7294 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -102,7 +102,7 @@ enum configNames { available_directory, mac_address }; -enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d }; +enum { no_screen, x11, fb, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d }; enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 }; enum { level_error, level_warn, level_info, level_debug, level_trace }; diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 7a3392eb4..fe89ad6e6 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -43,6 +43,37 @@ build_src_filter = ${native_base.build_src_filter} - +[env:native-fb] +extends = native_base +build_type = release +lib_deps = + ${native_base.lib_deps} + ${device-ui_base.lib_deps} +board_level = extra +build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -Wl,--gc-sections + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D RAM_SIZE=8192 + -D USE_FRAMEBUFFER=1 + -D LV_COLOR_DEPTH=32 + -D HAS_TFT=1 + -D HAS_SCREEN=0 + -D LV_BUILD_TEST=0 + -D LV_USE_LOG=0 + -D LV_USE_EVDEV=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API + -D VIEW_320x240 + -D MAP_FULL_REDRAW + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : +build_src_filter = + ${native_base.build_src_filter} + - + [env:native-tft-debug] extends = native_base build_type = debug From 987623567ae06ce58e996b474d3659dd88495e05 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 1 May 2025 13:32:20 +0200 Subject: [PATCH 03/60] router: on linux add a mutex around the queue (#6709) UDP reception happens on an other thread, avoid data races and potential data corruption issues. --- src/mesh/Router.cpp | 8 ++++++++ src/mesh/Router.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index fef29388e..bb0858c8b 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -64,6 +64,10 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA */ int32_t Router::runOnce() { +#ifdef ARCH_PORTDUINO + const std::lock_guard lock(queueMutex); +#endif + meshtastic_MeshPacket *mp; while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { // printPacket("handle fromRadioQ", mp); @@ -80,6 +84,10 @@ int32_t Router::runOnce() */ void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p) { +#ifdef ARCH_PORTDUINO + const std::lock_guard lock(queueMutex); +#endif + // Try enqueue until successful while (!fromRadioQueue.enqueue(p, 0)) { meshtastic_MeshPacket *old_p; diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 58ca50f3d..f4782d863 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -8,6 +8,9 @@ #include "PointerQueue.h" #include "RadioInterface.h" #include "concurrency/OSThread.h" +#ifdef ARCH_PORTDUINO +#include +#endif /** * A mesh aware router that supports multiple interfaces. @@ -19,6 +22,12 @@ class Router : protected concurrency::OSThread, protected PacketHistory /// forwarded to the phone. PointerQueue fromRadioQueue; +#ifdef ARCH_PORTDUINO + /// linux calls enqueueReceivedMessage from an other thread when receiving UDP packets, + /// to avoid a data race with LoRa, lock that method. + std::mutex queueMutex; +#endif + protected: RadioInterface *iface = NULL; From 947191a7979bf394986d3c3920e8fd0da472be58 Mon Sep 17 00:00:00 2001 From: Ferdia McKeogh Date: Fri, 2 May 2025 03:11:09 +0100 Subject: [PATCH 04/60] Add PA1010D GPS support (#6691) --- src/gps/GPS.cpp | 15 +++++++++++++++ src/gps/GPS.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 55f62d8ad..e234fdb4a 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -570,6 +570,19 @@ bool GPS::setup() // Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s) _serial_gps->write("$PMTK886,1*29\r\n"); delay(250); + } else if (gnssModel == GNSS_MODEL_MTK_PA1010D) { + // PA1010D is used in the Pimoroni GPS board. + + // Enable all constellations. + _serial_gps->write("$PMTK353,1,1,1,1,1*2A\r\n"); + // Above command will reset the GPS and takes longer before it will accept new commands + delay(1000); + // Only ask for RMC and GGA (GNRMC and GNGGA) + _serial_gps->write("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n"); + delay(250); + // Enable SBAS / WAAS + _serial_gps->write("$PMTK301,2*2E\r\n"); + delay(250); } else if (gnssModel == GNSS_MODEL_MTK_PA1616S) { // PA1616S is used in some GPS breakout boards from Adafruit // PA1616S does not have GLONASS capability. PA1616D does, but is not implemented here. @@ -1238,9 +1251,11 @@ GnssModel_t GPS::probe(int serialSpeed) _serial_gps->write("$PMTK514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2E\r\n"); delay(20); std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, + {"PA1010D", "1010D", GNSS_MODEL_MTK_PA1010D}, {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}, {"L96", "Quectel-L96", GNSS_MODEL_MTK_L76B}}; + PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500); uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00}; diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 240cf66d2..9be57017f 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -27,6 +27,7 @@ typedef enum { GNSS_MODEL_UC6580, GNSS_MODEL_UNKNOWN, GNSS_MODEL_MTK_L76B, + GNSS_MODEL_MTK_PA1010D, GNSS_MODEL_MTK_PA1616S, GNSS_MODEL_AG3335, GNSS_MODEL_AG3352, From baae2503d53c1ce107fb69734ad88e8d8808367d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 16:24:21 +0800 Subject: [PATCH 05/60] Upgrade trunk to 1.22.15 (#6608) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 60e422312..92cd5b316 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.22.12 + version: 1.22.15 plugins: sources: - id: trunk @@ -8,18 +8,18 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - renovate@39.243.0 + - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.23 + - trufflehog@3.88.26 - yamllint@1.37.0 - bandit@1.8.3 - terrascan@1.19.9 - - trivy@0.61.0 + - trivy@0.61.1 - taplo@0.9.3 - - ruff@0.11.5 + - ruff@0.11.7 - isort@6.0.1 - markdownlint@0.44.0 - - oxipng@9.1.4 + - oxipng@9.1.5 - svgo@3.3.2 - actionlint@1.7.7 - flake8@7.2.0 @@ -28,7 +28,7 @@ lint: - shellcheck@0.10.0 - black@25.1.0 - git-diff-check - - gitleaks@8.24.3 + - gitleaks@8.25.1 - clang-format@16.0.3 ignore: - linters: [ALL] From 7da8aea1df3b87c26d9c3f8002e95adeb83a93eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 06:16:53 -0500 Subject: [PATCH 06/60] chore(deps): update meshtastic-device-ui digest to aa38459 (#6706) 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 73a9bbe1f..cfa6cd4ef 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/33aa6890f7862d81c2bc1658f43eeea7a8081c6e.zip + https://github.com/meshtastic/device-ui/archive/aa38459f4e4c0bc6e4d1bda52d26393f0fcf1b97.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 10693c4569b4bf33e02255c598693569f0950b18 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Fri, 2 May 2025 23:20:56 +1200 Subject: [PATCH 07/60] Lock SPI bus while in use by InkHUD (#6719) Co-authored-by: Ben Meadors --- .../niche/Drivers/EInk/LCMEN2R13EFC1.cpp | 16 ++++++++++++++-- src/graphics/niche/Drivers/EInk/SSD16XX.cpp | 15 ++++++++++++++- src/graphics/niche/FlashData.h | 17 ++++++++++++++--- src/graphics/niche/InkHUD/MessageStore.cpp | 14 ++++++++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp index 13a3f452d..fb37544b2 100644 --- a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp +++ b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp @@ -1,9 +1,11 @@ -#include "./LCMEN2R13EFC1.h" - #ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +#include "./LCMEN2R13EFC1.h" + #include +#include "SPILock.h" + using namespace NicheGraphics::Drivers; // Look up table: fast refresh, common electrode @@ -150,6 +152,9 @@ void LCMEN213EFC1::reset() void LCMEN213EFC1::sendCommand(const uint8_t command) { + // Take firmware's SPI lock + spiLock->lock(); + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, LOW); // DC pin low indicates command digitalWrite(pin_cs, LOW); @@ -157,6 +162,8 @@ void LCMEN213EFC1::sendCommand(const uint8_t command) digitalWrite(pin_cs, HIGH); digitalWrite(pin_dc, HIGH); spi->endTransaction(); + + spiLock->unlock(); } void LCMEN213EFC1::sendData(uint8_t data) @@ -166,6 +173,9 @@ void LCMEN213EFC1::sendData(uint8_t data) void LCMEN213EFC1::sendData(const uint8_t *data, uint32_t size) { + // Take firmware's SPI lock + spiLock->lock(); + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command digitalWrite(pin_cs, LOW); @@ -183,6 +193,8 @@ void LCMEN213EFC1::sendData(const uint8_t *data, uint32_t size) digitalWrite(pin_cs, HIGH); digitalWrite(pin_dc, HIGH); spi->endTransaction(); + + spiLock->unlock(); } void LCMEN213EFC1::configFull() diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp index a2357a80b..d0d030be8 100644 --- a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp @@ -1,6 +1,9 @@ +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + #include "./SSD16XX.h" -#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +#include "SPILock.h" + using namespace NicheGraphics::Drivers; SSD16XX::SSD16XX(uint16_t width, uint16_t height, UpdateTypes supported, uint8_t bufferOffsetX) @@ -82,6 +85,9 @@ void SSD16XX::sendCommand(const uint8_t command) if (failed) return; + // Take firmware's SPI lock + spiLock->lock(); + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, LOW); // DC pin low indicates command digitalWrite(pin_cs, LOW); @@ -89,6 +95,8 @@ void SSD16XX::sendCommand(const uint8_t command) digitalWrite(pin_cs, HIGH); digitalWrite(pin_dc, HIGH); spi->endTransaction(); + + spiLock->unlock(); } void SSD16XX::sendData(uint8_t data) @@ -103,6 +111,9 @@ void SSD16XX::sendData(const uint8_t *data, uint32_t size) if (failed) return; + // Take firmware's SPI lock + spiLock->lock(); + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command digitalWrite(pin_cs, LOW); @@ -119,6 +130,8 @@ void SSD16XX::sendData(const uint8_t *data, uint32_t size) digitalWrite(pin_cs, HIGH); digitalWrite(pin_dc, HIGH); spi->endTransaction(); + + spiLock->unlock(); } void SSD16XX::configFullscreen() diff --git a/src/graphics/niche/FlashData.h b/src/graphics/niche/FlashData.h index a27c4aea0..233d0922e 100644 --- a/src/graphics/niche/FlashData.h +++ b/src/graphics/niche/FlashData.h @@ -13,6 +13,7 @@ Avoid bloating everyone's protobuf code for our one-off UI implementations #include "configuration.h" +#include "SPILock.h" #include "SafeFile.h" namespace NicheGraphics @@ -46,6 +47,9 @@ template class FlashData public: static bool load(T *data, const char *label) { + // Take firmware's SPI lock + concurrency::LockGuard guard(spiLock); + // Set false if we run into issues bool okay = true; @@ -103,14 +107,18 @@ template class FlashData return okay; } - // Save module's custom data (settings?) to flash. Does use protobufs + // Save module's custom data (settings?) to flash. Doesn't use protobufs + // Takes the firmware's SPI lock, in case the files are stored on SD card + // Need to lock and unlock around specific FS methods, as the SafeFile class takes the lock for itself internally. static void save(T *data, const char *label) { // Get a filename based on the label std::string filename = getFilename(label); #ifdef FSCom + spiLock->lock(); FSCom.mkdir("/NicheGraphics"); + spiLock->unlock(); auto f = SafeFile(filename.c_str(), true); // "true": full atomic. Write new data to temp file, then rename. @@ -119,10 +127,10 @@ template class FlashData // Calculate a hash of the data uint32_t hash = getHash(data); + spiLock->lock(); f.write((uint8_t *)data, sizeof(T)); // Write the actual data f.write((uint8_t *)&hash, sizeof(hash)); // Append the hash - - // f.flush(); + spiLock->unlock(); bool writeSucceeded = f.close(); @@ -139,6 +147,9 @@ template class FlashData inline void clearFlashData() { + // Take firmware's SPI lock, in case the files are stored on SD card + concurrency::LockGuard guard(spiLock); + #ifdef FSCom File dir = FSCom.open("/NicheGraphics"); // Open the directory File file = dir.openNextFile(); // Attempt to open the first file in the directory diff --git a/src/graphics/niche/InkHUD/MessageStore.cpp b/src/graphics/niche/InkHUD/MessageStore.cpp index ac6fe1b35..94e0aa661 100644 --- a/src/graphics/niche/InkHUD/MessageStore.cpp +++ b/src/graphics/niche/InkHUD/MessageStore.cpp @@ -22,6 +22,8 @@ InkHUD::MessageStore::MessageStore(std::string label) } // Write the contents of the MessageStore::messages object to flash +// Takes the firmware's SPI lock during FS operations. Implemented for consistency, but only relevant when using SD card. +// Need to lock and unlock around specific FS methods, as the SafeFile class takes the lock for itself internally void InkHUD::MessageStore::saveToFlash() { assert(!filename.empty()); @@ -29,7 +31,9 @@ void InkHUD::MessageStore::saveToFlash() #ifdef FSCom // Make the directory, if doesn't already exist // This is the same directory accessed by NicheGraphics::FlashData + spiLock->lock(); FSCom.mkdir("/NicheGraphics"); + spiLock->unlock(); // Open or create the file // No "full atomic": don't save then rename @@ -37,6 +41,9 @@ void InkHUD::MessageStore::saveToFlash() LOG_INFO("Saving messages in %s", filename.c_str()); + // Take firmware's SPI Lock while writing + spiLock->lock(); + // 1st byte: how many messages will be written to store f.write(messages.size()); @@ -51,6 +58,9 @@ void InkHUD::MessageStore::saveToFlash() LOG_DEBUG("Wrote message %u, length %u, text \"%s\"", (uint32_t)i, min(MAX_MESSAGE_SIZE, m.text.size()), m.text.c_str()); } + // Release firmware's SPI lock, because SafeFile::close needs it + spiLock->unlock(); + bool writeSucceeded = f.close(); if (!writeSucceeded) { @@ -63,6 +73,7 @@ void InkHUD::MessageStore::saveToFlash() // Attempt to load the previous contents of the MessageStore:message deque from flash. // Filename is controlled by the "label" parameter +// Takes the firmware's SPI lock during FS operations. Implemented for consistency, but only relevant when using SD card. void InkHUD::MessageStore::loadFromFlash() { // Hopefully redundant. Initial intention is to only load / save once per boot. @@ -70,6 +81,9 @@ void InkHUD::MessageStore::loadFromFlash() #ifdef FSCom + // Take the firmware's SPI Lock, in case filesystem is on SD card + concurrency::LockGuard guard(spiLock); + // Check that the file *does* actually exist if (!FSCom.exists(filename.c_str())) { LOG_WARN("'%s' not found. Using default values", filename.c_str()); From 152b8b1b0235bc461c6e4451fbcdac0987b8bf90 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 2 May 2025 13:53:25 -0400 Subject: [PATCH 08/60] Revert "router: on linux add a mutex around the queue (#6709)" (#6726) This reverts commit 987623567ae06ce58e996b474d3659dd88495e05. --- src/mesh/Router.cpp | 8 -------- src/mesh/Router.h | 9 --------- 2 files changed, 17 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index bb0858c8b..fef29388e 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -64,10 +64,6 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA */ int32_t Router::runOnce() { -#ifdef ARCH_PORTDUINO - const std::lock_guard lock(queueMutex); -#endif - meshtastic_MeshPacket *mp; while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { // printPacket("handle fromRadioQ", mp); @@ -84,10 +80,6 @@ int32_t Router::runOnce() */ void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p) { -#ifdef ARCH_PORTDUINO - const std::lock_guard lock(queueMutex); -#endif - // Try enqueue until successful while (!fromRadioQueue.enqueue(p, 0)) { meshtastic_MeshPacket *old_p; diff --git a/src/mesh/Router.h b/src/mesh/Router.h index f4782d863..58ca50f3d 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -8,9 +8,6 @@ #include "PointerQueue.h" #include "RadioInterface.h" #include "concurrency/OSThread.h" -#ifdef ARCH_PORTDUINO -#include -#endif /** * A mesh aware router that supports multiple interfaces. @@ -22,12 +19,6 @@ class Router : protected concurrency::OSThread, protected PacketHistory /// forwarded to the phone. PointerQueue fromRadioQueue; -#ifdef ARCH_PORTDUINO - /// linux calls enqueueReceivedMessage from an other thread when receiving UDP packets, - /// to avoid a data race with LoRa, lock that method. - std::mutex queueMutex; -#endif - protected: RadioInterface *iface = NULL; From 9d31d9f43b25b5f2f388546f28ab64d0ce05ce48 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 3 May 2025 22:18:39 +0200 Subject: [PATCH 09/60] chore(deps): update meshtastic-device-ui digest to b9e2ad1 (#6729) 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 cfa6cd4ef..fcece8639 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/aa38459f4e4c0bc6e4d1bda52d26393f0fcf1b97.zip + https://github.com/meshtastic/device-ui/archive/b9e2ad1222db9f5a5080248b2f018c250f0efae5.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From d75c91a760afbc1dd9f5192776c284338f52a2e4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 4 May 2025 08:39:59 -0500 Subject: [PATCH 10/60] [create-pull-request] automated change (#6732) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/module_config.pb.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/protobufs b/protobufs index 27fac3914..078ac8dfb 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 27fac39141d99fe727a0a1824c5397409b1aea75 +Subproject commit 078ac8dfbe5f7533d7755cbe2ca3d08d86e5af34 diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index d5031cb89..dbf6ddb2e 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -79,7 +79,10 @@ typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Mode { /* NMEA messages specifically tailored for CalTopo */ meshtastic_ModuleConfig_SerialConfig_Serial_Mode_CALTOPO = 5, /* Ecowitt WS85 weather station */ - meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85 = 6 + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85 = 6, + /* VE.Direct is a serial protocol used by Victron Energy products + https://beta.ivc.no/wiki/index.php/Victron_VE_Direct_DIY_Cable */ + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT = 7 } meshtastic_ModuleConfig_SerialConfig_Serial_Mode; /* TODO: REPLACE */ @@ -467,8 +470,8 @@ extern "C" { #define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1)) #define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT -#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85 -#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85+1)) +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_VE_DIRECT+1)) #define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE #define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK From 8bb1f3e869efbd76abae794630d31352fe4896c8 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 4 May 2025 14:18:48 -0400 Subject: [PATCH 11/60] Update template for event userprefs (#6720) --- userPrefs.jsonc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/userPrefs.jsonc b/userPrefs.jsonc index d522ad272..eb6dc64b6 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -1,21 +1,21 @@ { // "USERPREFS_BUTTON_PIN": "36", // "USERPREFS_CHANNELS_TO_WRITE": "3", - // "USERPREFS_CHANNEL_0_DOWNLINK_ENABLED": "true", - // "USERPREFS_CHANNEL_0_NAME": "DEFCONnect", + // "USERPREFS_CHANNEL_0_DOWNLINK_ENABLED": "false", + // "USERPREFS_CHANNEL_0_NAME": "REPLACEME", // "USERPREFS_CHANNEL_0_PRECISION": "14", // "USERPREFS_CHANNEL_0_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa1 }", // "USERPREFS_CHANNEL_0_UPLINK_ENABLED": "true", - // "USERPREFS_CHANNEL_1_DOWNLINK_ENABLED": "true", - // "USERPREFS_CHANNEL_1_NAME": "REPLACEME", + // "USERPREFS_CHANNEL_1_DOWNLINK_ENABLED": "false", + // "USERPREFS_CHANNEL_1_NAME": "Node Build Chat", // "USERPREFS_CHANNEL_1_PRECISION": "14", - // "USERPREFS_CHANNEL_1_PSK": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", - // "USERPREFS_CHANNEL_1_UPLINK_ENABLED": "true", - // "USERPREFS_CHANNEL_2_DOWNLINK_ENABLED": "true", - // "USERPREFS_CHANNEL_2_NAME": "REPLACEME", + // "USERPREFS_CHANNEL_1_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa2 }", + // "USERPREFS_CHANNEL_1_UPLINK_ENABLED": "false", + // "USERPREFS_CHANNEL_2_DOWNLINK_ENABLED": "false", + // "USERPREFS_CHANNEL_2_NAME": "Equipment Exchange", // "USERPREFS_CHANNEL_2_PRECISION": "14", - // "USERPREFS_CHANNEL_2_PSK": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", - // "USERPREFS_CHANNEL_2_UPLINK_ENABLED": "true", + // "USERPREFS_CHANNEL_2_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa3 }", + // "USERPREFS_CHANNEL_2_UPLINK_ENABLED": "false", // "USERPREFS_CONFIG_GPS_MODE": "meshtastic_Config_PositionConfig_GpsMode_ENABLED", // "USERPREFS_CONFIG_LORA_IGNORE_MQTT": "true", // "USERPREFS_CONFIG_LORA_REGION": "meshtastic_Config_LoRaConfig_RegionCode_US", From 055fdcb7f6f3f8e8c8b8810a072bf5c5a54a6cd7 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 4 May 2025 20:08:39 -0400 Subject: [PATCH 12/60] Renovate: Add changelogs for device-ui, cleanup (#6733) --- arch/esp32/esp32.ini | 2 +- arch/esp32/esp32c6.ini | 4 ++-- arch/nrf52/nrf52.ini | 3 ++- arch/portduino/portduino.ini | 2 +- platformio.ini | 2 +- renovate.json | 8 +++++++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 3a6dc8323..a6eff7bf9 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -59,7 +59,7 @@ lib_deps = # renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip # renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto - rweather/Crypto@^0.4.0 + rweather/Crypto@0.4.0 lib_ignore = segger_rtt diff --git a/arch/esp32/esp32c6.ini b/arch/esp32/esp32c6.ini index 7c7e3e923..26b5c0f5b 100644 --- a/arch/esp32/esp32c6.ini +++ b/arch/esp32/esp32c6.ini @@ -1,7 +1,7 @@ [esp32c6_base] extends = esp32_base platform = - # renovate: datasource=git-refs depName=ESP32c6 platform-espressif32 packageName=https://github.com/Jason2866/platform-espressif32 gitBranch=Arduino/IDF5 + # Do not renovate until we have switched to pioarduino tagged builds https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip build_flags = ${arduino_base.build_flags} @@ -32,7 +32,7 @@ lib_deps = # renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip # renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto - rweather/Crypto@^0.4.0 + rweather/Crypto@0.4.0 build_src_filter = ${esp32_base.build_src_filter} - diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index d49d8920c..4a77ec4b2 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -28,7 +28,8 @@ build_src_filter = lib_deps= ${arduino_base.lib_deps} ${radiolib_base.lib_deps} - rweather/Crypto@^0.4.0 + # renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto + rweather/Crypto@0.4.0 lib_ignore = BluetoothOTA diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 6af3a7717..a19c50319 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -25,7 +25,7 @@ lib_deps = ${radiolib_base.lib_deps} ${environmental_base.lib_deps} # renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto - rweather/Crypto@^0.4.0 + rweather/Crypto@0.4.0 # renovate: datasource=custom.pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX lovyan03/LovyanGFX@^1.2.0 # renovate: datasource=git-refs depName=libch341-spi-userspace packageName=https://github.com/pine64/libch341-spi-userspace gitBranch=main diff --git a/platformio.ini b/platformio.ini index fcece8639..636ef3c25 100644 --- a/platformio.ini +++ b/platformio.ini @@ -107,7 +107,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 + # renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master https://github.com/meshtastic/device-ui/archive/b9e2ad1222db9f5a5080248b2f018c250f0efae5.zip ; Common libs for environmental measurements in telemetry module diff --git a/renovate.json b/renovate.json index 11d35aff8..e88bfb4e1 100644 --- a/renovate.json +++ b/renovate.json @@ -69,5 +69,11 @@ "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}git{{/if}}" } ], - "packageRules": [] + "packageRules": [ + { + "matchPackageNames": ["meshtastic/device-ui"], + "reviewers": ["mverch67"], + "changelogUrl": "https://github.com/meshtastic/device-ui/compare/{{currentDigest}}...{{newDigest}}" + } + ] } From a32e45f8f2082d2b009298018802bd646383d2a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 05:16:51 -0500 Subject: [PATCH 13/60] Upgrade trunk (#6737) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 92cd5b316..c55635d9c 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -16,7 +16,7 @@ lint: - terrascan@1.19.9 - trivy@0.61.1 - taplo@0.9.3 - - ruff@0.11.7 + - ruff@0.11.8 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.5 From 2d6181fca0efabacb56ccc5a01f35df0ccc3cdbd Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 5 May 2025 07:03:36 -0400 Subject: [PATCH 14/60] update bosch bsec2 (#6727) Co-authored-by: Ben Meadors --- platformio.ini | 8 ++++---- variants/Dongle_nRF52840-pca10059-v1/platformio.ini | 1 - variants/ELECROW-ThinkNode-M1/platformio.ini | 2 -- variants/ME25LS01-4Y10TD/platformio.ini | 1 - variants/ME25LS01-4Y10TD_e-ink/platformio.ini | 1 - variants/MS24SF1/platformio.ini | 1 - variants/MakePython_nRF52840_eink/platformio.ini | 1 - variants/MakePython_nRF52840_oled/platformio.ini | 1 - variants/Seeed_Solar_Node/platformio.ini | 1 - variants/canaryone/platformio.ini | 1 - variants/diy/platformio.ini | 3 --- variants/ec_catsniffer/platformio.ini | 1 - variants/feather_diy/platformio.ini | 1 - variants/feather_rp2040_rfm95/platformio.ini | 1 - variants/heltec_mesh_node_t114/platformio.ini | 1 - variants/heltec_mesh_pocket/platformio.ini | 4 ---- variants/meshlink/platformio.ini | 1 - variants/meshlink_eink/platformio.ini | 1 - variants/monteops_hw1/platformio.ini | 1 - variants/nano-g2-ultra/platformio.ini | 1 - variants/nibble_rp2040/platformio.ini | 1 - variants/rak11310/platformio.ini | 1 - variants/rak2560/platformio.ini | 1 - variants/rak4631/platformio.ini | 1 - variants/rak4631_epaper/platformio.ini | 1 - variants/rak4631_epaper_onrxtx/platformio.ini | 1 - variants/rak4631_eth_gw/platformio.ini | 1 - variants/rak_wismeshtap/platformio.ini | 1 - variants/rp2040-lora/platformio.ini | 1 - variants/rpipico-slowclock/platformio.ini | 1 - variants/rpipico/platformio.ini | 1 - variants/rpipico2/platformio.ini | 1 - variants/rpipico2w/platformio.ini | 1 - variants/rpipicow/platformio.ini | 1 - variants/seeed_xiao_nrf52840_kit/platformio.ini | 1 - variants/senselora_rp2040/platformio.ini | 1 - variants/t-echo/platformio.ini | 2 -- variants/tlora_c6/platformio.ini | 1 - variants/tracker-t1000-e/platformio.ini | 1 - variants/wio-sdk-wm1110/platformio.ini | 1 - variants/wio-t1000-s/platformio.ini | 1 - variants/wio-tracker-wm1110/platformio.ini | 1 - variants/xiao_ble/platformio.ini | 1 - 43 files changed, 4 insertions(+), 53 deletions(-) diff --git a/platformio.ini b/platformio.ini index 636ef3c25..ba41b386d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -148,7 +148,7 @@ lib_deps = # renovate: datasource=custom.pio depName=Adafruit MLX90614 packageName=adafruit/library/Adafruit MLX90614 Library adafruit/Adafruit MLX90614 Library@2.1.5 # renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library - boschsensortec/BME68x Sensor Library@1.1.40407 + boschsensortec/BME68x Sensor Library@1.2.40408 # renovate: datasource=github-tags depName=INA3221 packageName=KodinLanewave/INA3221 https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip # renovate: datasource=custom.pio depName=QMC5883L Compass packageName=mprograms/library/QMC5883LCompass @@ -185,7 +185,7 @@ lib_deps = sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.0 # renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001 ClosedCube OPT3001@1.1.2 - # renovate: datasource=github-tags depName=Bosch BSEC2 packageName=boschsensortec/Bosch-BSEC2-Library - https://github.com/boschsensortec/Bosch-BSEC2-Library/archive/v1.7.2502.zip + # renovate: datasource=git-refs depName=Bosch BSEC2 packageName=https://github.com/meshtastic/Bosch-BSEC2-Library gitBranch=extra_script + https://github.com/meshtastic/Bosch-BSEC2-Library/archive/e16952dfe5addd4287e1eb8c4f6ecac0fa3dd3de.zip # renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master - https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip \ No newline at end of file + https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip diff --git a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini index 9e87fd237..ad944779d 100644 --- a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini +++ b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini @@ -3,7 +3,6 @@ board_level = extra extends = nrf52840_base board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/Dongle_nRF52840-pca10059-v1 -D NORDIC_PCA10059 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DEINK_DISPLAY_MODEL=GxEPD2_420_M01 -DEINK_WIDTH=300 -DEINK_HEIGHT=400 diff --git a/variants/ELECROW-ThinkNode-M1/platformio.ini b/variants/ELECROW-ThinkNode-M1/platformio.ini index 86fbde398..2e9a20dfe 100644 --- a/variants/ELECROW-ThinkNode-M1/platformio.ini +++ b/variants/ELECROW-ThinkNode-M1/platformio.ini @@ -9,7 +9,6 @@ debug_tool = jlink build_flags = ${nrf52840_base.build_flags} -Ivariants/ELECROW-ThinkNode-M1 -DELECROW_ThinkNode_M1 -DGPS_POWER_TOGGLE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DUSE_EINK -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 -DEINK_WIDTH=200 @@ -39,7 +38,6 @@ build_flags = ${inkhud.build_flags} -I variants/ELECROW-ThinkNode-M1 -D ELECROW_ThinkNode_M1 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} ${inkhud.build_src_filter} diff --git a/variants/ME25LS01-4Y10TD/platformio.ini b/variants/ME25LS01-4Y10TD/platformio.ini index bd764e107..b452f0ad8 100644 --- a/variants/ME25LS01-4Y10TD/platformio.ini +++ b/variants/ME25LS01-4Y10TD/platformio.ini @@ -4,7 +4,6 @@ board = me25ls01-4y10td board_level = extra ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/ME25LS01-4Y10TD> diff --git a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini index fb9bd27d5..f9788a521 100644 --- a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini +++ b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini @@ -4,7 +4,6 @@ board = me25ls01-4y10td board_level = extra ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD_e-ink -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_420_GDEY042T81 -DEINK_WIDTH=400 diff --git a/variants/MS24SF1/platformio.ini b/variants/MS24SF1/platformio.ini index e109a3270..10e8d2c95 100644 --- a/variants/MS24SF1/platformio.ini +++ b/variants/MS24SF1/platformio.ini @@ -4,7 +4,6 @@ board = ms24sf1 board_level = extra ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e build_flags = ${nrf52840_base.build_flags} -Ivariants/MS24SF1 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MS24SF1> diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index 9e2d5bbf7..ef97172e9 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -3,7 +3,6 @@ board_level = extra extends = nrf52840_base board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_eink -D PRIVATE_HW - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D -DEINK_WIDTH=296 diff --git a/variants/MakePython_nRF52840_oled/platformio.ini b/variants/MakePython_nRF52840_oled/platformio.ini index 25dd36c08..57b9ecb79 100644 --- a/variants/MakePython_nRF52840_oled/platformio.ini +++ b/variants/MakePython_nRF52840_oled/platformio.ini @@ -3,7 +3,6 @@ board_level = extra extends = nrf52840_base board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_oled -D PRIVATE_HW - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_oled> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/Seeed_Solar_Node/platformio.ini b/variants/Seeed_Solar_Node/platformio.ini index 9651d3a77..5ee0a5e8f 100644 --- a/variants/Seeed_Solar_Node/platformio.ini +++ b/variants/Seeed_Solar_Node/platformio.ini @@ -6,7 +6,6 @@ build_flags = ${nrf52840_base.build_flags} -I $PROJECT_DIR/variants/Seeed_Solar_Node -D SEEED_SOLAR_NODE -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/Seeed_Solar_Node> lib_deps = diff --git a/variants/canaryone/platformio.ini b/variants/canaryone/platformio.ini index 5e01c3763..ad11305db 100644 --- a/variants/canaryone/platformio.ini +++ b/variants/canaryone/platformio.ini @@ -6,7 +6,6 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/canaryone - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/canaryone> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 825c464a2..d8ceee9cc 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -50,7 +50,6 @@ board_level = extra build_flags = ${nrf52840_base.build_flags} -I variants/diy/nrf52_promicro_diy_xtal -D NRF52_PROMICRO_DIY - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/diy/nrf52_promicro_diy_xtal> lib_deps = ${nrf52840_base.lib_deps} @@ -64,7 +63,6 @@ board = promicro-nrf52840 build_flags = ${nrf52840_base.build_flags} -I variants/diy/nrf52_promicro_diy_tcxo -D NRF52_PROMICRO_DIY - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/diy/nrf52_promicro_diy_tcxo> lib_deps = ${nrf52840_base.lib_deps} @@ -77,7 +75,6 @@ extends = nrf52840_base board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/diy/seeed-xiao-nrf52840-wio-sx1262 -D PRIVATE_HW -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/diy/seeed-xiao-nrf52840-wio-sx1262> lib_deps = diff --git a/variants/ec_catsniffer/platformio.ini b/variants/ec_catsniffer/platformio.ini index 9afb44236..6db9abe90 100644 --- a/variants/ec_catsniffer/platformio.ini +++ b/variants/ec_catsniffer/platformio.ini @@ -8,7 +8,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/ec_catsniffer -DDEBUG_RP2040_PORT=Serial # -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags}, -g diff --git a/variants/feather_diy/platformio.ini b/variants/feather_diy/platformio.ini index 82dbb317c..84c582ab0 100644 --- a/variants/feather_diy/platformio.ini +++ b/variants/feather_diy/platformio.ini @@ -3,7 +3,6 @@ extends = nrf52840_base board = adafruit_feather_nrf52840 build_flags = ${nrf52840_base.build_flags} -Ivariants/feather_diy -Dfeather_diy - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/feather_diy> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/feather_rp2040_rfm95/platformio.ini b/variants/feather_rp2040_rfm95/platformio.ini index a28ad7655..db1eb4f02 100644 --- a/variants/feather_rp2040_rfm95/platformio.ini +++ b/variants/feather_rp2040_rfm95/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/feather_rp2040_rfm95 -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags} diff --git a/variants/heltec_mesh_node_t114/platformio.ini b/variants/heltec_mesh_node_t114/platformio.ini index 4f83d8516..3ba97bd04 100644 --- a/variants/heltec_mesh_node_t114/platformio.ini +++ b/variants/heltec_mesh_node_t114/platformio.ini @@ -6,7 +6,6 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/heltec_mesh_node_t114 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE -DHELTEC_T114 diff --git a/variants/heltec_mesh_pocket/platformio.ini b/variants/heltec_mesh_pocket/platformio.ini index 53f56e973..6632c10fe 100644 --- a/variants/heltec_mesh_pocket/platformio.ini +++ b/variants/heltec_mesh_pocket/platformio.ini @@ -6,7 +6,6 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/heltec_mesh_pocket - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DHELTEC_MESH_POCKET -DHELTEC_MESH_POCKET_BATTERY_5000 -DUSE_EINK @@ -36,7 +35,6 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/heltec_mesh_pock build_flags = ${inkhud.build_flags} ${nrf52840_base.build_flags} - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -I variants/heltec_mesh_pocket -D HELTEC_MESH_POCKET -D HELTEC_MESH_POCKET_BATTERY_5000 @@ -53,7 +51,6 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/heltec_mesh_pocket - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DHELTEC_MESH_POCKET -DHELTEC_MESH_POCKET_BATTERY_10000 -DUSE_EINK @@ -83,7 +80,6 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/heltec_mesh_pock build_flags = ${inkhud.build_flags} ${nrf52840_base.build_flags} - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -I variants/heltec_mesh_pocket -D HELTEC_MESH_POCKET -D HELTEC_MESH_POCKET_BATTERY_10000 diff --git a/variants/meshlink/platformio.ini b/variants/meshlink/platformio.ini index ec3506b0e..384858576 100644 --- a/variants/meshlink/platformio.ini +++ b/variants/meshlink/platformio.ini @@ -6,7 +6,6 @@ extends = nrf52840_base board = meshlink ;board_check = true build_flags = ${nrf52840_base.build_flags} -I variants/meshlink -D MESHLINK - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -D EINK_DISPLAY_MODEL=GxEPD2_213_B74 -D EINK_WIDTH=250 diff --git a/variants/meshlink_eink/platformio.ini b/variants/meshlink_eink/platformio.ini index f8ee96fc3..550b1e2fc 100644 --- a/variants/meshlink_eink/platformio.ini +++ b/variants/meshlink_eink/platformio.ini @@ -6,7 +6,6 @@ extends = nrf52840_base board = meshlink ;board_check = true build_flags = ${nrf52840_base.build_flags} -I variants/meshlink_eink -D MESHLINK - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -D EINK_DISPLAY_MODEL=GxEPD2_213_B74 -D EINK_WIDTH=250 diff --git a/variants/monteops_hw1/platformio.ini b/variants/monteops_hw1/platformio.ini index 1464ca7e7..82567f614 100644 --- a/variants/monteops_hw1/platformio.ini +++ b/variants/monteops_hw1/platformio.ini @@ -4,7 +4,6 @@ board_level = extra extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/monteops_hw1 -D MONTEOPS_HW1 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> + + + lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/nano-g2-ultra/platformio.ini b/variants/nano-g2-ultra/platformio.ini index 913b38e3f..7da168b47 100644 --- a/variants/nano-g2-ultra/platformio.ini +++ b/variants/nano-g2-ultra/platformio.ini @@ -5,7 +5,6 @@ board = nano-g2-ultra debug_tool = jlink build_flags = ${nrf52840_base.build_flags} -Ivariants/nano-g2-ultra -D NANO_G2_ULTRA - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nano-g2-ultra> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/nibble_rp2040/platformio.ini b/variants/nibble_rp2040/platformio.ini index ad987895f..c3a1923c5 100644 --- a/variants/nibble_rp2040/platformio.ini +++ b/variants/nibble_rp2040/platformio.ini @@ -10,7 +10,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/nibble_rp2040 -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags}, -g diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index c87304e61..fd7e842cc 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/rak11310 -DDEBUG_RP2040_PORT=Serial -DRV3028_RTC=0x52 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" build_src_filter = ${rp2040_base.build_src_filter} +<../variants/rak11310> + + + lib_deps = ${rp2040_base.lib_deps} diff --git a/variants/rak2560/platformio.ini b/variants/rak2560/platformio.ini index faed231f1..8a720ce5a 100644 --- a/variants/rak2560/platformio.ini +++ b/variants/rak2560/platformio.ini @@ -4,7 +4,6 @@ extends = nrf52840_base board = wiscore_rak4631 board_check = true build_flags = ${nrf52840_base.build_flags} -Ivariants/rak2560 -D RAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 1c6bdabcf..f2d68e704 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -4,7 +4,6 @@ extends = nrf52840_base board = wiscore_rak4631 board_check = true build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 diff --git a/variants/rak4631_epaper/platformio.ini b/variants/rak4631_epaper/platformio.ini index b851691ed..7c8a299bb 100644 --- a/variants/rak4631_epaper/platformio.ini +++ b/variants/rak4631_epaper/platformio.ini @@ -3,7 +3,6 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 diff --git a/variants/rak4631_epaper_onrxtx/platformio.ini b/variants/rak4631_epaper_onrxtx/platformio.ini index 8612a3f3d..c749fc686 100644 --- a/variants/rak4631_epaper_onrxtx/platformio.ini +++ b/variants/rak4631_epaper_onrxtx/platformio.ini @@ -4,7 +4,6 @@ board_level = extra extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN=34 -D EINK_DISPLAY_MODEL=GxEPD2_213_BN -D EINK_WIDTH=250 diff --git a/variants/rak4631_eth_gw/platformio.ini b/variants/rak4631_eth_gw/platformio.ini index e3da21c55..492ca374b 100644 --- a/variants/rak4631_eth_gw/platformio.ini +++ b/variants/rak4631_eth_gw/platformio.ini @@ -4,7 +4,6 @@ extends = nrf52840_base board = wiscore_rak4631 board_check = true build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_eth_gw -D RAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 diff --git a/variants/rak_wismeshtap/platformio.ini b/variants/rak_wismeshtap/platformio.ini index 78472783e..6ed97c7ad 100644 --- a/variants/rak_wismeshtap/platformio.ini +++ b/variants/rak_wismeshtap/platformio.ini @@ -3,7 +3,6 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak_wismeshtap -DWISMESH_TAP -DRAK_4631 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 diff --git a/variants/rp2040-lora/platformio.ini b/variants/rp2040-lora/platformio.ini index 4c578fb2b..7ac5b2cac 100644 --- a/variants/rp2040-lora/platformio.ini +++ b/variants/rp2040-lora/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/rp2040-lora -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags}, -g diff --git a/variants/rpipico-slowclock/platformio.ini b/variants/rpipico-slowclock/platformio.ini index c21994249..c56f9e78c 100644 --- a/variants/rpipico-slowclock/platformio.ini +++ b/variants/rpipico-slowclock/platformio.ini @@ -19,7 +19,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/rpipico-slowclock -DDEBUG_RP2040_PORT=Serial2 -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" -g -DNO_USB lib_deps = diff --git a/variants/rpipico/platformio.ini b/variants/rpipico/platformio.ini index 9c62ebcb5..e34cfa43b 100644 --- a/variants/rpipico/platformio.ini +++ b/variants/rpipico/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/rpipico -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags}, -g diff --git a/variants/rpipico2/platformio.ini b/variants/rpipico2/platformio.ini index de4954ea2..066809a91 100644 --- a/variants/rpipico2/platformio.ini +++ b/variants/rpipico2/platformio.ini @@ -9,7 +9,6 @@ build_flags = ${rp2350_base.build_flags} -Ivariants/rpipico2 -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33" lib_deps = ${rp2350_base.lib_deps} debug_build_flags = ${rp2350_base.build_flags}, -g diff --git a/variants/rpipico2w/platformio.ini b/variants/rpipico2w/platformio.ini index 282be1a42..0fac1e9ce 100644 --- a/variants/rpipico2w/platformio.ini +++ b/variants/rpipico2w/platformio.ini @@ -21,7 +21,6 @@ build_flags = ${rp2350_base.build_flags} -DARDUINO_RASPBERRY_PI_PICO_2W -DARDUINO_ARCH_RP2040 -DHAS_WIFI=1 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33" -fexceptions # for exception handling in MQTT -DHAS_UDP_MULTICAST=1 build_src_filter = ${rp2350_base.build_src_filter} + diff --git a/variants/rpipicow/platformio.ini b/variants/rpipicow/platformio.ini index 4b714434a..e59944b5d 100644 --- a/variants/rpipicow/platformio.ini +++ b/variants/rpipicow/platformio.ini @@ -8,7 +8,6 @@ build_flags = ${rp2040_base.build_flags} -DRPI_PICO -Ivariants/rpipicow -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" -fexceptions # for exception handling in MQTT -DHAS_UDP_MULTICAST=1 build_src_filter = ${rp2040_base.build_src_filter} + diff --git a/variants/seeed_xiao_nrf52840_kit/platformio.ini b/variants/seeed_xiao_nrf52840_kit/platformio.ini index 41956249b..0a8bee31c 100644 --- a/variants/seeed_xiao_nrf52840_kit/platformio.ini +++ b/variants/seeed_xiao_nrf52840_kit/platformio.ini @@ -3,7 +3,6 @@ extends = nrf52840_base board = xiao_ble_sense build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DSEEED_XIAO_NRF52840_KIT - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_xiao_nrf52840_kit> lib_deps = diff --git a/variants/senselora_rp2040/platformio.ini b/variants/senselora_rp2040/platformio.ini index 852ecbbb9..b05fc1f8b 100644 --- a/variants/senselora_rp2040/platformio.ini +++ b/variants/senselora_rp2040/platformio.ini @@ -9,6 +9,5 @@ build_flags = ${rp2040_base.build_flags} -DSENSELORA_RP2040 -Ivariants/senselora_rp2040 -DDEBUG_RP2040_PORT=Serial - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} \ No newline at end of file diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 59fd52ccd..85c3b5799 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -8,7 +8,6 @@ debug_tool = jlink # add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo -DGPS_POWER_TOGGLE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 -DEINK_WIDTH=200 -DEINK_HEIGHT=200 @@ -33,7 +32,6 @@ build_flags = ${nrf52840_base.build_flags} ${inkhud.build_flags} -I variants/t-echo - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" build_src_filter = ${nrf52_base.build_src_filter} ${inkhud.build_src_filter} diff --git a/variants/tlora_c6/platformio.ini b/variants/tlora_c6/platformio.ini index d042cd78b..2da10138a 100644 --- a/variants/tlora_c6/platformio.ini +++ b/variants/tlora_c6/platformio.ini @@ -7,4 +7,3 @@ build_flags = -I variants/tlora_c6 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/esp32c3" \ No newline at end of file diff --git a/variants/tracker-t1000-e/platformio.ini b/variants/tracker-t1000-e/platformio.ini index 64da61434..b1f11d524 100644 --- a/variants/tracker-t1000-e/platformio.ini +++ b/variants/tracker-t1000-e/platformio.ini @@ -2,7 +2,6 @@ extends = nrf52840_base board = tracker-t1000-e build_flags = ${nrf52840_base.build_flags} -Ivariants/tracker-t1000-e -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DTRACKER_T1000_E - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL=1 -DMESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 diff --git a/variants/wio-sdk-wm1110/platformio.ini b/variants/wio-sdk-wm1110/platformio.ini index e77455bcf..4e1415678 100644 --- a/variants/wio-sdk-wm1110/platformio.ini +++ b/variants/wio-sdk-wm1110/platformio.ini @@ -10,7 +10,6 @@ extra_scripts = # Remove adafruit USB serial from the build (it is incompatible with using the ch340 serial chip on this board) build_unflags = ${nrf52840_base:build_unflags} -DUSBCON -DUSE_TINYUSB build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-sdk-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DCFG_TUD_CDC=0 board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld diff --git a/variants/wio-t1000-s/platformio.ini b/variants/wio-t1000-s/platformio.ini index cb1cf86f7..2eab1e1c5 100644 --- a/variants/wio-t1000-s/platformio.ini +++ b/variants/wio-t1000-s/platformio.ini @@ -4,7 +4,6 @@ extends = nrf52840_base board = wio-t1000-s board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-t1000-s -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/wio-t1000-s> diff --git a/variants/wio-tracker-wm1110/platformio.ini b/variants/wio-tracker-wm1110/platformio.ini index 614fea588..a6960b435 100644 --- a/variants/wio-tracker-wm1110/platformio.ini +++ b/variants/wio-tracker-wm1110/platformio.ini @@ -3,7 +3,6 @@ extends = nrf52840_base board = wio-tracker-wm1110 build_flags = ${nrf52840_base.build_flags} -Ivariants/wio-tracker-wm1110 -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DWIO_WM1110 - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/wio-tracker-wm1110> diff --git a/variants/xiao_ble/platformio.ini b/variants/xiao_ble/platformio.ini index 6c47780d5..6fa1dd611 100644 --- a/variants/xiao_ble/platformio.ini +++ b/variants/xiao_ble/platformio.ini @@ -4,7 +4,6 @@ extends = nrf52840_base board = xiao_ble_sense board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/xiao_ble -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -D EBYTE_E22 -DEBYTE_E22_900M30S -DPRIVATE_HW - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/xiao_ble> lib_deps = From a2903921cd2cd2d949764318b931d7b5acd7b7dc Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 6 May 2025 12:09:01 -0400 Subject: [PATCH 15/60] Renovate: fix device-ui match (#6748) --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index e88bfb4e1..3403e7211 100644 --- a/renovate.json +++ b/renovate.json @@ -71,7 +71,7 @@ ], "packageRules": [ { - "matchPackageNames": ["meshtastic/device-ui"], + "matchDepNames": ["meshtastic/device-ui"], "reviewers": ["mverch67"], "changelogUrl": "https://github.com/meshtastic/device-ui/compare/{{currentDigest}}...{{newDigest}}" } From fdbe16f650f12e3b635b444933e4b244808256ee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 11:09:14 -0500 Subject: [PATCH 16/60] Bump release version (#6743) * automated bumps * Bump org.meshtastic.meshtasticd, fix GHA --------- Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> Co-authored-by: vidplace7 --- .github/workflows/release_channels.yml | 16 ++++++---------- bin/org.meshtastic.meshtasticd.metainfo.xml | 3 +++ debian/changelog | 8 ++++++-- version.properties | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index 12d66b9c2..6f216b411 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -63,21 +63,17 @@ jobs: with: python-version: 3.x - - name: Get release version string - run: | - echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT - echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT - id: version - env: - BUILD_LOCATION: local - - name: Bump version.properties run: | # Bump version.properties chmod +x ./bin/bump_version.py ./bin/bump_version.py + - name: Get new release version string + run: | + echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + id: new_version + - name: Ensure debian deps are installed run: | sudo apt-get update -y --fix-missing @@ -94,7 +90,7 @@ jobs: # Bump org.meshtastic.meshtasticd.metainfo.xml pip install -r bin/bump_metainfo/requirements.txt -q chmod +x ./bin/bump_metainfo/bump_metainfo.py - ./bin/bump_metainfo/bump_metainfo.py --file bin/org.meshtastic.meshtasticd.metainfo.xml "${{ steps.version.outputs.short }}" + ./bin/bump_metainfo/bump_metainfo.py --file bin/org.meshtastic.meshtasticd.metainfo.xml "${{ steps.new_version.outputs.short }}" env: PIP_DISABLE_PIP_VERSION_CHECK: 1 diff --git a/bin/org.meshtastic.meshtasticd.metainfo.xml b/bin/org.meshtastic.meshtasticd.metainfo.xml index 2cfba3523..b98b54dd4 100644 --- a/bin/org.meshtastic.meshtasticd.metainfo.xml +++ b/bin/org.meshtastic.meshtasticd.metainfo.xml @@ -87,6 +87,9 @@ + + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.8 + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.7 diff --git a/debian/changelog b/debian/changelog index 3ec57b805..8fce06c14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,13 @@ -meshtasticd (2.5.22.0) UNRELEASED; urgency=medium +meshtasticd (2.6.8.0) UNRELEASED; urgency=medium + [ Austin Lane ] * Initial packaging * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump - -- Austin Lane Wed, 05 Feb 2025 01:10:33 +0000 + [ ] + * GitHub Actions Automatic version bump + + -- Tue, 06 May 2025 01:32:49 +0000 diff --git a/version.properties b/version.properties index 5baa63dc2..bedba21b7 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 7 +build = 8 From dd2cf633b0e3e3df348e1aaef91fb009879cfe67 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 11:09:25 -0500 Subject: [PATCH 17/60] Upgrade trunk (#6745) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index c55635d9c..364ed746b 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,8 +10,8 @@ lint: enabled: - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.26 - - yamllint@1.37.0 + - trufflehog@3.88.27 + - yamllint@1.37.1 - bandit@1.8.3 - terrascan@1.19.9 - trivy@0.61.1 From 1e81ebed06ca954a22ea8046732e86a5d3b8844c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 11:14:45 -0500 Subject: [PATCH 18/60] chore(deps): update meshtastic/device-ui digest to 35576e1 (#6747) 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 ba41b386d..70a607f2f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/b9e2ad1222db9f5a5080248b2f018c250f0efae5.zip + https://github.com/meshtastic/device-ui/archive/35576e131e250f259878ea81819a90df837d1307.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 867f50ab111cdb07269c123e9ecaf70b1d5fb2e3 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 6 May 2025 13:03:01 -0400 Subject: [PATCH 19/60] Don't run `test-native` for event firmwares (#6749) --- .github/workflows/main_matrix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a9c4cbb52..9b9877e04 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -149,6 +149,7 @@ jobs: secrets: inherit test-native: + if: ${{ !contains(github.ref_name, 'event/') }} uses: ./.github/workflows/test_native.yml docker-deb-amd64: From 62421a83fd602fc2c5fc17ed655de8ce1fe0d224 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 6 May 2025 13:12:25 -0400 Subject: [PATCH 20/60] Fix EVENT_MODE on mqttless targets (#6750) --- src/mesh/Channels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 4d061f80f..2ba3499f1 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -345,7 +345,7 @@ void Channels::setChannel(const meshtastic_Channel &c) bool Channels::anyMqttEnabled() { -#if USERPREFS_EVENT_MODE +#if USERPREFS_EVENT_MODE && !MESHTASTIC_EXCLUDE_MQTT // Don't publish messages on the public MQTT broker if we are in event mode if (mqtt && mqtt->isUsingDefaultServer()) { return false; From 57d6c1fa8512bf18c1a2483d2362857b1705c065 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 6 May 2025 18:05:22 -0400 Subject: [PATCH 21/60] Fix event templates (names, PSKs) (#6753) --- userPrefs.jsonc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/userPrefs.jsonc b/userPrefs.jsonc index eb6dc64b6..06c4a7eec 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -7,14 +7,14 @@ // "USERPREFS_CHANNEL_0_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa1 }", // "USERPREFS_CHANNEL_0_UPLINK_ENABLED": "true", // "USERPREFS_CHANNEL_1_DOWNLINK_ENABLED": "false", - // "USERPREFS_CHANNEL_1_NAME": "Node Build Chat", + // "USERPREFS_CHANNEL_1_NAME": "NodeChat", // "USERPREFS_CHANNEL_1_PRECISION": "14", - // "USERPREFS_CHANNEL_1_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa2 }", + // "USERPREFS_CHANNEL_1_PSK": "{ 0x4e, 0x22, 0x1d, 0x8b, 0xc3, 0x09, 0x1b, 0xe2, 0x11, 0x9c, 0x89, 0x12, 0xf2, 0x25, 0x19, 0x5d, 0x15, 0x3e, 0x30, 0x7b, 0x86, 0xb6, 0xec, 0xc4, 0x6a, 0xc3, 0x96, 0x5e, 0x9e, 0x10, 0x9d, 0xd5 }", // "USERPREFS_CHANNEL_1_UPLINK_ENABLED": "false", // "USERPREFS_CHANNEL_2_DOWNLINK_ENABLED": "false", - // "USERPREFS_CHANNEL_2_NAME": "Equipment Exchange", + // "USERPREFS_CHANNEL_2_NAME": "YardSale", // "USERPREFS_CHANNEL_2_PRECISION": "14", - // "USERPREFS_CHANNEL_2_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa3 }", + // "USERPREFS_CHANNEL_2_PSK": "{ 0x15, 0x6f, 0xfe, 0x46, 0xd4, 0x56, 0x63, 0x8a, 0x54, 0x43, 0x13, 0xf2, 0xef, 0x6c, 0x63, 0x89, 0xf0, 0x06, 0x30, 0x52, 0xce, 0x36, 0x5e, 0xb1, 0xe8, 0xbb, 0x86, 0xe6, 0x26, 0x5b, 0x1d, 0x58 }", // "USERPREFS_CHANNEL_2_UPLINK_ENABLED": "false", // "USERPREFS_CONFIG_GPS_MODE": "meshtastic_Config_PositionConfig_GpsMode_ENABLED", // "USERPREFS_CONFIG_LORA_IGNORE_MQTT": "true", From 86217111b26885b2f92235388afc5d41575de94d Mon Sep 17 00:00:00 2001 From: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com> Date: Wed, 7 May 2025 04:28:18 -0700 Subject: [PATCH 22/60] Update SECURITY.md (#6757) --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index fb4d9005a..5092595e1 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,8 +4,8 @@ | Firmware Version | Supported | | ---------------- | ------------------ | -| 2.5.x | :white_check_mark: | -| <= 2.4.x | :x: | +| 2.6.x | :white_check_mark: | +| <= 2.5.x | :x: | ## Reporting a Vulnerability From 6f256c06f6ce078137bb6b6a06b60714a90964f5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 7 May 2025 09:26:10 -0500 Subject: [PATCH 23/60] Fix warning --- src/modules/SerialModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index e088b4612..8d280581c 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -513,7 +513,7 @@ void SerialModule::processWXSerial() // Extract the current line char line[meshtastic_Constants_DATA_PAYLOAD_LEN]; memset(line, '\0', sizeof(line)); - if (lineEnd - lineStart < sizeof(line) - 1) { + if ((size_t)(lineEnd - lineStart) < sizeof(line) - 1) { memcpy(line, &serialBytes[lineStart], lineEnd - lineStart); ParsedLine parsed = parseLine(line); From b657ba1abbaad875ba11877cbc35e45ee737c031 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 13:27:44 -0500 Subject: [PATCH 24/60] chore(deps): update sparkfun 9dof imu breakout icm 20948 to v1.3.2 (#6761) 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 70a607f2f..706e01b44 100644 --- a/platformio.ini +++ b/platformio.ini @@ -182,7 +182,7 @@ lib_deps = # renovate: datasource=custom.pio depName=SparkFun Qwiic Scale NAU7802 packageName=sparkfun/library/SparkFun Qwiic Scale NAU7802 Arduino Library sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6 # renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library - sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.0 + sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 # renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001 ClosedCube OPT3001@1.1.2 # renovate: datasource=git-refs depName=Bosch BSEC2 packageName=https://github.com/meshtastic/Bosch-BSEC2-Library gitBranch=extra_script From 3a6fc668d8d799313fdcf068c5f201fe983f0566 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Wed, 7 May 2025 18:38:42 -0500 Subject: [PATCH 25/60] 20948 compass support (#6707) * Add __has_include blocks for sensors * Put BMP and BME back in the right sensors * Split environmental_base to environmental_extra, to compile the working sensor libs for Native * Remove hard-coded checks for ARCH_PORTDUINO * Un-clobber bmx160 * Move BusIO to environmental_extra due to Armv7 compile error * Move to forked BusIO for the moment * Switch to Meshtastic ICM-20948 lib for Portduino support * Use 20948 for compass direction * Compass is more than just RAK4631 * Cleanup for 20948 compass * use Meshtastic branch of 20948 lib * Check for HAS_SCREEN for showing calibration screen * No accelerometerThread on STM32 --- platformio.ini | 8 +-- src/ButtonThread.cpp | 2 +- src/main.cpp | 11 +++- src/main.h | 2 +- src/modules/AdminModule.cpp | 2 +- src/motion/AccelerometerThread.h | 10 +-- src/motion/BMX160Sensor.cpp | 2 +- src/motion/ICM20948Sensor.cpp | 103 +++++++++++++++++++++++++++++++ src/motion/ICM20948Sensor.h | 4 ++ src/motion/MotionSensor.cpp | 2 +- src/motion/MotionSensor.h | 2 +- 11 files changed, 126 insertions(+), 22 deletions(-) diff --git a/platformio.ini b/platformio.ini index 706e01b44..1673dfc78 100644 --- a/platformio.ini +++ b/platformio.ini @@ -161,8 +161,10 @@ lib_deps = robtillaart/INA226@0.6.4 # renovate: datasource=custom.pio depName=SparkFun MAX3010x packageName=sparkfun/library/SparkFun MAX3010x Pulse and Proximity Sensor Library sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 - -; (not included in native / portduino) + # renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library + sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 + + ; (not included in native / portduino) [environmental_extra] lib_deps = # renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library @@ -181,8 +183,6 @@ lib_deps = adafruit/Adafruit SHT4x Library@1.0.5 # renovate: datasource=custom.pio depName=SparkFun Qwiic Scale NAU7802 packageName=sparkfun/library/SparkFun Qwiic Scale NAU7802 Arduino Library sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6 - # renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library - sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2 # renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001 ClosedCube OPT3001@1.1.2 # renovate: datasource=git-refs depName=Bosch BSEC2 packageName=https://github.com/meshtastic/Bosch-BSEC2-Library gitBranch=extra_script diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 04200a7df..352885dbe 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -255,7 +255,7 @@ int32_t ButtonThread::runOnce() digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW); break; #endif -#if defined(RAK_4631) +#if !MESHTASTIC_EXCLUDE_SCREEN && HAS_SCREEN // 5 clicks: start accelerometer/magenetometer calibration for 30 seconds case 5: if (accelerometerThread) { diff --git a/src/main.cpp b/src/main.cpp index 9ef944e65..452cb3526 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -105,7 +105,7 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr; #include "AmbientLightingThread.h" #include "PowerFSMThread.h" -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C #include "motion/AccelerometerThread.h" AccelerometerThread *accelerometerThread = nullptr; #endif @@ -692,7 +692,7 @@ void setup() } #endif -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) +#if !defined(ARCH_STM32WL) auto acc_info = i2cScanner->firstAccelerometer(); accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found; LOG_DEBUG("acc_info = %i", acc_info.type); @@ -807,7 +807,7 @@ void setup() #endif #if !MESHTASTIC_EXCLUDE_I2C -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) +#if !defined(ARCH_STM32WL) if (acc_info.type != ScanI2C::DeviceType::NONE) { accelerometerThread = new AccelerometerThread(acc_info.type); } @@ -1300,7 +1300,12 @@ void setup() LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap()); LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram()); #endif +#if !defined(ARCH_STM32WL) + if (accelerometerThread) + accelerometerThread->calibrate(30); +#endif } + #endif uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes) uint32_t shutdownAtMsec; // If not zero we will shutdown at this time (used to shutdown from python or mobile client) diff --git a/src/main.h b/src/main.h index c3807cfd5..beeb1f940 100644 --- a/src/main.h +++ b/src/main.h @@ -58,7 +58,7 @@ extern UdpMulticastHandler *udpHandler; // Global Screen singleton. extern graphics::Screen *screen; -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C #include "motion/AccelerometerThread.h" extern AccelerometerThread *accelerometerThread; #endif diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 650910542..0e1e1555b 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -38,7 +38,7 @@ #include "modules/PositionModule.h" #endif -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C #include "motion/AccelerometerThread.h" #endif diff --git a/src/motion/AccelerometerThread.h b/src/motion/AccelerometerThread.h index dd6413d64..02e5b0bd4 100755 --- a/src/motion/AccelerometerThread.h +++ b/src/motion/AccelerometerThread.h @@ -4,7 +4,7 @@ #include "configuration.h" -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C #include "../concurrency/OSThread.h" #ifdef HAS_BMA423 @@ -81,14 +81,6 @@ class AccelerometerThread : public concurrency::OSThread return; } -#ifndef RAK_4631 - if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) { - LOG_DEBUG("AccelerometerThread Disable due to no interested configurations"); - disable(); - return; - } -#endif - switch (device.type) { #ifdef HAS_BMA423 case ScanI2C::DeviceType::BMA423: diff --git a/src/motion/BMX160Sensor.cpp b/src/motion/BMX160Sensor.cpp index 39bc04ea1..a3909ea3a 100755 --- a/src/motion/BMX160Sensor.cpp +++ b/src/motion/BMX160Sensor.cpp @@ -4,7 +4,7 @@ BMX160Sensor::BMX160Sensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {} -#if defined(RAK_4631) && !defined(RAK2560) && __has_include() +#if !defined(RAK2560) && __has_include() #if !defined(MESHTASTIC_EXCLUDE_SCREEN) // screen is defined in main.cpp diff --git a/src/motion/ICM20948Sensor.cpp b/src/motion/ICM20948Sensor.cpp index 946390ddb..d03633124 100755 --- a/src/motion/ICM20948Sensor.cpp +++ b/src/motion/ICM20948Sensor.cpp @@ -1,6 +1,11 @@ #include "ICM20948Sensor.h" #if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && __has_include() +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) + +// screen is defined in main.cpp +extern graphics::Screen *screen; +#endif // Flag when an interrupt has been detected volatile static bool ICM20948_IRQ = false; @@ -41,6 +46,88 @@ int32_t ICM20948Sensor::runOnce() int32_t ICM20948Sensor::runOnce() { +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN + float magX = 0, magY = 0, magZ = 0; + if (sensor->dataReady()) { + sensor->getAGMT(); + magX = sensor->agmt.mag.axes.x; + magY = sensor->agmt.mag.axes.y; + magZ = sensor->agmt.mag.axes.z; + } + + if (doCalibration) { + + if (!showingScreen) { + powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration + showingScreen = true; + screen->startAlert((FrameCallback)drawFrameCalibration); + } + + if (magX > highestX) + highestX = magX; + if (magX < lowestX) + lowestX = magX; + if (magY > highestY) + highestY = magY; + if (magY < lowestY) + lowestY = magY; + if (magZ > highestZ) + highestZ = magZ; + if (magZ < lowestZ) + lowestZ = magZ; + + uint32_t now = millis(); + if (now > endCalibrationAt) { + doCalibration = false; + endCalibrationAt = 0; + showingScreen = false; + screen->endAlert(); + } + + // LOG_DEBUG("ICM20948 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX, + // lowestY, highestY, lowestZ, highestZ); + } + + magX -= (highestX + lowestX) / 2; + magY -= (highestY + lowestY) / 2; + magZ -= (highestZ + lowestZ) / 2; + FusionVector ga, ma; + ga.axis.x = (sensor->agmt.acc.axes.x); + ga.axis.y = -(sensor->agmt.acc.axes.y); + ga.axis.z = -(sensor->agmt.acc.axes.z); + ma.axis.x = magX; + ma.axis.y = magY; + ma.axis.z = magZ; + + // If we're set to one of the inverted positions + if (config.display.compass_orientation > meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270) { + ma = FusionAxesSwap(ma, FusionAxesAlignmentNXNYPZ); + ga = FusionAxesSwap(ga, FusionAxesAlignmentNXNYPZ); + } + + float heading = FusionCompassCalculateHeading(FusionConventionNed, ga, ma); + + switch (config.display.compass_orientation) { + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0_INVERTED: + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0: + break; + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90: + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90_INVERTED: + heading += 90; + break; + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180: + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180_INVERTED: + heading += 180; + break; + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270: + case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270_INVERTED: + heading += 270; + break; + } + + screen->setHeading(heading); +#endif + // Wake on motion using polling - this is not as efficient as using hardware interrupt pin (see above) auto status = sensor->setBank(0); if (sensor->status != ICM_20948_Stat_Ok) { @@ -64,6 +151,17 @@ int32_t ICM20948Sensor::runOnce() #endif +void ICM20948Sensor::calibrate(uint16_t forSeconds) +{ +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN + LOG_DEBUG("BMX160 calibration started for %is", forSeconds); + + doCalibration = true; + uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided + endCalibrationAt = millis() + calibrateFor; + screen->setEndCalibration(endCalibrationAt); +#endif +} // ---------------------------------------------------------------------- // ICM20948Singleton // ---------------------------------------------------------------------- @@ -121,6 +219,11 @@ bool ICM20948Singleton::init(ScanI2C::FoundDevice device) return false; } + if (startupMagnetometer(false) != ICM_20948_Stat_Ok) { + LOG_DEBUG("ICM20948 init magnetometer - %s", statusString()); + return false; + } + #ifdef ICM_20948_INT_PIN // Active low diff --git a/src/motion/ICM20948Sensor.h b/src/motion/ICM20948Sensor.h index 8344b0703..27ce4f451 100755 --- a/src/motion/ICM20948Sensor.h +++ b/src/motion/ICM20948Sensor.h @@ -6,6 +6,7 @@ #if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && __has_include() +#include "Fusion/Fusion.h" #include // Set the default gyro scale - dps250, dps500, dps1000, dps2000 @@ -80,6 +81,8 @@ class ICM20948Sensor : public MotionSensor { private: ICM20948Singleton *sensor = nullptr; + bool showingScreen = false; + float highestX = 0, lowestX = 0, highestY = 0, lowestY = 0, highestZ = 0, lowestZ = 0; public: explicit ICM20948Sensor(ScanI2C::FoundDevice foundDevice); @@ -89,6 +92,7 @@ class ICM20948Sensor : public MotionSensor // Called each time our sensor gets a chance to run virtual int32_t runOnce() override; + virtual void calibrate(uint16_t forSeconds) override; }; #endif diff --git a/src/motion/MotionSensor.cpp b/src/motion/MotionSensor.cpp index 54a2f883a..56738d355 100755 --- a/src/motion/MotionSensor.cpp +++ b/src/motion/MotionSensor.cpp @@ -31,7 +31,7 @@ ScanI2C::I2CPort MotionSensor::devicePort() return device.address.port; } -#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { // int x_offset = display->width() / 2; diff --git a/src/motion/MotionSensor.h b/src/motion/MotionSensor.h index 90080577f..5039f2551 100755 --- a/src/motion/MotionSensor.h +++ b/src/motion/MotionSensor.h @@ -49,7 +49,7 @@ class MotionSensor // Register a button press when a double-tap is detected virtual void buttonPress(); -#if defined(RAK_4631) & !MESHTASTIC_EXCLUDE_SCREEN +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN // draw an OLED frame (currently only used by the RAK4631 BMX160 sensor) static void drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); #endif From ff2a12d5795b7bd3a7d5c66056d5034f7f0d4da2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 08:32:01 +0800 Subject: [PATCH 26/60] chore(deps): update adafruit bme280 to v2.3.0 (#6708) 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 1673dfc78..8ceca3d87 100644 --- a/platformio.ini +++ b/platformio.ini @@ -122,7 +122,7 @@ lib_deps = # renovate: datasource=custom.pio depName=Adafruit BMP085 packageName=adafruit/library/Adafruit BMP085 Library adafruit/Adafruit BMP085 Library@1.2.4 # renovate: datasource=custom.pio depName=Adafruit BME280 packageName=adafruit/library/Adafruit BME280 Library - adafruit/Adafruit BME280 Library@2.2.4 + adafruit/Adafruit BME280 Library@2.3.0 # renovate: datasource=custom.pio depName=Adafruit DPS310 packageName=adafruit/library/Adafruit DPS310 adafruit/Adafruit DPS310@1.1.5 # renovate: datasource=custom.pio depName=Adafruit MCP9808 packageName=adafruit/library/Adafruit MCP9808 Library From ca9bf6b31aca8de3011d52bfe5a7ceebb8635171 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Thu, 8 May 2025 03:20:15 +0100 Subject: [PATCH 27/60] Update XIAO_NRF_KIT RXEN Pin definition (#6717) The XIAO NRF kit comes with a hat which has a slightly different pinout than the one supplied with the XIAO S3. At the last update, the RXEN pin was not moved with the rest. --- variants/seeed_xiao_nrf52840_kit/variant.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/seeed_xiao_nrf52840_kit/variant.h b/variants/seeed_xiao_nrf52840_kit/variant.h index 20362cb52..869c3d405 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.h +++ b/variants/seeed_xiao_nrf52840_kit/variant.h @@ -114,8 +114,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_TXEN RADIOLIB_NC -#define SX126X_RXEN D4 -#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the RF switch really necessary!!! +#define SX126X_RXEN D5 // This is used to control the RX side of the RF switch +#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the TX side of the RF switch #define SX126X_DIO3_TCXO_VOLTAGE 1.8 /* From 981ecfdb61bd231c47988bdec9c55e28bdaeef79 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 7 May 2025 21:20:32 -0500 Subject: [PATCH 28/60] Add client notification before role based power saving (sleep) (#6759) * Add client notification before role based power saving (sleep) * Unsigned --- src/modules/PositionModule.cpp | 11 +++++++++-- src/modules/Telemetry/EnvironmentTelemetry.cpp | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index acbc3143d..0b1bdcc46 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -370,9 +370,16 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER, meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && config.power.is_power_saving) { - LOG_DEBUG("Start next execution in 5s, then sleep"); + meshtastic_ClientNotification *notification = clientNotificationPool.allocZeroed(); + notification->level = meshtastic_LogRecord_Level_INFO; + notification->time = getValidTime(RTCQualityFromNet); + sprintf(notification->message, "Sending position and sleeping for %us interval in a moment", + Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs, default_broadcast_interval_secs) / + 1000U); + service->sendClientNotification(notification); sleepOnNextExecution = true; - setIntervalFromNow(5000); + LOG_DEBUG("Start next execution in 5s, then sleep"); + setIntervalFromNow(FIVE_SECONDS_MS); } } diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 32c660bbf..56f9d7433 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -675,9 +675,17 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) service->sendToMesh(p, RX_SRC_LOCAL, true); if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { - LOG_DEBUG("Start next execution in 5s, then sleep"); + meshtastic_ClientNotification *notification = clientNotificationPool.allocZeroed(); + notification->level = meshtastic_LogRecord_Level_INFO; + notification->time = getValidTime(RTCQualityFromNet); + sprintf(notification->message, "Sending telemetry and sleeping for %us interval in a moment", + Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval, + default_telemetry_broadcast_interval_secs) / + 1000U); + service->sendClientNotification(notification); sleepOnNextExecution = true; - setIntervalFromNow(5000); + LOG_DEBUG("Start next execution in 5s, then sleep"); + setIntervalFromNow(FIVE_SECONDS_MS); } } return true; From 3aee4bfc6bf2a67fe2c18664dcae2ee7d4fafb21 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 10 May 2025 19:01:03 +0800 Subject: [PATCH 29/60] Upgrade trunk (#6758) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 364ed746b..ca38c978a 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,11 +10,11 @@ lint: enabled: - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.27 + - trufflehog@3.88.28 - yamllint@1.37.1 - bandit@1.8.3 - terrascan@1.19.9 - - trivy@0.61.1 + - trivy@0.62.1 - taplo@0.9.3 - ruff@0.11.8 - isort@6.0.1 From c2a38357f174f301f344f960ed43a9d6f368b537 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 10 May 2025 14:54:58 +0200 Subject: [PATCH 30/60] chore(deps): update meshtastic/device-ui digest to 09b1780 (#6782) 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 8ceca3d87..042853ec6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/35576e131e250f259878ea81819a90df837d1307.zip + https://github.com/meshtastic/device-ui/archive/09b1780c8f944cffbc18a8ec5713cdfe03278503.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 23fe093a6556a9be577fedfa63ec7411711283dc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 10 May 2025 11:49:01 -0400 Subject: [PATCH 31/60] chore(config): migrate renovate config (#6784) * chore(config): migrate config renovate.json * Prettier: Ignore renovate --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: vidplace7 --- .trunk/configs/.prettierignore | 1 + renovate.json | 44 ++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 .trunk/configs/.prettierignore diff --git a/.trunk/configs/.prettierignore b/.trunk/configs/.prettierignore new file mode 100644 index 000000000..a63a557a4 --- /dev/null +++ b/.trunk/configs/.prettierignore @@ -0,0 +1 @@ +renovate.json diff --git a/renovate.json b/renovate.json index 3403e7211..e90462cc3 100644 --- a/renovate.json +++ b/renovate.json @@ -9,15 +9,21 @@ "workarounds:all" ], "forkProcessing": "enabled", - "ignoreDeps": ["protobufs"], + "ignoreDeps": [ + "protobufs" + ], "git-submodules": { "enabled": true }, "pip_requirements": { - "fileMatch": ["bin/bump_metainfo/requirements.txt"] + "managerFilePatterns": [ + "/bin/bump_metainfo/requirements.txt/" + ] }, "commitMessageTopic": "{{depName}}", - "labels": ["dependencies"], + "labels": [ + "dependencies" + ], "customDatasources": { "pio": { "description": "PlatformIO Registry", @@ -32,8 +38,12 @@ { "customType": "regex", "description": "Match meshtastic/web version", - "fileMatch": ["bin/web.version"], - "matchStrings": ["(?.+)$"], + "managerFilePatterns": [ + "/bin/web.version/" + ], + "matchStrings": [ + "(?.+)$" + ], "datasourceTemplate": "github-releases", "depNameTemplate": "meshtastic/web", "versioningTemplate": "semver-coerced" @@ -41,7 +51,9 @@ { "customType": "regex", "description": "Match normal PIO dependencies", - "fileMatch": [".*\\.ini$"], + "managerFilePatterns": [ + "/.*\\.ini$/" + ], "matchStrings": [ "# renovate: datasource=(?.*?)(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\s+?.+?@(?.+?)\\s" ], @@ -50,9 +62,11 @@ { "customType": "regex", "description": "Match PIO zipped dependencies with github tag ref", - "fileMatch": [".*\\.ini$"], + "managerFilePatterns": [ + "/.*\\.ini$/" + ], "matchStrings": [ - "# renovate: datasource=github-tags(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\s+?https:\/\/.+?archive\/(?.+?).zip\\s" + "# renovate: datasource=github-tags(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\s+?https://.+?archive/(?.+?).zip\\s" ], "datasourceTemplate": "github-tags", "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}" @@ -60,9 +74,11 @@ { "customType": "regex", "description": "Match PIO zipped dependencies with git commit ref", - "fileMatch": [".*\\.ini$"], + "managerFilePatterns": [ + "/.*\\.ini$/" + ], "matchStrings": [ - "# renovate: datasource=git-refs(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\sgitBranch=(?.+?)\\s+?https:\/\/.+?archive\/(?.+?).zip\\s" + "# renovate: datasource=git-refs(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\sgitBranch=(?.+?)\\s+?https://.+?archive/(?.+?).zip\\s" ], "datasourceTemplate": "git-refs", "currentValueTemplate": "{{{gitBranch}}}", @@ -71,8 +87,12 @@ ], "packageRules": [ { - "matchDepNames": ["meshtastic/device-ui"], - "reviewers": ["mverch67"], + "matchDepNames": [ + "meshtastic/device-ui" + ], + "reviewers": [ + "mverch67" + ], "changelogUrl": "https://github.com/meshtastic/device-ui/compare/{{currentDigest}}...{{newDigest}}" } ] From 7c9296b0f43348204f8f1356e8a9fb8bec57b12c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 10 May 2025 18:48:39 +0200 Subject: [PATCH 32/60] chore(deps): update meshtastic/device-ui digest to 027f5a5 (#6783) 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 042853ec6..427ff1702 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/09b1780c8f944cffbc18a8ec5713cdfe03278503.zip + https://github.com/meshtastic/device-ui/archive/027f5a5bace46e75a8208239b20655140dc186df.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From b17bb49a6333facf9dee585ac3dd914c13cfcf8f Mon Sep 17 00:00:00 2001 From: Austin Date: Sat, 10 May 2025 17:21:23 -0400 Subject: [PATCH 33/60] Actions: Fix end to end tests (#6776) --- .github/workflows/tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f0ee0af4..28b6a40a5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,10 @@ on: - cron: 0 0 * * * # Run every day at midnight workflow_dispatch: {} -permissions: read-all +permissions: + contents: read + actions: read + checks: write jobs: native-tests: @@ -44,7 +47,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 22 - name: Setup pnpm uses: pnpm/action-setup@v4 From b208e1924fb82c9ab9eb273a8679b0edfdc11821 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 11 May 2025 00:59:38 +0200 Subject: [PATCH 34/60] chore(deps): update meshtastic/device-ui digest to 7dee10a (#6786) 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 427ff1702..b78ecdc1a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -108,7 +108,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/027f5a5bace46e75a8208239b20655140dc186df.zip + https://github.com/meshtastic/device-ui/archive/7dee10ad31a0c6ea04880cba399e240be743d752.zip ; Common libs for environmental measurements in telemetry module [environmental_base] From 62e1974d092453d481dfa2546bcb34180707a029 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Sun, 11 May 2025 10:17:37 +0100 Subject: [PATCH 35/60] Add clarifying note about AHT20 also being included with AHT10 library (#6787) * Update AHT10.h Add clarifying note about AHT20 also being included * Update AHT10.cpp Add clarifying note about AHT20 also being included --- src/modules/Telemetry/Sensor/AHT10.cpp | 6 +++++- src/modules/Telemetry/Sensor/AHT10.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/Sensor/AHT10.cpp b/src/modules/Telemetry/Sensor/AHT10.cpp index 096a131b9..35934533b 100644 --- a/src/modules/Telemetry/Sensor/AHT10.cpp +++ b/src/modules/Telemetry/Sensor/AHT10.cpp @@ -1,3 +1,7 @@ +/* + * Worth noting that both the AHT10 and AHT20 are supported without alteration. + */ + #include "configuration.h" #if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() @@ -41,4 +45,4 @@ bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement) return true; } -#endif \ No newline at end of file +#endif diff --git a/src/modules/Telemetry/Sensor/AHT10.h b/src/modules/Telemetry/Sensor/AHT10.h index b2f0d8ae5..a6fa19952 100644 --- a/src/modules/Telemetry/Sensor/AHT10.h +++ b/src/modules/Telemetry/Sensor/AHT10.h @@ -1,3 +1,7 @@ +/* + * Worth noting that both the AHT10 and AHT20 are supported without alteration. + */ + #include "configuration.h" #if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() @@ -20,4 +24,4 @@ class AHT10Sensor : public TelemetrySensor virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; -#endif \ No newline at end of file +#endif From 2a06b058fdd7dca02667635ba9415030b675b9cc Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 11 May 2025 15:18:53 -0500 Subject: [PATCH 36/60] Only send nodes on want_config of 69421 (#6792) --- src/mesh/PhoneAPI.cpp | 28 +++++++++++++++++++++++----- src/mesh/PhoneAPI.h | 3 ++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 0e18b8ab1..db01e95f3 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -54,7 +54,13 @@ void PhoneAPI::handleStartConfig() } // even if we were already connected - restart our state machine - state = STATE_SEND_MY_INFO; + if (config_nonce == SPECIAL_NONCE_ONLY_NODES) { + // If client only wants node info, jump directly to sending nodes + state = STATE_SEND_OWN_NODEINFO; + LOG_INFO("Client only wants node info, skipping other config"); + } else { + state = STATE_SEND_MY_INFO; + } pauseBluetoothLogging = true; spiLock->lock(); filesManifest = getFiles("/", 10); @@ -224,7 +230,12 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // Should allow us to resume sending NodeInfo in STATE_SEND_OTHER_NODEINFOS nodeInfoForPhone.num = 0; } - state = STATE_SEND_METADATA; + if (config_nonce == SPECIAL_NONCE_ONLY_NODES) { + // If client only wants node info, jump directly to sending nodes + state = STATE_SEND_OTHER_NODEINFOS; + } else { + state = STATE_SEND_METADATA; + } break; } @@ -388,8 +399,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) config_state++; // Advance when we have sent all of our ModuleConfig objects if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) { - // Clients sending special nonce don't want to see other nodeinfos - state = config_nonce == SPECIAL_NONCE ? STATE_SEND_FILEMANIFEST : STATE_SEND_OTHER_NODEINFOS; + // Handle special nonce behaviors: + // - SPECIAL_NONCE_ONLY_CONFIG: Skip node info, go directly to file manifest + // - SPECIAL_NONCE_ONLY_NODES: After sending nodes, skip to complete + if (config_nonce == SPECIAL_NONCE_ONLY_CONFIG) { + state = STATE_SEND_FILEMANIFEST; + } else { + state = STATE_SEND_OTHER_NODEINFOS; + } config_state = 0; } break; @@ -415,7 +432,8 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_FILEMANIFEST: { LOG_DEBUG("FromRadio=STATE_SEND_FILEMANIFEST"); // last element - if (config_state == filesManifest.size()) { // also handles an empty filesManifest + if (config_state == filesManifest.size() || + config_nonce == SPECIAL_NONCE_ONLY_NODES) { // also handles an empty filesManifest config_state = 0; filesManifest.clear(); // Skip to complete packet diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index 681b244c8..0d7772d17 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -18,7 +18,8 @@ #error "meshtastic_ToRadio_size is too large for our BLE packets" #endif -#define SPECIAL_NONCE 69420 +#define SPECIAL_NONCE_ONLY_CONFIG 69420 +#define SPECIAL_NONCE_ONLY_NODES 69421 // ( ͡° ͜ʖ ͡°) /** * Provides our protobuf based API which phone/PC clients can use to talk to our device From b9fcd9da233ad5b7438f2b836b612eba15b149ef Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 11 May 2025 18:08:29 -0500 Subject: [PATCH 37/60] Add some no-nonsense coercion for self-reporting node values (#6793) * Add some no-nonsense coercion for self-reporting node values * Update src/mesh/PhoneAPI.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/mesh/PhoneAPI.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index db01e95f3..e2acd8463 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -565,9 +565,12 @@ bool PhoneAPI::available() auto nextNode = nodeDB->readNextMeshNode(readIndex); if (nextNode) { nodeInfoForPhone = TypeConversions::ConvertToNodeInfo(nextNode); - nodeInfoForPhone.hops_away = nodeInfoForPhone.num == nodeDB->getNodeNum() ? 0 : nodeInfoForPhone.hops_away; - nodeInfoForPhone.is_favorite = - nodeInfoForPhone.is_favorite || nodeInfoForPhone.num == nodeDB->getNodeNum(); // Our node is always a favorite + bool isUs = nodeInfoForPhone.num == nodeDB->getNodeNum(); + nodeInfoForPhone.hops_away = isUs ? 0 : nodeInfoForPhone.hops_away; + nodeInfoForPhone.last_heard = isUs ? getValidTime(RTCQualityFromNet) : nodeInfoForPhone.last_heard; + 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 } } return true; // Always say we have something, because we might need to advance our state machine From e1417cff2e8796b3c8c7af5988b7955ae59d9054 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 May 2025 06:59:26 -0500 Subject: [PATCH 38/60] [create-pull-request] automated change (#6804) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.cpp | 3 +++ src/mesh/generated/meshtastic/admin.pb.h | 28 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 078ac8dfb..816595c8b 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 078ac8dfbe5f7533d7755cbe2ca3d08d86e5af34 +Subproject commit 816595c8bbdfc3b4388e11348ccd043294d58705 diff --git a/src/mesh/generated/meshtastic/admin.pb.cpp b/src/mesh/generated/meshtastic/admin.pb.cpp index 2e527f669..9bf40870f 100644 --- a/src/mesh/generated/meshtastic/admin.pb.cpp +++ b/src/mesh/generated/meshtastic/admin.pb.cpp @@ -15,6 +15,9 @@ PB_BIND(meshtastic_HamParameters, meshtastic_HamParameters, AUTO) PB_BIND(meshtastic_NodeRemoteHardwarePinsResponse, meshtastic_NodeRemoteHardwarePinsResponse, 2) +PB_BIND(meshtastic_SharedContact, meshtastic_SharedContact, AUTO) + + diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index efe60f493..09499b075 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -99,6 +99,14 @@ typedef struct _meshtastic_NodeRemoteHardwarePinsResponse { meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[16]; } meshtastic_NodeRemoteHardwarePinsResponse; +typedef struct _meshtastic_SharedContact { + /* The node number of the contact */ + uint32_t node_num; + /* The User of the contact */ + bool has_user; + meshtastic_User user; +} meshtastic_SharedContact; + typedef PB_BYTES_ARRAY_T(8) meshtastic_AdminMessage_session_passkey_t; /* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. This message is used to do settings operations to both remote AND local nodes. @@ -202,6 +210,8 @@ typedef struct _meshtastic_AdminMessage { bool begin_edit_settings; /* Commits an open transaction for any edits made to config, module config, owner, and channel settings */ bool commit_edit_settings; + /* Add a contact (User) to the nodedb */ + meshtastic_SharedContact add_contact; /* Tell the node to factory reset config everything; all device state and configuration will be returned to factory defaults and BLE bonds will be cleared. */ int32_t factory_reset_device; /* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot) @@ -252,13 +262,16 @@ extern "C" { + /* Initializer values for message structs */ #define meshtastic_AdminMessage_init_default {0, {0}, {0, {0}}} #define meshtastic_HamParameters_init_default {"", 0, 0, ""} #define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}} +#define meshtastic_SharedContact_init_default {0, false, meshtastic_User_init_default} #define meshtastic_AdminMessage_init_zero {0, {0}, {0, {0}}} #define meshtastic_HamParameters_init_zero {"", 0, 0, ""} #define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}} +#define meshtastic_SharedContact_init_zero {0, false, meshtastic_User_init_zero} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_HamParameters_call_sign_tag 1 @@ -266,6 +279,8 @@ extern "C" { #define meshtastic_HamParameters_frequency_tag 3 #define meshtastic_HamParameters_short_name_tag 4 #define meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_tag 1 +#define meshtastic_SharedContact_node_num_tag 1 +#define meshtastic_SharedContact_user_tag 2 #define meshtastic_AdminMessage_get_channel_request_tag 1 #define meshtastic_AdminMessage_get_channel_response_tag 2 #define meshtastic_AdminMessage_get_owner_request_tag 3 @@ -310,6 +325,7 @@ extern "C" { #define meshtastic_AdminMessage_remove_ignored_node_tag 48 #define meshtastic_AdminMessage_begin_edit_settings_tag 64 #define meshtastic_AdminMessage_commit_edit_settings_tag 65 +#define meshtastic_AdminMessage_add_contact_tag 66 #define meshtastic_AdminMessage_factory_reset_device_tag 94 #define meshtastic_AdminMessage_reboot_ota_seconds_tag 95 #define meshtastic_AdminMessage_exit_simulator_tag 96 @@ -365,6 +381,7 @@ X(a, STATIC, ONEOF, UINT32, (payload_variant,set_ignored_node,set_ignored X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_ignored_node,remove_ignored_node), 48) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,add_contact,add_contact), 66) \ X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_device,factory_reset_device), 94) \ X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,exit_simulator,exit_simulator), 96) \ @@ -390,6 +407,7 @@ X(a, STATIC, SINGULAR, BYTES, session_passkey, 101) #define meshtastic_AdminMessage_payload_variant_set_fixed_position_MSGTYPE meshtastic_Position #define meshtastic_AdminMessage_payload_variant_get_ui_config_response_MSGTYPE meshtastic_DeviceUIConfig #define meshtastic_AdminMessage_payload_variant_store_ui_config_MSGTYPE meshtastic_DeviceUIConfig +#define meshtastic_AdminMessage_payload_variant_add_contact_MSGTYPE meshtastic_SharedContact #define meshtastic_HamParameters_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, call_sign, 1) \ @@ -405,20 +423,30 @@ X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 1) #define meshtastic_NodeRemoteHardwarePinsResponse_DEFAULT NULL #define meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin +#define meshtastic_SharedContact_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, node_num, 1) \ +X(a, STATIC, OPTIONAL, MESSAGE, user, 2) +#define meshtastic_SharedContact_CALLBACK NULL +#define meshtastic_SharedContact_DEFAULT NULL +#define meshtastic_SharedContact_user_MSGTYPE meshtastic_User + extern const pb_msgdesc_t meshtastic_AdminMessage_msg; extern const pb_msgdesc_t meshtastic_HamParameters_msg; extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg; +extern const pb_msgdesc_t meshtastic_SharedContact_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg #define meshtastic_HamParameters_fields &meshtastic_HamParameters_msg #define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg +#define meshtastic_SharedContact_fields &meshtastic_SharedContact_msg /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size #define meshtastic_AdminMessage_size 511 #define meshtastic_HamParameters_size 31 #define meshtastic_NodeRemoteHardwarePinsResponse_size 496 +#define meshtastic_SharedContact_size 121 #ifdef __cplusplus } /* extern "C" */ From cc66f7c79ba976dc780cd2082258c6c5c4126fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 13 May 2025 14:15:52 +0200 Subject: [PATCH 39/60] Crowpanel 4.3, 5.0, 7.0 support (#6611) * SD software SPI control * fix notification crash; * allow wake on touch * don't build non-MUI variants * use pwm buzzer * Finalize support for Crowpanel TFT 2.4, 2.8 and 3.5 * add hardware ID for TFT panels * Add stubs for the bigger panels. WIP! * fix braces * elecrow 4.3, 5.0, 7.0 support * completed implementation 4.3, 5.0, 7.0 variants * NodeDB default config & simplified light sleep macros * trunk fmt * remove flags * removed leftovers (note: rtc gpios are only needed for deep sleep; the remove section caused issues with the elecrows) --------- Co-authored-by: mverch67 Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> Co-authored-by: Austin --- boards/crowpanel.json | 4 +- src/graphics/ScreenFonts.h | 4 +- src/mesh/NodeDB.cpp | 4 +- src/sleep.cpp | 35 ++++--- variants/elecrow_panel/pins_arduino.h | 14 +-- variants/elecrow_panel/platformio.ini | 73 ++++++------- variants/elecrow_panel/variant.h | 141 ++++---------------------- variants/mesh-tab/variant.h | 3 +- variants/rak_wismeshtap/variant.h | 3 + variants/t-deck/variant.h | 1 + variants/t-watch-s3/variant.h | 2 + variants/unphone/variant.h | 3 + 12 files changed, 98 insertions(+), 189 deletions(-) diff --git a/boards/crowpanel.json b/boards/crowpanel.json index 570961ed7..75b097ef7 100644 --- a/boards/crowpanel.json +++ b/boards/crowpanel.json @@ -8,8 +8,8 @@ "core": "esp32", "extra_flags": [ "-DBOARD_HAS_PSRAM", - "-DARDUINO_USB_CDC_ON_BOOT=1", - "-DARDUINO_USB_MODE=0", + "-DARDUINO_USB_CDC_ON_BOOT=0", + "-DARDUINO_USB_MODE=1", "-DARDUINO_RUNNING_CORE=1", "-DARDUINO_EVENT_RUNNING_CORE=0" ], diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 0be0dc814..3373a47a7 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -65,8 +65,8 @@ #endif #if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \ - defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) || \ - defined(ILI9488_CS) && !defined(DISPLAY_FORCE_SMALL_FONTS) + defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS) || defined(ILI9488_CS)) && \ + !defined(DISPLAY_FORCE_SMALL_FONTS) // The screen is bigger so use bigger fonts #define FONT_SMALL FONT_MEDIUM_LOCAL // Height: 19 #define FONT_MEDIUM FONT_LARGE_LOCAL // Height: 28 diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 67f0da600..b64cb0fe1 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -584,7 +584,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)) && \ + defined(ELECROW_PANEL)) && \ HAS_TFT // switch BT off by default; use TFT programming mode or hotkey to enable config.bluetooth.enabled = false; @@ -689,7 +689,7 @@ void NodeDB::initConfigIntervals() config.display.screen_on_secs = default_screen_on_secs; -#if defined(T_WATCH_S3) || defined(T_DECK) || defined(UNPHONE) || defined(MESH_TAB) || defined(RAK14014) || defined(ELECROW) +#if defined(USE_POWERSAVE) config.power.is_power_saving = true; config.display.screen_on_secs = 30; config.power.wait_bluetooth_secs = 30; diff --git a/src/sleep.cpp b/src/sleep.cpp index 2985db0c2..8ffb08b04 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -24,6 +24,7 @@ #include "mesh/wifi/WiFiAPClient.h" #endif #include "rom/rtc.h" +#include #include #include @@ -284,6 +285,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN pinMode(LORA_CS, OUTPUT); digitalWrite(LORA_CS, HIGH); gpio_hold_en((gpio_num_t)LORA_CS); +#elif defined(ELECROW_PANEL) + // Elecrow panels do not use LORA_CS, do nothing #else if (GPIO_IS_VALID_OUTPUT_GPIO(LORA_CS)) { // LoRa CS (RADIO_NSS) needs to stay HIGH, even during deep sleep @@ -400,7 +403,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #ifdef INPUTDRIVER_ENCODER_BTN gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL); #endif -#if defined(T_WATCH_S3) || defined(ELECROW) +#if defined(WAKE_ON_TOUCH) gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL); #endif enableLoraInterrupt(); @@ -433,11 +436,12 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r // Disable wake-on-button interrupt. Re-attach normal button-interrupts gpio_wakeup_disable(pin); #endif - -#if defined(T_WATCH_S3) || defined(ELECROW) +#if defined(INPUTDRIVER_ENCODER_BTN) + gpio_wakeup_disable((gpio_num_t)INPUTDRIVER_ENCODER_BTN); +#endif +#if defined(WAKE_ON_TOUCH) gpio_wakeup_disable((gpio_num_t)SCREEN_TOUCH_INT); #endif - #if !defined(SOC_PM_SUPPORT_EXT_WAKEUP) && defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC) if (radioType != RF95_RADIO) { gpio_wakeup_disable((gpio_num_t)LORA_DIO1); @@ -506,23 +510,24 @@ bool shouldLoraWake(uint32_t msecToWake) void enableLoraInterrupt() { + esp_err_t res; #if SOC_PM_SUPPORT_EXT_WAKEUP && defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC) - gpio_pulldown_en((gpio_num_t)LORA_DIO1); + res = gpio_pulldown_en((gpio_num_t)LORA_DIO1); + if (res != ESP_OK) { + LOG_ERROR("gpio_pulldown_en(LORA_DIO1) result %d", res); + } #if defined(LORA_RESET) && (LORA_RESET != RADIOLIB_NC) - gpio_pullup_en((gpio_num_t)LORA_RESET); + res = gpio_pullup_en((gpio_num_t)LORA_RESET); + if (res != ESP_OK) { + LOG_ERROR("gpio_pullup_en(LORA_RESET) result %d", res); + } #endif -#if defined(LORA_CS) && (LORA_CS != RADIOLIB_NC) +#if defined(LORA_CS) && (LORA_CS != RADIOLIB_NC) && !defined(ELECROW_PANEL) gpio_pullup_en((gpio_num_t)LORA_CS); #endif - if (rtc_gpio_is_valid_gpio((gpio_num_t)LORA_DIO1)) { - // Setup light/deep sleep with wakeup by external source - LOG_INFO("setup LORA_DIO1 (GPIO%02d) with wakeup by external source", LORA_DIO1); - esp_sleep_enable_ext0_wakeup((gpio_num_t)LORA_DIO1, HIGH); - } else { - LOG_INFO("setup LORA_DIO1 (GPIO%02d) with wakeup by gpio interrupt", LORA_DIO1); - gpio_wakeup_enable((gpio_num_t)LORA_DIO1, GPIO_INTR_HIGH_LEVEL); - } + LOG_INFO("setup LORA_DIO1 (GPIO%02d) with wakeup by gpio interrupt", LORA_DIO1); + gpio_wakeup_enable((gpio_num_t)LORA_DIO1, GPIO_INTR_HIGH_LEVEL); #elif defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC) if (radioType != RF95_RADIO) { diff --git a/variants/elecrow_panel/pins_arduino.h b/variants/elecrow_panel/pins_arduino.h index b98530378..81c9e0a2c 100644 --- a/variants/elecrow_panel/pins_arduino.h +++ b/variants/elecrow_panel/pins_arduino.h @@ -3,13 +3,11 @@ #include -// static const uint8_t LED_BUILTIN = -1; +static const uint8_t TX = 43; +static const uint8_t RX = 44; -// static const uint8_t TX = 43; -// static const uint8_t RX = 44; - -static const uint8_t SDA = 39; -static const uint8_t SCL = 40; +static const uint8_t SDA = 15; +static const uint8_t SCL = 16; // Default SPI will be mapped to Radio static const uint8_t SS = -1; @@ -17,13 +15,9 @@ static const uint8_t MOSI = 48; static const uint8_t MISO = 47; static const uint8_t SCK = 41; -#ifndef CROW_SELECT static const uint8_t SPI_MOSI = 6; static const uint8_t SPI_SCK = 5; static const uint8_t SPI_MISO = 4; -static const uint8_t SPI_CS = 7; // SD does not support -1 -static const uint8_t SDCARD_CS = SPI_CS; -#endif static const uint8_t A0 = 1; static const uint8_t A1 = 2; diff --git a/variants/elecrow_panel/platformio.ini b/variants/elecrow_panel/platformio.ini index 66dc35c3b..963174560 100644 --- a/variants/elecrow_panel/platformio.ini +++ b/variants/elecrow_panel/platformio.ini @@ -4,10 +4,8 @@ board = crowpanel board_check = true upload_protocol = esptool board_build.partitions = default_16MB.csv ; must be here for some reason, board.json is not enough !? - build_flags = ${esp32s3_base.build_flags} -Os -I variants/elecrow_panel - -D ELECROW -D ELECROW_PANEL -D CONFIG_ARDUHAL_LOG_COLORS -D RADIOLIB_DEBUG_SPI=0 @@ -22,15 +20,15 @@ build_flags = ${esp32s3_base.build_flags} -Os -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 -D MESHTASTIC_EXCLUDE_SCREEN=1 -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 -; -D INPUTDRIVER_BUTTON_TYPE=0 -D HAS_TELEMETRY=0 -D CONFIG_DISABLE_HAL_LOCKS=1 + -D USE_PIN_BUZZER -D HAS_SCREEN=0 -D HAS_TFT=1 -D RAM_SIZE=6144 - -D LV_LVGL_H_INCLUDE_SIMPLE - -D LV_CONF_INCLUDE_SIMPLE - -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE -D LV_USE_SYSMON=0 -D LV_USE_PROFILER=0 -D LV_USE_PERF_MONITOR=0 @@ -40,29 +38,44 @@ build_flags = ${esp32s3_base.build_flags} -Os -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API + -D HAS_SDCARD + -D SD_SPI_FREQUENCY=75000000 lib_deps = ${esp32s3_base.lib_deps} ${device-ui_base.lib_deps} - earlephilhower/ESP8266Audio@^1.9.9 - earlephilhower/ESP8266SAM@^1.0.1 - lovyan03/LovyanGFX@^1.2.0 - hideakitai/TCA9534@^0.1.1 + earlephilhower/ESP8266Audio@1.9.9 + earlephilhower/ESP8266SAM@1.0.1 + lovyan03/LovyanGFX@1.2.0 ; note: v1.2.7 breaks the elecrow 7" display functionality + hideakitai/TCA9534@0.1.1 -[env:elecrow-24-28-tft] +[crowpanel_small] ; 2.4, 2.8, 3.5 inch extends = crowpanel_base - build_flags = ${crowpanel_base.build_flags} - -D TFT_HEIGHT=320 ; needed in variant.h - -D HAS_SDCARD + -D CROW_SELECT=1 -D SDCARD_USE_SOFT_SPI + -D SDCARD_CS=7 -D SPI_DRIVER_SELECT=2 - -D USE_PIN_BUZZER -; -D INPUTDRIVER_BUTTON_TYPE=0 ; no button as this pin is assigned to LoRa cs! - -D SCREEN_TOUCH_INT=47 ; used to wake up the MCU by touch -D LGFX_DRIVER_TEMPLATE -D LGFX_DRIVER=LGFX_GENERIC -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\" + -D VIEW_320x240 + -D MAP_FULL_REDRAW + +[crowpanel_large] ; 4.3, 5.0, 7.0 inch +extends = crowpanel_base +build_flags = + ${crowpanel_base.build_flags} + -D CROW_SELECT=2 + -D SDCARD_CS=7 + -D LGFX_DRIVER=LGFX_ELECROW70 + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_ELECROW70.h\" + -D DISPLAY_SET_RESOLUTION + +[env:elecrow-adv-24-28-tft] +extends = crowpanel_small +build_flags = + ${crowpanel_small.build_flags} -D SPI_FREQUENCY=80000000 -D LGFX_SCREEN_WIDTH=240 -D LGFX_SCREEN_HEIGHT=320 @@ -81,25 +94,12 @@ build_flags = -D LGFX_TOUCH_INT=47 -D LGFX_TOUCH_RST=48 -D LGFX_TOUCH_ROTATION=0 - -D VIEW_320x240 - -D MAP_FULL_REDRAW - -[env:elecrow-35-tft] -extends = crowpanel_base +[env:elecrow-adv-35-tft] +extends = crowpanel_small build_flags = - ${crowpanel_base.build_flags} - -D TFT_HEIGHT=480 ; needed in variant.h - -D HAS_SDCARD - -D SDCARD_USE_SOFT_SPI - -D SPI_DRIVER_SELECT=2 - -D USE_PIN_BUZZER -; -D INPUTDRIVER_BUTTON_TYPE=0 ; no button as this pin is assigned to LoRa cs! - -D SCREEN_TOUCH_INT=47 ; used to wake up the MCU by touch + ${crowpanel_small.build_flags} -D LV_CACHE_DEF_SIZE=2097152 - -D LGFX_DRIVER_TEMPLATE - -D LGFX_DRIVER=LGFX_GENERIC - -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\" -D SPI_FREQUENCY=60000000 -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 @@ -119,5 +119,10 @@ build_flags = -D LGFX_TOUCH_RST=48 -D LGFX_TOUCH_ROTATION=0 -D DISPLAY_SET_RESOLUTION + +; 4.3, 5.0, 7.0 inch 800x480 IPS (V1) +[env:elecrow-adv1-43-50-70-tft] +extends = crowpanel_large +build_flags = + ${crowpanel_large.build_flags} -D VIEW_320x240 - -D MAP_FULL_REDRAW diff --git a/variants/elecrow_panel/variant.h b/variants/elecrow_panel/variant.h index b1035ed31..99069b723 100644 --- a/variants/elecrow_panel/variant.h +++ b/variants/elecrow_panel/variant.h @@ -1,124 +1,14 @@ #define I2C_SDA 15 #define I2C_SCL 16 -#if TFT_HEIGHT == 320 && not defined(HAS_TFT) // 2.4 and 2.8 TFT -// ST7789 TFT LCD -#define ST7789_CS 40 -#define ST7789_RS 41 // DC -#define ST7789_SDA 39 // MOSI -#define ST7789_SCK 42 -#define ST7789_RESET -1 -#define ST7789_MISO 38 -#define ST7789_BUSY -1 -#define ST7789_BL 38 -#define ST7789_SPI_HOST SPI2_HOST -#define TFT_BL 38 -#define SPI_FREQUENCY 60000000 -#define SPI_READ_FREQUENCY 16000000 -#define TFT_OFFSET_ROTATION 0 -#define SCREEN_ROTATE -#define TFT_DUMMY_READ_PIXELS 8 -#define SCREEN_TRANSITION_FRAMERATE 5 -#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness - -#define HAS_TOUCHSCREEN 1 +#if CROW_SELECT == 1 +#define WAKE_ON_TOUCH #define SCREEN_TOUCH_INT 47 -#define SCREEN_TOUCH_RST 48 -#define TOUCH_I2C_PORT 0 -#define TOUCH_SLAVE_ADDRESS 0x38 // FT5x06 +#define USE_POWERSAVE +#define SLEEP_TIME 180 #endif -#if TFT_HEIGHT == 480 && not defined(HAS_TFT) // 3.5 TFT -// ILI9488 TFT LCD -#define ILI9488_CS 40 -#define ILI9488_RS 41 // DC -#define ILI9488_SDA 39 // MOSI -#define ILI9488_SCK 42 -#define ILI9488_RESET -1 -#define ILI9488_MISO 38 -#define ILI9488_BUSY -1 -#define ILI9488_BL 38 -#define ILI9488_SPI_HOST SPI2_HOST -#define TFT_BL 38 -#define SPI_FREQUENCY 40000000 -#define SPI_READ_FREQUENCY 16000000 -#define TFT_OFFSET_ROTATION 0 -#define SCREEN_ROTATE -#define TFT_DUMMY_READ_PIXELS 8 -#define SCREEN_TRANSITION_FRAMERATE 5 -#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness - -#define HAS_TOUCHSCREEN 1 -#define SCREEN_TOUCH_INT 47 -#define SCREEN_TOUCH_RST 48 -#define TOUCH_I2C_PORT 0 -#define TOUCH_SLAVE_ADDRESS 0x5D // GT911 -#endif - -#ifdef CROW_SELECT -#define ST72xx_DE 42 -#define ST72xx_VSYNC 41 -#define ST72xx_HSYNC 40 -#define ST72xx_PCLK 39 -#define ST72xx_R0 7 -#define ST72xx_R1 17 -#define ST72xx_R2 18 -#define ST72xx_R3 3 -#define ST72xx_R4 46 -#define ST72xx_G0 9 -#define ST72xx_G1 10 -#define ST72xx_G2 11 -#define ST72xx_G3 12 -#define ST72xx_G4 13 -#define ST72xx_G5 14 -#define ST72xx_B0 21 -#define ST72xx_B1 47 -#define ST72xx_B2 48 -#define ST72xx_B3 45 -#define ST72xx_B4 38 - -#define HAS_TOUCHSCREEN 1 -#define TOUCH_I2C_PORT 0 -#define TOUCH_SLAVE_ADDRESS 0x5D // GT911 -#endif - -#if defined(CROW_SELECT) && CROW_SELECT == 1 // 4.3 TFT 800x480 -#define ST7265_HSYNC_POLARITY 0 -#define ST7265_HSYNC_FRONT_PORCH 24 -#define ST7265_HSYNC_PULSE_WIDTH 8 -#define ST7265_HSYNC_BACK_PORCH 24 -#define ST7265_VSYNC_POLARITY 1 -#define ST7265_VSYNC_FRONT_PORCH 24 -#define ST7265_VSYNC_PULSE_WIDTH 8 -#define ST7265_VSYNC_BACK_PORCH 24 -#define ST7265_PCLK_ACTIVE_NEG 1 -#endif - -#if defined(CROW_SELECT) && CROW_SELECT == 2 // 5.0 TFT 800x480 -#define ST7262_HSYNC_POLARITY 0 -#define ST7262_HSYNC_FRONT_PORCH 8 -#define ST7262_HSYNC_PULSE_WIDTH 4 -#define ST7262_HSYNC_BACK_PORCH 8 -#define ST7262_VSYNC_POLARITY 0 -#define ST7262_VSYNC_FRONT_PORCH 8 -#define ST7262_VSYNC_PULSE_WIDTH 4 -#define ST7262_VSYNC_BACK_PORCH 8 -#define ST7262_PCLK_ACTIVE_NEG 0 -#endif - -#if defined(CROW_SELECT) && CROW_SELECT == 3 // 7.0 TFT 800x480 -#define SC7277_HSYNC_POLARITY 0 -#define SC7277_HSYNC_FRONT_PORCH 8 -#define SC7277_HSYNC_PULSE_WIDTH 4 -#define SC7277_HSYNC_BACK_PORCH 8 -#define SC7277_VSYNC_POLARITY 0 -#define SC7277_VSYNC_FRONT_PORCH 8 -#define SC7277_VSYNC_PULSE_WIDTH 4 -#define SC7277_VSYNC_BACK_PORCH 8 -#define SC7277_PCLK_ACTIVE_NEG 0 -#endif - -#if TFT_HEIGHT == 320 // 2.4-2.8 have I2S audio +#if CROW_SELECT == 1 // dac / amp // #define HAS_I2S // didn't get I2S sound working #define PIN_BUZZER 8 // using pwm buzzer instead (nobody will notice, lol) @@ -131,10 +21,16 @@ #endif // GPS via UART1 connector -#define HAS_GPS 1 #define GPS_DEFAULT_NOT_PRESENT 1 +#define HAS_GPS 1 +#if CROW_SELECT == 1 #define GPS_RX_PIN 18 #define GPS_TX_PIN 17 +#else +// GPIOs shared with LoRa or MIC module +#define GPS_RX_PIN 19 +#define GPS_TX_PIN 20 +#endif // Extension Slot Layout, viewed from above (2.4-3.5) // DIO1/IO1 o o IO2/NRESET @@ -158,9 +54,11 @@ // LoRa #define USE_SX1262 -#define LORA_CS 0 // GND -#if TFT_HEIGHT == 320 || TFT_HEIGHT == 480 // 2.4 - 3.5 TFT +#if CROW_SELECT == 1 +// 2.4", 2.8, 3.5""" +#define HW_SPI1_DEVICE +#define LORA_CS 0 #define LORA_SCK 10 #define LORA_MISO 9 #define LORA_MOSI 3 @@ -173,6 +71,8 @@ #define SENSOR_POWER_CTRL_PIN 45 #define SENSOR_POWER_ON LOW #else +// 4.3", 5.0", 7.0" +#define LORA_CS 0 #define LORA_SCK 5 #define LORA_MISO 4 #define LORA_MOSI 6 @@ -182,14 +82,9 @@ #define LORA_DIO2 2 // SX1262 BUSY #endif -#define HW_SPI1_DEVICE #define SX126X_CS LORA_CS #define SX126X_DIO1 LORA_DIO1 #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_DIO2_AS_RF_SWITCH - #define SX126X_DIO3_TCXO_VOLTAGE 3.3 - -#define USE_VIRTUAL_KEYBOARD 1 -#define DISPLAY_CLOCK_FRAME 1 \ No newline at end of file diff --git a/variants/mesh-tab/variant.h b/variants/mesh-tab/variant.h index 533c931bc..63ef17d85 100644 --- a/variants/mesh-tab/variant.h +++ b/variants/mesh-tab/variant.h @@ -3,7 +3,8 @@ #define HAS_TOUCHSCREEN 1 -#define SLEEP_TIME 120 +#define USE_POWERSAVE +#define SLEEP_TIME 180 // Analog pins #define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage diff --git a/variants/rak_wismeshtap/variant.h b/variants/rak_wismeshtap/variant.h index c21a11ac1..1980dc4a1 100644 --- a/variants/rak_wismeshtap/variant.h +++ b/variants/rak_wismeshtap/variant.h @@ -305,6 +305,9 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT WB_IO6 +#define USE_POWERSAVE +#define SLEEP_TIME 120 + #define CANNED_MESSAGE_MODULE_ENABLE 1 #define USE_VIRTUAL_KEYBOARD 1 /*---------------------------------------------------------------------------- diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 5b2c13a91..a21c786b3 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -31,6 +31,7 @@ #define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x5D // GT911 +#define USE_POWERSAVE #define SLEEP_TIME 120 #ifndef HAS_TFT diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 5a6aebfa2..578c23c0a 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -24,7 +24,9 @@ #define SCREEN_TOUCH_USE_I2C1 #define TOUCH_I2C_PORT 1 #define TOUCH_SLAVE_ADDRESS 0x38 +#define WAKE_ON_TOUCH +#define USE_POWERSAVE #define SLEEP_TIME 180 #define I2C_SDA1 39 // Used for capacitive touch diff --git a/variants/unphone/variant.h b/variants/unphone/variant.h index 7b39a5aa5..eaf142721 100644 --- a/variants/unphone/variant.h +++ b/variants/unphone/variant.h @@ -41,6 +41,9 @@ #define USE_XPT2046 1 #define TOUCH_CS 38 +#define USE_POWERSAVE +#define SLEEP_TIME 180 + #define HAS_GPS \ 0 // the unphone doesn't have a gps module by default (though // GPS featherwing -- https://www.adafruit.com/product/3133 From a7415791a56cca7816c52ee7cda74e532dcccd11 Mon Sep 17 00:00:00 2001 From: Chris Vogel Date: Tue, 13 May 2025 15:10:57 +0200 Subject: [PATCH 40/60] device-install.sh: detect t-eth-elite as s3 device (#6767) device-install.sh: detect t-eth-elite as s3 device fixes https://github.com/meshtastic/firmware/issues/6754#issuecomment-2857468902 Thanks @mverch67! --- bin/device-install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/device-install.sh b/bin/device-install.sh index a43ccbdb4..7fa5ffdbb 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -43,6 +43,16 @@ S3_VARIANTS=( "wireless-tracker" "station-g2" "unphone" + "t-eth-elite" + "mesh-tab" + "dreamcatcher" + "ESP32-S3-Pico" + "seeed-sensecap-indicator" + "heltec_capsule_sensor_v3" + "vision-master" + "icarus" + "tracksenger" + "elecrow-adv" ) # Determine the correct esptool command to use From 0a8bd1e4bee9b24f9a41203f9490fe1ac4390f3f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 05:33:51 -0500 Subject: [PATCH 41/60] Add contact admin message (for QR code) (#6806) --- src/mesh/NodeDB.cpp | 20 ++++++++++++++++++++ src/mesh/NodeDB.h | 2 ++ src/modules/AdminModule.cpp | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index b64cb0fe1..0495fa7aa 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1455,6 +1455,26 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS notifyObservers(true); // Force an update whether or not our node counts have changed } +/** + * Update the node database with a new contact + */ +void NodeDB::addFromContact(meshtastic_SharedContact contact) +{ + meshtastic_NodeInfoLite *info = getOrCreateMeshNode(contact.node_num); + if (!info) { + return; + } + info->num = contact.node_num; + info->last_heard = getValidTime(RTCQualityNTP); + info->has_user = true; + info->user = TypeConversions::ConvertToUserLite(contact.user); + info->is_favorite = true; + updateGUIforNode = info; + powerFSM.trigger(EVENT_NODEDB_UPDATED); + notifyObservers(true); // Force an update whether or not our node counts have changed + saveNodeDatabaseToDisk(); +} + /** Update user info and channel for this node based on received user data */ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelIndex) diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 291c3804b..4dbda6a9f 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -110,6 +110,8 @@ class NodeDB /// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw void updateFrom(const meshtastic_MeshPacket &p); + void addFromContact(const meshtastic_SharedContact); + /** Update position info for this node based on received position data */ void updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src = RX_SRC_RADIO); diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 0e1e1555b..cbf82ae73 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -286,6 +286,11 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta nodeDB->removeNodeByNum(r->remove_by_nodenum); break; } + case meshtastic_AdminMessage_add_contact_tag: { + LOG_INFO("Client received add_contact command"); + nodeDB->addFromContact(r->add_contact); + break; + } case meshtastic_AdminMessage_set_favorite_node_tag: { LOG_INFO("Client received set_favorite_node command"); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); From d9ad2322e8898ff5d9454b2ab3ef1f23a2d32005 Mon Sep 17 00:00:00 2001 From: Richard Zhang <129845637+Richard3366@users.noreply.github.com> Date: Wed, 14 May 2025 19:29:05 +0800 Subject: [PATCH 42/60] Fixes BUG #6243 Heltec Tracker (#6781) * fix wireless tracker screen issues * fix SHTC3 BUG * Remove the 32K crystal oscillator option for the Wireless Paper and Vision Master series. * Correct spelling errors * Update src/graphics/Screen.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Ben Meadors Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/graphics/Screen.cpp | 10 ++++++++++ src/modules/Telemetry/Sensor/SHTC3Sensor.cpp | 2 +- variants/heltec_vision_master_e213/variant.h | 1 - variants/heltec_vision_master_e290/variant.h | 1 - variants/heltec_vision_master_t190/variant.h | 1 - variants/heltec_wireless_paper/variant.h | 1 - variants/heltec_wireless_paper_v1/variant.h | 1 - 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 1ee0c0fdd..4f73c79be 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1612,6 +1612,9 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) #ifdef T_WATCH_S3 PMU->enablePowerOutput(XPOWERS_ALDO2); #endif +#ifdef HELTEC_TRACKER_V1_X + uint8_t tft_vext_enabled=digitalRead(VEXT_ENABLE); +#endif #if !ARCH_PORTDUINO dispdev->displayOn(); #endif @@ -1622,6 +1625,13 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) #endif dispdev->displayOn(); +#ifdef HELTEC_TRACKER_V1_X + // If the TFT VEXT power is not enabled, initialize the UI. + if(!tft_vext_enabled) + { + ui->init(); + } +#endif #ifdef USE_ST7789 pinMode(VTFT_CTRL, OUTPUT); digitalWrite(VTFT_CTRL, LOW); diff --git a/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp b/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp index dbebec9d3..e9c4d2a0b 100644 --- a/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp +++ b/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp @@ -15,7 +15,7 @@ int32_t SHTC3Sensor::runOnce() if (!hasSensor()) { return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; } - status = shtc3.begin(); + status = shtc3.begin(nodeTelemetrySensorsMap[sensorType].second); return initI2CSensor(); } diff --git a/variants/heltec_vision_master_e213/variant.h b/variants/heltec_vision_master_e213/variant.h index 49b8e91f5..ebb2c341f 100644 --- a/variants/heltec_vision_master_e213/variant.h +++ b/variants/heltec_vision_master_e213/variant.h @@ -31,7 +31,6 @@ #define ADC_CHANNEL ADC1_GPIO7_CHANNEL #define ADC_MULTIPLIER 4.9 * 1.03 #define ADC_ATTENUATION ADC_ATTEN_DB_2_5 -#define HAS_32768HZ // LoRa #define USE_SX1262 diff --git a/variants/heltec_vision_master_e290/variant.h b/variants/heltec_vision_master_e290/variant.h index 9d6041539..02986d26b 100644 --- a/variants/heltec_vision_master_e290/variant.h +++ b/variants/heltec_vision_master_e290/variant.h @@ -30,7 +30,6 @@ #define ADC_CHANNEL ADC1_GPIO7_CHANNEL #define ADC_MULTIPLIER 4.9 * 1.03 #define ADC_ATTENUATION ADC_ATTEN_DB_2_5 -#define HAS_32768HZ // LoRa #define USE_SX1262 diff --git a/variants/heltec_vision_master_t190/variant.h b/variants/heltec_vision_master_t190/variant.h index 1da3f9971..788466919 100644 --- a/variants/heltec_vision_master_t190/variant.h +++ b/variants/heltec_vision_master_t190/variant.h @@ -47,7 +47,6 @@ #define ADC_CHANNEL ADC1_GPIO6_CHANNEL #define ADC_MULTIPLIER 4.9 * 1.03 // Voltage divider is roughly 1:1 #define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // Voltage divider output is quite high -#define HAS_32768HZ // LoRa #define USE_SX1262 diff --git a/variants/heltec_wireless_paper/variant.h b/variants/heltec_wireless_paper/variant.h index 0385945e6..bbfd54ada 100644 --- a/variants/heltec_wireless_paper/variant.h +++ b/variants/heltec_wireless_paper/variant.h @@ -28,7 +28,6 @@ #define ADC_MULTIPLIER 2 // Voltage divider is roughly 1:1 #define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 #define ADC_ATTENUATION ADC_ATTEN_DB_12 // Voltage divider output is quite high -#define HAS_32768HZ #define ADC_CTRL_ENABLED LOW #define NO_EXT_GPIO 1 diff --git a/variants/heltec_wireless_paper_v1/variant.h b/variants/heltec_wireless_paper_v1/variant.h index fe8f391df..4505395c9 100644 --- a/variants/heltec_wireless_paper_v1/variant.h +++ b/variants/heltec_wireless_paper_v1/variant.h @@ -29,7 +29,6 @@ #define ADC_MULTIPLIER 2 // Voltage divider is roughly 1:1 #define BAT_MEASURE_ADC_UNIT 2 // Use ADC2 #define ADC_ATTENUATION ADC_ATTEN_DB_12 // Voltage divider output is quite high -#define HAS_32768HZ #define ADC_CTRL_ENABLED LOW #define NO_EXT_GPIO 1 From 94af3bd1ab8eb94d2aaa9be3e510b591768b0623 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 06:31:18 -0500 Subject: [PATCH 43/60] Formatting --- src/graphics/Screen.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 4f73c79be..61999ee79 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1613,7 +1613,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) PMU->enablePowerOutput(XPOWERS_ALDO2); #endif #ifdef HELTEC_TRACKER_V1_X - uint8_t tft_vext_enabled=digitalRead(VEXT_ENABLE); + uint8_t tft_vext_enabled = digitalRead(VEXT_ENABLE); #endif #if !ARCH_PORTDUINO dispdev->displayOn(); @@ -1627,9 +1627,8 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) dispdev->displayOn(); #ifdef HELTEC_TRACKER_V1_X // If the TFT VEXT power is not enabled, initialize the UI. - if(!tft_vext_enabled) - { - ui->init(); + if (!tft_vext_enabled) { + ui->init(); } #endif #ifdef USE_ST7789 From b1955c34aa80dd7e2ed9e08a7e17b1bd532f793b Mon Sep 17 00:00:00 2001 From: rcarteraz Date: Wed, 14 May 2025 04:32:24 -0700 Subject: [PATCH 44/60] Update Seeed Solar Node (#6763) * Update Seeed Solar Node * Update Seeed Solar Node * updates * updates * updates --------- Co-authored-by: Ben Meadors --- boards/{Seeed_Solar_Node.json => seeed_solar_node.json} | 4 ++-- .../{Seeed_Solar_Node => seeed_solar_node}/platformio.ini | 8 ++++---- .../{Seeed_Solar_Node => seeed_solar_node}/variant.cpp | 0 variants/{Seeed_Solar_Node => seeed_solar_node}/variant.h | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename boards/{Seeed_Solar_Node.json => seeed_solar_node.json} (94%) rename variants/{Seeed_Solar_Node => seeed_solar_node}/platformio.ini (76%) rename variants/{Seeed_Solar_Node => seeed_solar_node}/variant.cpp (100%) rename variants/{Seeed_Solar_Node => seeed_solar_node}/variant.h (100%) diff --git a/boards/Seeed_Solar_Node.json b/boards/seeed_solar_node.json similarity index 94% rename from boards/Seeed_Solar_Node.json rename to boards/seeed_solar_node.json index e1b502cfa..e77fbd077 100644 --- a/boards/Seeed_Solar_Node.json +++ b/boards/seeed_solar_node.json @@ -10,7 +10,7 @@ "hwids": [["0x2886", "0x0059"]], "usb_product": "XIAO-BOOT", "mcu": "nrf52840", - "variant": "Seeed_Solar_Node", + "variant": "seeed_solar_node", "bsp": { "name": "adafruit" }, @@ -31,7 +31,7 @@ "openocd_target": "nrf52840-mdk-rs" }, "frameworks": ["arduino"], - "name": "Seeed_Solar_Node", + "name": "seeed_solar_node", "upload": { "maximum_ram_size": 248832, "maximum_size": 815104, diff --git a/variants/Seeed_Solar_Node/platformio.ini b/variants/seeed_solar_node/platformio.ini similarity index 76% rename from variants/Seeed_Solar_Node/platformio.ini rename to variants/seeed_solar_node/platformio.ini index 5ee0a5e8f..eb91a435f 100644 --- a/variants/Seeed_Solar_Node/platformio.ini +++ b/variants/seeed_solar_node/platformio.ini @@ -1,13 +1,13 @@ -[env:Seeed_Solar_Node] -board = Seeed_Solar_Node +[env:seeed_solar_node] +board = seeed_solar_node extends = nrf52840_base ;board_level = extra build_flags = ${nrf52840_base.build_flags} - -I $PROJECT_DIR/variants/Seeed_Solar_Node + -I $PROJECT_DIR/variants/seeed_solar_node -D SEEED_SOLAR_NODE -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/Seeed_Solar_Node> +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_solar_node> lib_deps = ${nrf52840_base.lib_deps} debug_tool = jlink diff --git a/variants/Seeed_Solar_Node/variant.cpp b/variants/seeed_solar_node/variant.cpp similarity index 100% rename from variants/Seeed_Solar_Node/variant.cpp rename to variants/seeed_solar_node/variant.cpp diff --git a/variants/Seeed_Solar_Node/variant.h b/variants/seeed_solar_node/variant.h similarity index 100% rename from variants/Seeed_Solar_Node/variant.h rename to variants/seeed_solar_node/variant.h From feafd2bc0c94a6e85077543c20a5a626e1e7eea6 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Wed, 14 May 2025 23:33:51 +1200 Subject: [PATCH 45/60] Protect T-Echo's touch button against phantom presses in OLED UI (#6735) * Guard T-Echo touch button during LoRa TX * Guard for T-Echo only --------- Co-authored-by: Ben Meadors --- src/ButtonThread.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 352885dbe..8db52c074 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -300,14 +300,23 @@ int32_t ButtonThread::runOnce() #ifdef BUTTON_PIN_TOUCH case BUTTON_EVENT_TOUCH_LONG_PRESSED: { LOG_BUTTON("Touch press!"); - if (screen) { - // Wake if asleep - if (powerFSM.getState() == &stateDARK) - powerFSM.trigger(EVENT_PRESS); + // Ignore if: no screen + if (!screen) + break; - // Update display (legacy behaviour) - screen->forceDisplay(); - } +#ifdef TTGO_T_ECHO + // Ignore if: TX in progress + // Uncommon T-Echo hardware bug, LoRa TX triggers touch button + if (!RadioLibInterface::instance || RadioLibInterface::instance->isSending()) + break; +#endif + + // Wake if asleep + if (powerFSM.getState() == &stateDARK) + powerFSM.trigger(EVENT_PRESS); + + // Update display (legacy behaviour) + screen->forceDisplay(); break; } #endif // BUTTON_PIN_TOUCH From f16402dec152df25c35c953186418321e8bb26bb Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 14 May 2025 14:39:46 -0400 Subject: [PATCH 46/60] MQTT userprefs (#6802) --- src/mesh/Channels.cpp | 2 +- src/mesh/Default.h | 2 ++ src/mesh/NodeDB.cpp | 30 +++++++++++++++++++++++++++++- src/mqtt/MQTT.cpp | 7 +++++++ src/mqtt/MQTT.h | 2 ++ userPrefs.jsonc | 7 +++++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 2ba3499f1..70e4127d8 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -347,7 +347,7 @@ bool Channels::anyMqttEnabled() { #if USERPREFS_EVENT_MODE && !MESHTASTIC_EXCLUDE_MQTT // Don't publish messages on the public MQTT broker if we are in event mode - if (mqtt && mqtt->isUsingDefaultServer()) { + if (mqtt && mqtt->isUsingDefaultServer() && mqtt->isUsingDefaultRootTopic()) { return false; } #endif diff --git a/src/mesh/Default.h b/src/mesh/Default.h index 0daccbb6f..bc2aa785f 100644 --- a/src/mesh/Default.h +++ b/src/mesh/Default.h @@ -26,6 +26,8 @@ #define default_mqtt_username "meshdev" #define default_mqtt_password "large4cats" #define default_mqtt_root "msh" +#define default_mqtt_encryption_enabled true +#define default_mqtt_tls_enabled false #define IF_ROUTER(routerVal, normalVal) \ ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal)) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 0495fa7aa..f22f7bf91 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -761,11 +761,39 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.has_canned_message = true; +#if USERPREFS_MQTT_ENABLED && !MESHTASTIC_EXCLUDE_MQTT + moduleConfig.mqtt.enabled = true; +#endif +#ifdef USERPREFS_MQTT_ADDRESS + strncpy(moduleConfig.mqtt.address, USERPREFS_MQTT_ADDRESS, sizeof(moduleConfig.mqtt.address)); +#else strncpy(moduleConfig.mqtt.address, default_mqtt_address, sizeof(moduleConfig.mqtt.address)); +#endif +#ifdef USERPREFS_MQTT_USERNAME + strncpy(moduleConfig.mqtt.username, USERPREFS_MQTT_USERNAME, sizeof(moduleConfig.mqtt.username)); +#else strncpy(moduleConfig.mqtt.username, default_mqtt_username, sizeof(moduleConfig.mqtt.username)); +#endif +#ifdef USERPREFS_MQTT_PASSWORD + strncpy(moduleConfig.mqtt.password, USERPREFS_MQTT_PASSWORD, sizeof(moduleConfig.mqtt.password)); +#else strncpy(moduleConfig.mqtt.password, default_mqtt_password, sizeof(moduleConfig.mqtt.password)); +#endif +#ifdef USERPREFS_MQTT_ROOT_TOPIC + strncpy(moduleConfig.mqtt.root, USERPREFS_MQTT_ROOT_TOPIC, sizeof(moduleConfig.mqtt.root)); +#else strncpy(moduleConfig.mqtt.root, default_mqtt_root, sizeof(moduleConfig.mqtt.root)); - moduleConfig.mqtt.encryption_enabled = true; +#endif +#ifdef USERPREFS_MQTT_ENCRYPTION_ENABLED + moduleConfig.mqtt.encryption_enabled = USERPREFS_MQTT_ENCRYPTION_ENABLED; +#else + moduleConfig.mqtt.encryption_enabled = default_mqtt_encryption_enabled; +#endif +#ifdef USERPREFS_MQTT_TLS_ENABLED + moduleConfig.mqtt.tls_enabled = USERPREFS_MQTT_TLS_ENABLED; +#else + moduleConfig.mqtt.tls_enabled = default_mqtt_tls_enabled; +#endif moduleConfig.has_neighbor_info = true; moduleConfig.neighbor_info.enabled = false; diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index fb92789ee..3776f59f5 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -256,6 +256,11 @@ bool isDefaultServer(const String &host) return host.length() == 0 || host == default_mqtt_address; } +bool isDefaultRootTopic(const String &root) +{ + return root.length() == 0 || root == default_mqtt_root; +} + struct PubSubConfig { explicit PubSubConfig(const meshtastic_ModuleConfig_MQTTConfig &config) { @@ -387,10 +392,12 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) cryptTopic = moduleConfig.mqtt.root + cryptTopic; jsonTopic = moduleConfig.mqtt.root + jsonTopic; mapTopic = moduleConfig.mqtt.root + mapTopic; + isConfiguredForDefaultRootTopic = isDefaultRootTopic(moduleConfig.mqtt.root); } else { cryptTopic = "msh" + cryptTopic; jsonTopic = "msh" + jsonTopic; mapTopic = "msh" + mapTopic; + isConfiguredForDefaultRootTopic = true; } if (moduleConfig.mqtt.map_reporting_enabled && moduleConfig.mqtt.has_map_report_settings) { diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 0c260dc9c..2b11f479d 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -58,6 +58,7 @@ class MQTT : private concurrency::OSThread void start() { setIntervalFromNow(0); }; bool isUsingDefaultServer() { return isConfiguredForDefaultServer; } + bool isUsingDefaultRootTopic() { return isConfiguredForDefaultRootTopic; } /// Validate the meshtastic_ModuleConfig_MQTTConfig. static bool isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config) { return isValidConfig(config, nullptr); } @@ -71,6 +72,7 @@ class MQTT : private concurrency::OSThread int reconnectCount = 0; bool isConfiguredForDefaultServer = true; + bool isConfiguredForDefaultRootTopic = true; virtual int32_t runOnce() override; diff --git a/userPrefs.jsonc b/userPrefs.jsonc index 06c4a7eec..a349a5700 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -44,5 +44,12 @@ // "USERPREFS_NETWORK_WIFI_ENABLED": "true", // "USERPREFS_NETWORK_WIFI_SSID": "wifi_ssid", // "USERPREFS_NETWORK_WIFI_PSK": "wifi_psk", + // "USERPREFS_MQTT_ENABLED": "1", + // "USERPREFS_MQTT_ADDRESS": "'mqtt.meshtastic.org'", + // "USERPREFS_MQTT_USERNAME": "meshdev", + // "USERPREFS_MQTT_PASSWORD": "large4cats", + // "USERPREFS_MQTT_ENCRYPTION_ENABLED": "true", + // "USERPREFS_MQTT_TLS_ENABLED": "false", + // "USERPREFS_MQTT_ROOT_TOPIC": "event/REPLACEME", "USERPREFS_TZ_STRING": "tzplaceholder " } From bc313da064abee20474a8e078d865ffd18658916 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 May 2025 13:48:14 -0500 Subject: [PATCH 47/60] [create-pull-request] automated change (#6810) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.h | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 19 ++++++++++++------- src/mesh/generated/meshtastic/mesh.pb.h | 15 ++++++++++----- src/mesh/generated/meshtastic/telemetry.pb.h | 8 +++++--- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/protobufs b/protobufs index 816595c8b..8cb3e62a0 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 816595c8bbdfc3b4388e11348ccd043294d58705 +Subproject commit 8cb3e62a0d35d470e3d5d9950c0f1d85ccb35b22 diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 09499b075..0a46e6275 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -446,7 +446,7 @@ extern const pb_msgdesc_t meshtastic_SharedContact_msg; #define meshtastic_AdminMessage_size 511 #define meshtastic_HamParameters_size 31 #define meshtastic_NodeRemoteHardwarePinsResponse_size 496 -#define meshtastic_SharedContact_size 121 +#define meshtastic_SharedContact_size 123 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 83563a9fc..5e92cacd0 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -58,6 +58,9 @@ typedef struct _meshtastic_UserLite { /* The public key of the user's device. This is sent out to other nodes on the mesh to allow them to compute a shared secret key. */ meshtastic_UserLite_public_key_t public_key; + /* Whether or not the node can be messaged */ + bool has_is_unmessagable; + bool is_unmessagable; } meshtastic_UserLite; typedef struct _meshtastic_NodeInfoLite { @@ -183,14 +186,14 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} -#define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} +#define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}, false, 0} #define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0} #define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}} #define meshtastic_NodeDatabase_init_default {0, {0}} #define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0} #define meshtastic_BackupPreferences_init_default {0, 0, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default, false, meshtastic_ChannelFile_init_default, false, meshtastic_User_init_default} #define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} -#define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} +#define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}, false, 0} #define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0} #define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}} #define meshtastic_NodeDatabase_init_zero {0, {0}} @@ -210,6 +213,7 @@ extern "C" { #define meshtastic_UserLite_is_licensed_tag 5 #define meshtastic_UserLite_role_tag 6 #define meshtastic_UserLite_public_key_tag 7 +#define meshtastic_UserLite_is_unmessagable_tag 9 #define meshtastic_NodeInfoLite_num_tag 1 #define meshtastic_NodeInfoLite_user_tag 2 #define meshtastic_NodeInfoLite_position_tag 3 @@ -259,7 +263,8 @@ X(a, STATIC, SINGULAR, STRING, short_name, 3) \ X(a, STATIC, SINGULAR, UENUM, hw_model, 4) \ X(a, STATIC, SINGULAR, BOOL, is_licensed, 5) \ X(a, STATIC, SINGULAR, UENUM, role, 6) \ -X(a, STATIC, SINGULAR, BYTES, public_key, 7) +X(a, STATIC, SINGULAR, BYTES, public_key, 7) \ +X(a, STATIC, OPTIONAL, BOOL, is_unmessagable, 9) #define meshtastic_UserLite_CALLBACK NULL #define meshtastic_UserLite_DEFAULT NULL @@ -350,12 +355,12 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_NodeDatabase_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size -#define meshtastic_BackupPreferences_size 2263 +#define meshtastic_BackupPreferences_size 2265 #define meshtastic_ChannelFile_size 718 -#define meshtastic_DeviceState_size 1720 -#define meshtastic_NodeInfoLite_size 188 +#define meshtastic_DeviceState_size 1722 +#define meshtastic_NodeInfoLite_size 190 #define meshtastic_PositionLite_size 28 -#define meshtastic_UserLite_size 96 +#define meshtastic_UserLite_size 98 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 6fa0b60b0..572a6f5d5 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -609,6 +609,9 @@ typedef struct _meshtastic_User { /* The public key of the user's device. This is sent out to other nodes on the mesh to allow them to compute a shared secret key. */ meshtastic_User_public_key_t public_key; + /* Whether or not the node can be messaged */ + bool has_is_unmessagable; + bool is_unmessagable; } meshtastic_User; /* A message used in a traceroute */ @@ -1204,7 +1207,7 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_Position_init_default {false, 0, false, 0, false, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, false, 0, false, 0, 0, 0, 0, 0, false, 0, false, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_User_init_default {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} +#define meshtastic_User_init_default {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}, false, 0} #define meshtastic_RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define meshtastic_Routing_init_default {0, {meshtastic_RouteDiscovery_init_default}} #define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} @@ -1229,7 +1232,7 @@ extern "C" { #define meshtastic_resend_chunks_init_default {{{NULL}, NULL}} #define meshtastic_ChunkedPayloadResponse_init_default {0, 0, {0}} #define meshtastic_Position_init_zero {false, 0, false, 0, false, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, false, 0, false, 0, 0, 0, 0, 0, false, 0, false, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_User_init_zero {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} +#define meshtastic_User_init_zero {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}, false, 0} #define meshtastic_RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}} #define meshtastic_Routing_init_zero {0, {meshtastic_RouteDiscovery_init_zero}} #define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0} @@ -1286,6 +1289,7 @@ extern "C" { #define meshtastic_User_is_licensed_tag 6 #define meshtastic_User_role_tag 7 #define meshtastic_User_public_key_tag 8 +#define meshtastic_User_is_unmessagable_tag 9 #define meshtastic_RouteDiscovery_route_tag 1 #define meshtastic_RouteDiscovery_snr_towards_tag 2 #define meshtastic_RouteDiscovery_route_back_tag 3 @@ -1457,7 +1461,8 @@ X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \ X(a, STATIC, SINGULAR, UENUM, hw_model, 5) \ X(a, STATIC, SINGULAR, BOOL, is_licensed, 6) \ X(a, STATIC, SINGULAR, UENUM, role, 7) \ -X(a, STATIC, SINGULAR, BYTES, public_key, 8) +X(a, STATIC, SINGULAR, BYTES, public_key, 8) \ +X(a, STATIC, OPTIONAL, BOOL, is_unmessagable, 9) #define meshtastic_User_CALLBACK NULL #define meshtastic_User_DEFAULT NULL @@ -1786,14 +1791,14 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; #define meshtastic_MyNodeInfo_size 77 #define meshtastic_NeighborInfo_size 258 #define meshtastic_Neighbor_size 22 -#define meshtastic_NodeInfo_size 319 +#define meshtastic_NodeInfo_size 321 #define meshtastic_NodeRemoteHardwarePin_size 29 #define meshtastic_Position_size 144 #define meshtastic_QueueStatus_size 23 #define meshtastic_RouteDiscovery_size 256 #define meshtastic_Routing_size 259 #define meshtastic_ToRadio_size 504 -#define meshtastic_User_size 113 +#define meshtastic_User_size 115 #define meshtastic_Waypoint_size 165 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index dcc511ea6..be3fa0907 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -87,7 +87,9 @@ typedef enum _meshtastic_TelemetrySensorType { /* Infineon DPS310 High accuracy pressure and temperature */ meshtastic_TelemetrySensorType_DPS310 = 36, /* RAKWireless RAK12035 Soil Moisture Sensor Module */ - meshtastic_TelemetrySensorType_RAK12035 = 37 + meshtastic_TelemetrySensorType_RAK12035 = 37, + /* MAX17261 lipo battery gauge */ + meshtastic_TelemetrySensorType_MAX17261 = 38 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -324,8 +326,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_RAK12035 -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_RAK12035+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_MAX17261 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_MAX17261+1)) From 1af4a0bdc9ab66081a6ccb5e1444e1d15b807083 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 May 2025 14:10:45 -0500 Subject: [PATCH 48/60] Upgrade trunk (#6797) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index ca38c978a..4aa5527be 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,13 +10,13 @@ lint: enabled: - renovate@40.0.6 - prettier@3.5.3 - - trufflehog@3.88.28 + - trufflehog@3.88.29 - yamllint@1.37.1 - bandit@1.8.3 - terrascan@1.19.9 - trivy@0.62.1 - taplo@0.9.3 - - ruff@0.11.8 + - ruff@0.11.9 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.5 @@ -28,7 +28,7 @@ lint: - shellcheck@0.10.0 - black@25.1.0 - git-diff-check - - gitleaks@8.25.1 + - gitleaks@8.26.0 - clang-format@16.0.3 ignore: - linters: [ALL] From a51a6b8c475cdd654dc3c12ccff33340be6709cd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 May 2025 14:41:37 -0500 Subject: [PATCH 49/60] [create-pull-request] automated change (#6812) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 2 +- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- src/mesh/generated/meshtastic/module_config.pb.h | 16 ++++++++++------ src/mesh/generated/meshtastic/mqtt.pb.h | 13 +++++++++---- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/protobufs b/protobufs index 8cb3e62a0..47ec99aa4 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 8cb3e62a0d35d470e3d5d9950c0f1d85ccb35b22 +Subproject commit 47ec99aa4c4a2e3fff71fd5170663f0848deb021 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 5e92cacd0..d29fb17a7 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -355,7 +355,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_NodeDatabase_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size -#define meshtastic_BackupPreferences_size 2265 +#define meshtastic_BackupPreferences_size 2267 #define meshtastic_ChannelFile_size 718 #define meshtastic_DeviceState_size 1722 #define meshtastic_NodeInfoLite_size 190 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index 6a59b8eb0..53d8d7d80 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -188,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size #define meshtastic_LocalConfig_size 743 -#define meshtastic_LocalModuleConfig_size 667 +#define meshtastic_LocalModuleConfig_size 669 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index dbf6ddb2e..e8ae48072 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -112,6 +112,8 @@ typedef struct _meshtastic_ModuleConfig_MapReportSettings { uint32_t publish_interval_secs; /* Bits of precision for the location sent (default of 32 is full precision). */ uint32_t position_precision; + /* Whether we have opted-in to report our location to the map */ + bool should_report_location; } meshtastic_ModuleConfig_MapReportSettings; /* MQTT Client Config */ @@ -505,7 +507,7 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}} #define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_default} -#define meshtastic_ModuleConfig_MapReportSettings_init_default {0, 0} +#define meshtastic_ModuleConfig_MapReportSettings_init_default {0, 0, 0} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}} #define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0, 0} #define meshtastic_ModuleConfig_DetectionSensorConfig_init_default {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0} @@ -521,7 +523,7 @@ extern "C" { #define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN} #define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}} #define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero} -#define meshtastic_ModuleConfig_MapReportSettings_init_zero {0, 0} +#define meshtastic_ModuleConfig_MapReportSettings_init_zero {0, 0, 0} #define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}} #define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0, 0} #define meshtastic_ModuleConfig_DetectionSensorConfig_init_zero {0, 0, 0, 0, "", 0, _meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_MIN, 0} @@ -539,6 +541,7 @@ extern "C" { /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_ModuleConfig_MapReportSettings_publish_interval_secs_tag 1 #define meshtastic_ModuleConfig_MapReportSettings_position_precision_tag 2 +#define meshtastic_ModuleConfig_MapReportSettings_should_report_location_tag 3 #define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1 #define meshtastic_ModuleConfig_MQTTConfig_address_tag 2 #define meshtastic_ModuleConfig_MQTTConfig_username_tag 3 @@ -702,7 +705,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, map_report_settings, 11) #define meshtastic_ModuleConfig_MapReportSettings_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, publish_interval_secs, 1) \ -X(a, STATIC, SINGULAR, UINT32, position_precision, 2) +X(a, STATIC, SINGULAR, UINT32, position_precision, 2) \ +X(a, STATIC, SINGULAR, BOOL, should_report_location, 3) #define meshtastic_ModuleConfig_MapReportSettings_CALLBACK NULL #define meshtastic_ModuleConfig_MapReportSettings_DEFAULT NULL @@ -890,8 +894,8 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg; #define meshtastic_ModuleConfig_CannedMessageConfig_size 49 #define meshtastic_ModuleConfig_DetectionSensorConfig_size 44 #define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42 -#define meshtastic_ModuleConfig_MQTTConfig_size 222 -#define meshtastic_ModuleConfig_MapReportSettings_size 12 +#define meshtastic_ModuleConfig_MQTTConfig_size 224 +#define meshtastic_ModuleConfig_MapReportSettings_size 14 #define meshtastic_ModuleConfig_NeighborInfoConfig_size 10 #define meshtastic_ModuleConfig_PaxcounterConfig_size 30 #define meshtastic_ModuleConfig_RangeTestConfig_size 10 @@ -899,7 +903,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg; #define meshtastic_ModuleConfig_SerialConfig_size 28 #define meshtastic_ModuleConfig_StoreForwardConfig_size 24 #define meshtastic_ModuleConfig_TelemetryConfig_size 46 -#define meshtastic_ModuleConfig_size 225 +#define meshtastic_ModuleConfig_size 227 #define meshtastic_RemoteHardwarePin_size 21 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/mqtt.pb.h b/src/mesh/generated/meshtastic/mqtt.pb.h index 1726bc470..c5b10f1f5 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.h +++ b/src/mesh/generated/meshtastic/mqtt.pb.h @@ -54,6 +54,9 @@ typedef struct _meshtastic_MapReport { uint32_t position_precision; /* Number of online nodes (heard in the last 2 hours) this node has in its list that were received locally (not via MQTT) */ uint16_t num_online_local_nodes; + /* User has opted in to share their location (map report) with the mqtt server + Controlled by map_report.should_report_location */ + bool has_opted_report_location; } meshtastic_MapReport; @@ -63,9 +66,9 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_ServiceEnvelope_init_default {NULL, NULL, NULL} -#define meshtastic_MapReport_init_default {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0} +#define meshtastic_MapReport_init_default {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_ServiceEnvelope_init_zero {NULL, NULL, NULL} -#define meshtastic_MapReport_init_zero {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0} +#define meshtastic_MapReport_init_zero {"", "", _meshtastic_Config_DeviceConfig_Role_MIN, _meshtastic_HardwareModel_MIN, "", _meshtastic_Config_LoRaConfig_RegionCode_MIN, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, 0, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_ServiceEnvelope_packet_tag 1 @@ -84,6 +87,7 @@ extern "C" { #define meshtastic_MapReport_altitude_tag 11 #define meshtastic_MapReport_position_precision_tag 12 #define meshtastic_MapReport_num_online_local_nodes_tag 13 +#define meshtastic_MapReport_has_opted_report_location_tag 14 /* Struct field encoding specification for nanopb */ #define meshtastic_ServiceEnvelope_FIELDLIST(X, a) \ @@ -107,7 +111,8 @@ X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 9) \ X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 10) \ X(a, STATIC, SINGULAR, INT32, altitude, 11) \ X(a, STATIC, SINGULAR, UINT32, position_precision, 12) \ -X(a, STATIC, SINGULAR, UINT32, num_online_local_nodes, 13) +X(a, STATIC, SINGULAR, UINT32, num_online_local_nodes, 13) \ +X(a, STATIC, SINGULAR, BOOL, has_opted_report_location, 14) #define meshtastic_MapReport_CALLBACK NULL #define meshtastic_MapReport_DEFAULT NULL @@ -121,7 +126,7 @@ extern const pb_msgdesc_t meshtastic_MapReport_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_ServiceEnvelope_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_MQTT_PB_H_MAX_SIZE meshtastic_MapReport_size -#define meshtastic_MapReport_size 108 +#define meshtastic_MapReport_size 110 #ifdef __cplusplus } /* extern "C" */ From fc64bea6982a1d6f31b39e4def84e28e26e93988 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 15:28:09 -0500 Subject: [PATCH 50/60] Unmessagable implementation and defaults (#6811) * Unmessagable implementation and defaults * Router and router late are unmessagable by default * Update src/modules/AdminModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/mesh/NodeDB.cpp | 16 ++++++++++++++++ src/modules/AdminModule.cpp | 10 +++++++++- src/modules/NodeInfoModule.cpp | 5 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index f22f7bf91..48d22c65d 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -819,10 +819,19 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role) initConfigIntervals(); initModuleConfigIntervals(); config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY; + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; + } else if (role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) { + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; } else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) { + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; config.display.screen_on_secs = 1; config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY; } else if (role == meshtastic_Config_DeviceConfig_Role_SENSOR) { + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; moduleConfig.telemetry.environment_measurement_enabled = true; moduleConfig.telemetry.environment_update_interval = 300; } else if (role == meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND) { @@ -837,7 +846,12 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role) (meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE | meshtastic_Config_PositionConfig_PositionFlags_SPEED | meshtastic_Config_PositionConfig_PositionFlags_HEADING | meshtastic_Config_PositionConfig_PositionFlags_DOP); moduleConfig.telemetry.device_update_interval = ONE_DAY; + } else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) { + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; } else if (role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) { + owner.has_is_unmessagable = true; + owner.is_unmessagable = true; config.device.node_info_broadcast_secs = ONE_DAY; config.position.position_broadcast_smart_enabled = true; config.position.position_broadcast_secs = 3 * 60; // Every 3 minutes @@ -970,6 +984,8 @@ void NodeDB::installDefaultDeviceState() #endif snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr)); + owner.has_is_unmessagable = true; + owner.is_unmessagable = false; } // We reserve a few nodenums for future use diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index cbf82ae73..0fac15b15 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -504,6 +504,12 @@ void AdminModule::handleSetOwner(const meshtastic_User &o) sendWarning(licensedModeMessage); } } + if (owner.has_is_unmessagable != o.has_is_unmessagable || + (o.has_is_unmessagable && owner.is_unmessagable != o.is_unmessagable)) { + changed = 1; + owner.has_is_unmessagable = o.has_is_unmessagable || o.has_is_unmessagable; + owner.is_unmessagable = o.is_unmessagable; + } if (changed) { // If nothing really changed, don't broadcast on the network or write to flash service->reloadOwner(!hasOpenEditTransaction); @@ -553,8 +559,10 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) sendWarning(warning); } // If we're setting router role for the first time, install its intervals - if (existingRole != c.payload_variant.device.role) + if (existingRole != c.payload_variant.device.role) { nodeDB->installRoleDefaults(c.payload_variant.device.role); + changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner + } if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) { LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d", min_node_info_broadcast_secs); config.device.node_info_broadcast_secs = min_node_info_broadcast_secs; diff --git a/src/modules/NodeInfoModule.cpp b/src/modules/NodeInfoModule.cpp index ce4a6bd06..5142f2db0 100644 --- a/src/modules/NodeInfoModule.cpp +++ b/src/modules/NodeInfoModule.cpp @@ -86,6 +86,11 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply() u.public_key.bytes[0] = 0; u.public_key.size = 0; } + // Coerce unmessagable for Repeater role + if (u.role == meshtastic_Config_DeviceConfig_Role_REPEATER) { + u.has_is_unmessagable = true; + u.is_unmessagable = true; + } LOG_INFO("Send owner %s/%s/%s", u.id, u.long_name, u.short_name); lastSentToMesh = millis(); From 7cffd9ba7083468816a63d3485c70e1a698dcda3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 15:31:28 -0500 Subject: [PATCH 51/60] Added new map report opt-in for compliance and limit map report (and default) to one hour (#6813) * Added new map report opt-in for compliance and limit map report (and default) to one hour * Trunk --- src/mesh/Default.h | 1 + src/mesh/NodeDB.cpp | 5 +++++ src/modules/AdminModule.cpp | 2 +- src/mqtt/MQTT.cpp | 4 +++- src/mqtt/MQTT.h | 4 ++-- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mesh/Default.h b/src/mesh/Default.h index bc2aa785f..208f992c8 100644 --- a/src/mesh/Default.h +++ b/src/mesh/Default.h @@ -21,6 +21,7 @@ #define default_neighbor_info_broadcast_secs 6 * 60 * 60 #define min_node_info_broadcast_secs 60 * 60 // No regular broadcasts of more than once an hour #define min_neighbor_info_broadcast_secs 4 * 60 * 60 +#define default_map_publish_interval_secs 60 * 60 #define default_mqtt_address "mqtt.meshtastic.org" #define default_mqtt_username "meshdev" diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 48d22c65d..4b1a6d64d 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -328,6 +328,11 @@ NodeDB::NodeDB() moduleConfig.telemetry.health_update_interval = Default::getConfiguredOrMinimumValue( moduleConfig.telemetry.health_update_interval, min_default_telemetry_interval_secs); } + if (moduleConfig.mqtt.has_map_report_settings && + moduleConfig.mqtt.map_report_settings.publish_interval_secs < default_map_publish_interval_secs) { + moduleConfig.mqtt.map_report_settings.publish_interval_secs = default_map_publish_interval_secs; + } + // Ensure that the neighbor info update interval is coerced to the minimum moduleConfig.neighbor_info.update_interval = Default::getConfiguredOrMinimumValue(moduleConfig.neighbor_info.update_interval, min_neighbor_info_broadcast_secs); diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 0fac15b15..3ff4fa74d 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -504,7 +504,7 @@ void AdminModule::handleSetOwner(const meshtastic_User &o) sendWarning(licensedModeMessage); } } - if (owner.has_is_unmessagable != o.has_is_unmessagable || + if (owner.has_is_unmessagable != o.has_is_unmessagable || (o.has_is_unmessagable && owner.is_unmessagable != o.is_unmessagable)) { changed = 1; owner.has_is_unmessagable = o.has_is_unmessagable || o.has_is_unmessagable; diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 3776f59f5..713077272 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -769,7 +769,8 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_Me void MQTT::perhapsReportToMap() { - if (!moduleConfig.mqtt.map_reporting_enabled || !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) + if (!moduleConfig.mqtt.map_reporting_enabled || !moduleConfig.mqtt.map_report_settings.should_report_location || + !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) return; if (Throttle::isWithinTimespanMs(last_report_to_map, map_publish_interval_msecs)) @@ -801,6 +802,7 @@ void MQTT::perhapsReportToMap() mapReport.region = config.lora.region; mapReport.modem_preset = config.lora.modem_preset; mapReport.has_default_channel = channels.hasDefaultChannel(); + mapReport.has_opted_report_location = true; // Set position with precision (same as in PositionModule) if (map_position_precision < 32 && map_position_precision > 0) { diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 2b11f479d..7d5715602 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -1,5 +1,6 @@ #pragma once +#include "Default.h" #include "configuration.h" #include "concurrency/OSThread.h" @@ -105,8 +106,7 @@ class MQTT : private concurrency::OSThread std::string mapTopic = "/2/map/"; // For protobuf-encoded MapReport messages // For map reporting (only applies when enabled) - const uint32_t default_map_position_precision = 14; // defaults to max. offset of ~1459m - const uint32_t default_map_publish_interval_secs = 60 * 15; // defaults to 15 minutes + const uint32_t default_map_position_precision = 14; // defaults to max. offset of ~1459m uint32_t last_report_to_map = 0; uint32_t map_position_precision = default_map_position_precision; uint32_t map_publish_interval_msecs = default_map_publish_interval_secs * 1000; From 3901ae8956d34130d436182224896aa0d27e890e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 16:44:32 -0500 Subject: [PATCH 52/60] Default --- test/test_mqtt/MQTT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index 50a98001a..feb9c7e83 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -308,8 +308,8 @@ const meshtastic_MeshPacket encrypted = { // Initialize mocks and configuration before running each test. void setUp(void) { - moduleConfig.mqtt = - meshtastic_ModuleConfig_MQTTConfig{.enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true}; + moduleConfig.mqtt = meshtastic_ModuleConfig_MQTTConfig{ + .enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true, .should_report_location = true}; channelFile.channels[0] = meshtastic_Channel{ .index = 0, .has_settings = true, From b63b73ab84562887338700c47c46eb6eec45827a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 17:16:46 -0500 Subject: [PATCH 53/60] Fix --- test/test_mqtt/MQTT.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index feb9c7e83..a297dc229 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -308,8 +308,10 @@ const meshtastic_MeshPacket encrypted = { // Initialize mocks and configuration before running each test. void setUp(void) { - moduleConfig.mqtt = meshtastic_ModuleConfig_MQTTConfig{ - .enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true, .should_report_location = true}; + moduleConfig.mqtt = + meshtastic_ModuleConfig_MQTTConfig{.enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true}; + mqtt.map_report_settings = meshtastic_ModuleConfig_MQTTConfig_MapReportSettings{ + .position_precision = 14, .publish_interval_secs = 0, .should_report_location = true}; channelFile.channels[0] = meshtastic_Channel{ .index = 0, .has_settings = true, From ed6de5095e9cf3f89c9ce25dafeeab837173d6fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 May 2025 17:54:21 -0500 Subject: [PATCH 54/60] [create-pull-request] automated change (#6815) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- .../generated/meshtastic/telemetry.pb.cpp | 3 + src/mesh/generated/meshtastic/telemetry.pb.h | 55 ++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/protobufs b/protobufs index 47ec99aa4..4eb0aebae 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 47ec99aa4c4a2e3fff71fd5170663f0848deb021 +Subproject commit 4eb0aebaef1304a5516b6fa864cb4c55daed9147 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.cpp b/src/mesh/generated/meshtastic/telemetry.pb.cpp index c79941fa5..b54cbb00e 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.cpp +++ b/src/mesh/generated/meshtastic/telemetry.pb.cpp @@ -24,6 +24,9 @@ PB_BIND(meshtastic_LocalStats, meshtastic_LocalStats, AUTO) PB_BIND(meshtastic_HealthMetrics, meshtastic_HealthMetrics, AUTO) +PB_BIND(meshtastic_HostMetrics, meshtastic_HostMetrics, AUTO) + + PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, AUTO) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index be3fa0907..1c5eb4843 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -290,6 +290,28 @@ typedef struct _meshtastic_HealthMetrics { float temperature; } meshtastic_HealthMetrics; +/* Linux host metrics */ +typedef struct _meshtastic_HostMetrics { + /* Host system uptime */ + uint32_t uptime_seconds; + /* Host system free memory */ + uint64_t freemem_bytes; + /* Host system disk space free for / */ + uint64_t diskfree1_bytes; + /* Secondary system disk space free */ + bool has_diskfree2_bytes; + uint64_t diskfree2_bytes; + /* Tertiary disk space free */ + bool has_diskfree3_bytes; + uint64_t diskfree3_bytes; + /* Host system one minute load in 1/100ths */ + uint16_t load1; + /* Host system five minute load in 1/100ths */ + uint16_t load5; + /* Host system fifteen minute load in 1/100ths */ + uint16_t load15; +} meshtastic_HostMetrics; + /* Types of Measurements the telemetry module is equipped to handle */ typedef struct _meshtastic_Telemetry { /* Seconds since 1970 - or 0 for unknown/unset */ @@ -308,6 +330,8 @@ typedef struct _meshtastic_Telemetry { meshtastic_LocalStats local_stats; /* Health telemetry metrics */ meshtastic_HealthMetrics health_metrics; + /* Linux host metrics */ + meshtastic_HostMetrics host_metrics; } variant; } meshtastic_Telemetry; @@ -338,6 +362,7 @@ extern "C" { + /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} @@ -345,6 +370,7 @@ extern "C" { #define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_HealthMetrics_init_default {false, 0, false, 0, false, 0} +#define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_Nau7802Config_init_default {0, 0} #define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0} @@ -353,6 +379,7 @@ extern "C" { #define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_HealthMetrics_init_zero {false, 0, false, 0, false, 0} +#define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} #define meshtastic_Nau7802Config_init_zero {0, 0} @@ -417,6 +444,14 @@ extern "C" { #define meshtastic_HealthMetrics_heart_bpm_tag 1 #define meshtastic_HealthMetrics_spO2_tag 2 #define meshtastic_HealthMetrics_temperature_tag 3 +#define meshtastic_HostMetrics_uptime_seconds_tag 1 +#define meshtastic_HostMetrics_freemem_bytes_tag 2 +#define meshtastic_HostMetrics_diskfree1_bytes_tag 3 +#define meshtastic_HostMetrics_diskfree2_bytes_tag 4 +#define meshtastic_HostMetrics_diskfree3_bytes_tag 5 +#define meshtastic_HostMetrics_load1_tag 6 +#define meshtastic_HostMetrics_load5_tag 7 +#define meshtastic_HostMetrics_load15_tag 8 #define meshtastic_Telemetry_time_tag 1 #define meshtastic_Telemetry_device_metrics_tag 2 #define meshtastic_Telemetry_environment_metrics_tag 3 @@ -424,6 +459,7 @@ extern "C" { #define meshtastic_Telemetry_power_metrics_tag 5 #define meshtastic_Telemetry_local_stats_tag 6 #define meshtastic_Telemetry_health_metrics_tag 7 +#define meshtastic_Telemetry_host_metrics_tag 8 #define meshtastic_Nau7802Config_zeroOffset_tag 1 #define meshtastic_Nau7802Config_calibrationFactor_tag 2 @@ -512,6 +548,18 @@ X(a, STATIC, OPTIONAL, FLOAT, temperature, 3) #define meshtastic_HealthMetrics_CALLBACK NULL #define meshtastic_HealthMetrics_DEFAULT NULL +#define meshtastic_HostMetrics_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, uptime_seconds, 1) \ +X(a, STATIC, SINGULAR, UINT64, freemem_bytes, 2) \ +X(a, STATIC, SINGULAR, UINT64, diskfree1_bytes, 3) \ +X(a, STATIC, OPTIONAL, UINT64, diskfree2_bytes, 4) \ +X(a, STATIC, OPTIONAL, UINT64, diskfree3_bytes, 5) \ +X(a, STATIC, SINGULAR, UINT32, load1, 6) \ +X(a, STATIC, SINGULAR, UINT32, load5, 7) \ +X(a, STATIC, SINGULAR, UINT32, load15, 8) +#define meshtastic_HostMetrics_CALLBACK NULL +#define meshtastic_HostMetrics_DEFAULT NULL + #define meshtastic_Telemetry_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, time, 1) \ X(a, STATIC, ONEOF, MESSAGE, (variant,device_metrics,variant.device_metrics), 2) \ @@ -519,7 +567,8 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,environment_metrics,variant.environm X(a, STATIC, ONEOF, MESSAGE, (variant,air_quality_metrics,variant.air_quality_metrics), 4) \ X(a, STATIC, ONEOF, MESSAGE, (variant,power_metrics,variant.power_metrics), 5) \ X(a, STATIC, ONEOF, MESSAGE, (variant,local_stats,variant.local_stats), 6) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,health_metrics,variant.health_metrics), 7) +X(a, STATIC, ONEOF, MESSAGE, (variant,health_metrics,variant.health_metrics), 7) \ +X(a, STATIC, ONEOF, MESSAGE, (variant,host_metrics,variant.host_metrics), 8) #define meshtastic_Telemetry_CALLBACK NULL #define meshtastic_Telemetry_DEFAULT NULL #define meshtastic_Telemetry_variant_device_metrics_MSGTYPE meshtastic_DeviceMetrics @@ -528,6 +577,7 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,health_metrics,variant.health_metric #define meshtastic_Telemetry_variant_power_metrics_MSGTYPE meshtastic_PowerMetrics #define meshtastic_Telemetry_variant_local_stats_MSGTYPE meshtastic_LocalStats #define meshtastic_Telemetry_variant_health_metrics_MSGTYPE meshtastic_HealthMetrics +#define meshtastic_Telemetry_variant_host_metrics_MSGTYPE meshtastic_HostMetrics #define meshtastic_Nau7802Config_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, INT32, zeroOffset, 1) \ @@ -541,6 +591,7 @@ extern const pb_msgdesc_t meshtastic_PowerMetrics_msg; extern const pb_msgdesc_t meshtastic_AirQualityMetrics_msg; extern const pb_msgdesc_t meshtastic_LocalStats_msg; extern const pb_msgdesc_t meshtastic_HealthMetrics_msg; +extern const pb_msgdesc_t meshtastic_HostMetrics_msg; extern const pb_msgdesc_t meshtastic_Telemetry_msg; extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; @@ -551,6 +602,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_AirQualityMetrics_fields &meshtastic_AirQualityMetrics_msg #define meshtastic_LocalStats_fields &meshtastic_LocalStats_msg #define meshtastic_HealthMetrics_fields &meshtastic_HealthMetrics_msg +#define meshtastic_HostMetrics_fields &meshtastic_HostMetrics_msg #define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg #define meshtastic_Nau7802Config_fields &meshtastic_Nau7802Config_msg @@ -560,6 +612,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_DeviceMetrics_size 27 #define meshtastic_EnvironmentMetrics_size 113 #define meshtastic_HealthMetrics_size 11 +#define meshtastic_HostMetrics_size 62 #define meshtastic_LocalStats_size 60 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 30 From 60d2cb35e026040013e98c102761def6498d48b9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 18:55:27 -0500 Subject: [PATCH 55/60] Namespace --- test/test_mqtt/MQTT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index a297dc229..3cd56cfb6 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -310,7 +310,7 @@ void setUp(void) { moduleConfig.mqtt = meshtastic_ModuleConfig_MQTTConfig{.enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true}; - mqtt.map_report_settings = meshtastic_ModuleConfig_MQTTConfig_MapReportSettings{ + mqtt.map_report_settings = meshtastic_ModuleConfig_MapReportSettings{ .position_precision = 14, .publish_interval_secs = 0, .should_report_location = true}; channelFile.channels[0] = meshtastic_Channel{ .index = 0, From ef9d0d7805a012cd48af90ff702ee7c082512628 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 14 May 2025 20:22:01 -0500 Subject: [PATCH 56/60] Go --- test/test_mqtt/MQTT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index 3cd56cfb6..c1f5da358 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -310,8 +310,8 @@ void setUp(void) { moduleConfig.mqtt = meshtastic_ModuleConfig_MQTTConfig{.enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true}; - mqtt.map_report_settings = meshtastic_ModuleConfig_MapReportSettings{ - .position_precision = 14, .publish_interval_secs = 0, .should_report_location = true}; + moduleConfig.mqtt.map_report_settings = meshtastic_ModuleConfig_MapReportSettings{ + .publish_interval_secs = 0, .position_precision = 14, .should_report_location = true}; channelFile.channels[0] = meshtastic_Channel{ .index = 0, .has_settings = true, From 6bba17d463b9cf114b1db9bb420ad1ea075bd974 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Thu, 15 May 2025 19:26:41 +1000 Subject: [PATCH 57/60] Add suppport for Quectel L80 (#6803) * Add suppport for Quectel L80 Another PMTK family chip, requires only a modification to the probe code. * Update support for L80 based on testing. --- src/gps/GPS.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index e234fdb4a..142241c43 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1250,11 +1250,10 @@ GnssModel_t GPS::probe(int serialSpeed) // Close all NMEA sentences, valid for MTK3333 and MTK3339 platforms _serial_gps->write("$PMTK514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2E\r\n"); delay(20); - std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, - {"PA1010D", "1010D", GNSS_MODEL_MTK_PA1010D}, - {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, - {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}, - {"L96", "Quectel-L96", GNSS_MODEL_MTK_L76B}}; + std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, {"PA1010D", "1010D", GNSS_MODEL_MTK_PA1010D}, + {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}, + {"L96", "Quectel-L96", GNSS_MODEL_MTK_L76B}, {"L80-R", "_3337_", GNSS_MODEL_MTK_L76B}, + {"L80", "_3339_", GNSS_MODEL_MTK_L76B}}; PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500); From c2d586216103192995d1059809ef213f38dc4592 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 06:40:07 -0500 Subject: [PATCH 58/60] automated bumps (#6820) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- bin/org.meshtastic.meshtasticd.metainfo.xml | 3 +++ debian/changelog | 7 +++++-- version.properties | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/org.meshtastic.meshtasticd.metainfo.xml b/bin/org.meshtastic.meshtasticd.metainfo.xml index b98b54dd4..1a7ad284d 100644 --- a/bin/org.meshtastic.meshtasticd.metainfo.xml +++ b/bin/org.meshtastic.meshtasticd.metainfo.xml @@ -87,6 +87,9 @@ + + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.9 + https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.8 diff --git a/debian/changelog b/debian/changelog index 8fce06c14..ae27bc3e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -meshtasticd (2.6.8.0) UNRELEASED; urgency=medium +meshtasticd (2.6.9.0) UNRELEASED; urgency=medium [ Austin Lane ] * Initial packaging @@ -10,4 +10,7 @@ meshtasticd (2.6.8.0) UNRELEASED; urgency=medium [ ] * GitHub Actions Automatic version bump - -- Tue, 06 May 2025 01:32:49 +0000 + [ ] + * GitHub Actions Automatic version bump + + -- Thu, 15 May 2025 11:13:30 +0000 diff --git a/version.properties b/version.properties index bedba21b7..b0e960697 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 8 +build = 9 From 7d8f9c7f6df516d8c2561f3c3979581ab5209f47 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 15 May 2025 07:40:46 -0400 Subject: [PATCH 59/60] Stop the madness! Run as a user (not root) (#6718) * Stop the madness! Run as a user (not root) * Trigger fsdir migration for < 2.6.9 --------- Co-authored-by: Ben Meadors --- .trunk/trunk.yaml | 1 - Dockerfile | 14 ++++-- alpine.Dockerfile | 11 ++++- bin/99-meshtasticd-udev.rules | 4 ++ bin/config-dist.yaml | 2 +- bin/meshtasticd.service | 7 +-- bin/native-install.sh | 2 +- debian/control | 6 ++- debian/meshtasticd.dirs | 3 +- debian/meshtasticd.install | 4 +- debian/meshtasticd.postinst | 79 ++++++++++++++++++++++++++++++ debian/meshtasticd.postrm | 41 ++++++++++++++++ debian/meshtasticd.udev | 4 ++ meshtasticd.spec.rpkg | 66 +++++++++++++++++++++++-- src/mesh/raspihttp/PiWebServer.cpp | 4 +- 15 files changed, 225 insertions(+), 23 deletions(-) create mode 100644 bin/99-meshtasticd-udev.rules create mode 100755 debian/meshtasticd.postinst create mode 100755 debian/meshtasticd.postrm create mode 100644 debian/meshtasticd.udev diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 4aa5527be..79bdf4778 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -13,7 +13,6 @@ lint: - trufflehog@3.88.29 - yamllint@1.37.1 - bandit@1.8.3 - - terrascan@1.19.9 - trivy@0.62.1 - taplo@0.9.3 - ruff@0.11.9 diff --git a/Dockerfile b/Dockerfile index 6c1b83653..e033b1bba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# trunk-ignore-all(terrascan/AC_DOCKER_0002): Known terrascan issue # trunk-ignore-all(trivy/DS002): We must run as root for this container # trunk-ignore-all(hadolint/DL3002): We must run as root for this container # trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions @@ -38,6 +37,13 @@ RUN curl -L "https://github.com/meshtastic/web/releases/download/v$(cat /tmp/fir ##### PRODUCTION BUILD ############# FROM debian:bookworm-slim +LABEL org.opencontainers.image.title="Meshtastic" \ + org.opencontainers.image.description="Debian Meshtastic daemon and web interface" \ + org.opencontainers.image.url="https://meshtastic.org" \ + org.opencontainers.image.documentation="https://meshtastic.org/docs/" \ + org.opencontainers.image.authors="Meshtastic" \ + org.opencontainers.image.licenses="GPL-3.0-or-later" \ + org.opencontainers.image.source="https://github.com/meshtastic/firmware/" ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Etc/UTC @@ -54,7 +60,7 @@ RUN apt-get update && apt-get --no-install-recommends -y install \ && mkdir -p /etc/meshtasticd/ssl # Fetch compiled binary from the builder -COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/ +COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/ COPY --from=builder /tmp/web /usr/share/meshtasticd/ # Copy config templates COPY ./bin/config.d /etc/meshtasticd/available.d @@ -65,8 +71,8 @@ VOLUME /var/lib/meshtasticd # Expose Meshtastic TCP API port from the host EXPOSE 4403 # Expose Meshtastic Web UI port from the host -EXPOSE 443 +EXPOSE 9443 -CMD [ "sh", "-cx", "meshtasticd -d /var/lib/meshtasticd" ] +CMD [ "sh", "-cx", "meshtasticd --fsdir=/var/lib/meshtasticd" ] HEALTHCHECK NONE diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 350129040..bf7cad6d4 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -28,12 +28,19 @@ RUN bash ./bin/build-native.sh "$PIO_ENV" && \ # ##### PRODUCTION BUILD ############# FROM alpine:3.21 +LABEL org.opencontainers.image.title="Meshtastic" \ + org.opencontainers.image.description="Alpine Meshtastic daemon" \ + org.opencontainers.image.url="https://meshtastic.org" \ + org.opencontainers.image.documentation="https://meshtastic.org/docs/" \ + org.opencontainers.image.authors="Meshtastic" \ + org.opencontainers.image.licenses="GPL-3.0-or-later" \ + org.opencontainers.image.source="https://github.com/meshtastic/firmware/" # nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root USER root RUN apk --no-cache add \ - libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \ + shadow libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \ libx11 libinput libxkbcommon \ && rm -rf /var/cache/apk/* \ && mkdir -p /var/lib/meshtasticd \ @@ -41,7 +48,7 @@ RUN apk --no-cache add \ && mkdir -p /etc/meshtasticd/ssl # Fetch compiled binary from the builder -COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/ +COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/ # Copy config templates COPY ./bin/config.d /etc/meshtasticd/available.d diff --git a/bin/99-meshtasticd-udev.rules b/bin/99-meshtasticd-udev.rules new file mode 100644 index 000000000..69a468d7a --- /dev/null +++ b/bin/99-meshtasticd-udev.rules @@ -0,0 +1,4 @@ +# Set spidev ownership to 'spi' group. +SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660" +# Allow access to USB CH341 devices +SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666" diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 9238d0e56..98c7696f0 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -188,7 +188,7 @@ Logging: # AsciiLogs: true # default if not specified is !isatty() on stdout Webserver: -# Port: 443 # Port for Webserver & Webservices +# Port: 9443 # Port for Webserver & Webservices # RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer # SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if not present # SSLCert: /etc/meshtasticd/ssl/certificate.pem # Path to SSL Certificate, generated if not present diff --git a/bin/meshtasticd.service b/bin/meshtasticd.service index 1e8ee98b8..63430bae8 100644 --- a/bin/meshtasticd.service +++ b/bin/meshtasticd.service @@ -5,10 +5,11 @@ StartLimitInterval=200 StartLimitBurst=5 [Service] -User=root -Group=root +AmbientCapabilities=CAP_NET_BIND_SERVICE +User=meshtasticd +Group=meshtasticd Type=simple -ExecStart=/usr/sbin/meshtasticd +ExecStart=/usr/bin/meshtasticd Restart=always RestartSec=3 diff --git a/bin/native-install.sh b/bin/native-install.sh index a8fcc29a6..18cd9205b 100755 --- a/bin/native-install.sh +++ b/bin/native-install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -cp "release/meshtasticd_linux_$(uname -m)" /usr/sbin/meshtasticd +cp "release/meshtasticd_linux_$(uname -m)" /usr/bin/meshtasticd mkdir -p /etc/meshtasticd if [[ -f "/etc/meshtasticd/config.yaml" ]]; then cp bin/config-dist.yaml /etc/meshtasticd/config-upgrade.yaml diff --git a/debian/control b/debian/control index 9277f6f54..761383a5c 100644 --- a/debian/control +++ b/debian/control @@ -31,7 +31,9 @@ Rules-Requires-Root: no Package: meshtasticd Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} +Depends: adduser, + ${misc:Depends}, + ${shlibs:Depends} Description: Meshtastic daemon for communicating with Meshtastic devices Meshtastic is an off-grid text communication platform that uses inexpensive - LoRa radios. \ No newline at end of file + LoRa radios. diff --git a/debian/meshtasticd.dirs b/debian/meshtasticd.dirs index 45a1ca3db..a667768b2 100644 --- a/debian/meshtasticd.dirs +++ b/debian/meshtasticd.dirs @@ -1,5 +1,6 @@ +var/lib/meshtasticd etc/meshtasticd etc/meshtasticd/config.d etc/meshtasticd/available.d usr/share/meshtasticd/web -etc/meshtasticd/ssl \ No newline at end of file +etc/meshtasticd/ssl diff --git a/debian/meshtasticd.install b/debian/meshtasticd.install index 6b6b5a361..3c68b42b1 100644 --- a/debian/meshtasticd.install +++ b/debian/meshtasticd.install @@ -1,8 +1,8 @@ -.pio/build/native-tft/meshtasticd usr/sbin +.pio/build/native-tft/meshtasticd usr/bin bin/config.yaml etc/meshtasticd bin/config.d/* etc/meshtasticd/available.d bin/meshtasticd.service lib/systemd/system -web/* usr/share/meshtasticd/web \ No newline at end of file +web/* usr/share/meshtasticd/web diff --git a/debian/meshtasticd.postinst b/debian/meshtasticd.postinst new file mode 100755 index 000000000..324865718 --- /dev/null +++ b/debian/meshtasticd.postinst @@ -0,0 +1,79 @@ +#!/bin/sh +# postinst script for meshtasticd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure|reconfigure) + # create spi group (for udev rules) + # this group already exists on Raspberry Pi OS + getent group spi >/dev/null 2>/dev/null || addgroup --system spi + # create a meshtasticd group and user + getent passwd meshtasticd >/dev/null 2>/dev/null || adduser --system --home /var/lib/meshtasticd --no-create-home meshtasticd + getent group meshtasticd >/dev/null 2>/dev/null || addgroup --system meshtasticd + adduser meshtasticd meshtasticd >/dev/null 2>/dev/null + adduser meshtasticd spi >/dev/null 2>/dev/null + # add meshtasticd user to appropriate groups (if they exist) + getent group gpio >/dev/null 2>/dev/null && adduser meshtasticd gpio >/dev/null 2>/dev/null + getent group plugdev >/dev/null 2>/dev/null && adduser meshtasticd plugdev >/dev/null 2>/dev/null + getent group dialout >/dev/null 2>/dev/null && adduser meshtasticd dialout >/dev/null 2>/dev/null + getent group i2c >/dev/null 2>/dev/null && adduser meshtasticd i2c >/dev/null 2>/dev/null + getent group video >/dev/null 2>/dev/null && adduser meshtasticd video >/dev/null 2>/dev/null + getent group audio >/dev/null 2>/dev/null && adduser meshtasticd audio >/dev/null 2>/dev/null + getent group input >/dev/null 2>/dev/null && adduser meshtasticd input >/dev/null 2>/dev/null + + + # migrate /root/.portduino to /var/lib/meshtasticd/.portduino + # should only run once, upon upgrade from < 2.6.9 + if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.6.9; then + if [ -d /root/.portduino ] && [ ! -e /var/lib/meshtasticd/.portduino ]; then + cp -r /root/.portduino /var/lib/meshtasticd/.portduino + echo "Migrated meshtasticd VFS from /root/.portduino to /var/lib/meshtasticd/.portduino" + echo "meshtasticd now runs as the 'meshtasticd' user, not 'root'." + echo "See https://github.com/meshtastic/firmware/pull/6718 for details" + fi + fi + + if [ -d /var/lib/meshtasticd ]; then + chown -R meshtasticd:meshtasticd /var/lib/meshtasticd + fi + + if [ -d /etc/meshtasticd ]; then + chown -R meshtasticd:meshtasticd /etc/meshtasticd + fi + + if [ -d /usr/share/meshtasticd ]; then + chown -R meshtasticd:meshtasticd /usr/share/meshtasticd + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/meshtasticd.postrm b/debian/meshtasticd.postrm new file mode 100755 index 000000000..bb2c32a5b --- /dev/null +++ b/debian/meshtasticd.postrm @@ -0,0 +1,41 @@ +#!/bin/sh +# postrm script for meshtasticd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + # Only remove /var/lib/meshtasticd on purge + if [ "${1}" = "purge" ] ; then + rm -rf /var/lib/meshtasticd + fi + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/meshtasticd.udev b/debian/meshtasticd.udev new file mode 100644 index 000000000..69a468d7a --- /dev/null +++ b/debian/meshtasticd.udev @@ -0,0 +1,4 @@ +# Set spidev ownership to 'spi' group. +SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660" +# Allow access to USB CH341 devices +SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666" diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index 2d777bc76..eb4ab5ae7 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -10,6 +10,8 @@ # - https://docs.pagure.org/rpkg-util/v3/index.html # - https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ +%global meshtasticd_user meshtasticd + Name: meshtasticd # Version Ex: 2.5.19 Version: {{{ meshtastic_version }}} @@ -47,6 +49,8 @@ BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(libinput) BuildRequires: pkgconfig(xkbcommon-x11) +Requires: systemd-udev + %description Meshtastic daemon for controlling Meshtastic devices. Meshtastic is an off-grid text communication platform that uses inexpensive LoRa radios. @@ -63,15 +67,25 @@ gzip -dr web platformio run -e native-tft %install -mkdir -p %{buildroot}%{_sbindir} -install -m 0755 .pio/build/native-tft/program %{buildroot}%{_sbindir}/meshtasticd +# Install meshtasticd binary +mkdir -p %{buildroot}%{_bindir} +install -m 0755 .pio/build/native-tft/program %{buildroot}%{_bindir}/meshtasticd +# Install portduino VFS dir +install -p -d -m 0770 %{buildroot}%{_localstatedir}/lib/meshtasticd + +# Install udev rules +mkdir -p %{buildroot}%{_udevrulesdir} +install -m 0644 bin/99-meshtasticd-udev.rules %{buildroot}%{_udevrulesdir}/99-meshtasticd-udev.rules + +# Install config dirs mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd install -m 0644 bin/config-dist.yaml %{buildroot}%{_sysconfdir}/meshtasticd/config.yaml mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/config.d mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/available.d cp -r bin/config.d/* %{buildroot}%{_sysconfdir}/meshtasticd/available.d +# Install systemd service install -D -m 0644 bin/meshtasticd.service %{buildroot}%{_unitdir}/meshtasticd.service # Install the web files under /usr/share/meshtasticd/web @@ -80,10 +94,54 @@ cp -r web/* %{buildroot}%{_datadir}/meshtasticd/web # Install default SSL storage directory (for web) mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/ssl +%pre +# create spi group (for udev rules) +getent group spi > /dev/null || groupadd -r spi +# create a meshtasticd group and user +getent group %{meshtasticd_user} > /dev/null || groupadd -r %{meshtasticd_user} +getent passwd %{meshtasticd_user} > /dev/null || \ + useradd -r -d %{_localstatedir}/lib/meshtasticd -g %{meshtasticd_user} -G spi \ + -s /sbin/nologin -c "Meshtastic Daemon" %{meshtasticd_user} +# add meshtasticd user to appropriate groups (if they exist) +getent group gpio > /dev/null && usermod -a -G gpio %{meshtasticd_user} > /dev/null +getent group plugdev > /dev/null && usermod -a -G plugdev %{meshtasticd_user} > /dev/null +getent group dialout > /dev/null && usermod -a -G dialout %{meshtasticd_user} > /dev/null +getent group i2c > /dev/null && usermod -a -G i2c %{meshtasticd_user} > /dev/null +getent group video > /dev/null && usermod -a -G video %{meshtasticd_user} > /dev/null +getent group audio > /dev/null && usermod -a -G audio %{meshtasticd_user} > /dev/null +getent group input > /dev/null && usermod -a -G input %{meshtasticd_user} > /dev/null +exit 0 + +%triggerin -- meshtasticd < 2.6.9 +# migrate .portduino (if it exists and hasn’t already been copied) +if [ -d /root/.portduino ] && [ ! -e /var/lib/meshtasticd/.portduino ]; then + mkdir -p /var/lib/meshtasticd + cp -r /root/.portduino /var/lib/meshtasticd/.portduino + chown -R %{meshtasticd_user}:%{meshtasticd_user} \ + %{_localstatedir}/lib/meshtasticd || : + # Fix SELinux labels if present (no-op on non-SELinux systems) + restorecon -R /var/lib/meshtasticd/.portduino 2>/dev/null || : + echo "Migrated meshtasticd VFS from /root/.portduino to /var/lib/meshtasticd/.portduino" + echo "meshtasticd now runs as the 'meshtasticd' user, not 'root'." + echo "See https://github.com/meshtastic/firmware/pull/6718 for details" +fi + +%post +%systemd_post meshtasticd.service + +%preun +%systemd_preun meshtasticd.service + +%postun +%systemd_postun_with_restart meshtasticd.service + %files +%defattr(-,%{meshtasticd_user},%{meshtasticd_user}) %license LICENSE %doc README.md -%{_sbindir}/meshtasticd +%{_bindir}/meshtasticd +%dir %{_localstatedir}/lib/meshtasticd +%{_udevrulesdir}/99-meshtasticd-udev.rules %dir %{_sysconfdir}/meshtasticd %dir %{_sysconfdir}/meshtasticd/config.d %dir %{_sysconfdir}/meshtasticd/available.d @@ -96,4 +154,4 @@ mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/ssl %dir %{_sysconfdir}/meshtasticd/ssl %changelog -%autochangelog \ No newline at end of file +%autochangelog diff --git a/src/mesh/raspihttp/PiWebServer.cpp b/src/mesh/raspihttp/PiWebServer.cpp index 4fae0bc3d..7d3542e83 100644 --- a/src/mesh/raspihttp/PiWebServer.cpp +++ b/src/mesh/raspihttp/PiWebServer.cpp @@ -462,8 +462,8 @@ PiWebServerThread::PiWebServerThread() webservport = settingsMap[webserverport]; LOG_INFO("Use webserver port from yaml config %i ", webservport); } else { - LOG_INFO("Webserver port in yaml config set to 0, defaulting to port 443"); - webservport = 443; + LOG_INFO("Webserver port in yaml config set to 0, defaulting to port 9443"); + webservport = 9443; } // Web Content Service Instance From 1ef4caea05939c23cf3dfdedbf250bc0eff8b04e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 15 May 2025 09:23:37 -0500 Subject: [PATCH 60/60] Host metrics (#6817) * Add std::string exec() function to PortduinoGlue for future work * MVP for HostMetrics module. * Fix compilation for other targets * Remove extra debug calls * Big numbers don't do well as INTs. * Add HostMetrics to config.yaml --- bin/config-dist.yaml | 6 ++ src/modules/Modules.cpp | 4 + src/modules/Telemetry/HostMetrics.cpp | 131 +++++++++++++++++++++++ src/modules/Telemetry/HostMetrics.h | 40 +++++++ src/platform/portduino/PortduinoGlue.cpp | 19 ++++ src/platform/portduino/PortduinoGlue.h | 7 +- 6 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 src/modules/Telemetry/HostMetrics.cpp create mode 100644 src/modules/Telemetry/HostMetrics.h diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 98c7696f0..2907e4aab 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -193,6 +193,12 @@ Webserver: # SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if not present # SSLCert: /etc/meshtasticd/ssl/certificate.pem # Path to SSL Certificate, generated if not present + +HostMetrics: +# ReportInterval: 30 # Interval in minutes between HostMetrics report packets, or 0 for disabled +# Channel: 0 # channel to send Host Metrics over. Defaults to the primary channel. + + General: MaxNodes: 200 MaxMessageQueue: 100 diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 1f2b50057..fac2ca976 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -49,6 +49,7 @@ #endif #if ARCH_PORTDUINO #include "input/LinuxInputImpl.h" +#include "modules/Telemetry/HostMetrics.h" #if !MESHTASTIC_EXCLUDE_STOREFORWARD #include "modules/StoreForwardModule.h" #endif @@ -196,6 +197,9 @@ void setupModules() #if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES cannedMessageModule = new CannedMessageModule(); #endif +#if ARCH_PORTDUINO + new HostMetricsModule(); +#endif #if HAS_TELEMETRY new DeviceTelemetryModule(); #endif diff --git a/src/modules/Telemetry/HostMetrics.cpp b/src/modules/Telemetry/HostMetrics.cpp new file mode 100644 index 000000000..655be4b25 --- /dev/null +++ b/src/modules/Telemetry/HostMetrics.cpp @@ -0,0 +1,131 @@ +#include "HostMetrics.h" +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "MeshService.h" +#if ARCH_PORTDUINO +#include "PortduinoGlue.h" +#include +#endif + +int32_t HostMetricsModule::runOnce() +{ +#if ARCH_PORTDUINO + if (settingsMap[hostMetrics_interval] == 0) { + return disable(); + } else { + sendMetrics(); + return 60 * 1000 * settingsMap[hostMetrics_interval]; + } +#else + return disable(); +#endif +} + +bool HostMetricsModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) +{ + // Don't worry about storing telemetry in NodeDB if we're a repeater + if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) + return false; + + if (t->which_variant == meshtastic_Telemetry_host_metrics_tag) { +#ifdef DEBUG_PORT + const char *sender = getSenderShortName(mp); + + LOG_INFO("(Received Host Metrics from %s): uptime=%u, diskfree=%lu, memory free=%lu, load=%04.2f, %04.2f, %04.2f", sender, + t->variant.host_metrics.uptime_seconds, t->variant.host_metrics.diskfree1_bytes, + t->variant.host_metrics.freemem_bytes, static_cast(t->variant.host_metrics.load1) / 100, + static_cast(t->variant.host_metrics.load5) / 100, + static_cast(t->variant.host_metrics.load15) / 100); +#endif + } + return false; // Let others look at this message also if they want +} + +/* +meshtastic_MeshPacket *HostMetricsModule::allocReply() +{ + if (currentRequest) { + auto req = *currentRequest; + const auto &p = req.decoded; + meshtastic_Telemetry scratch; + meshtastic_Telemetry *decoded = NULL; + memset(&scratch, 0, sizeof(scratch)); + if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_HostMetrics_msg, &scratch)) { + decoded = &scratch; + } else { + LOG_ERROR("Error decoding HostMetrics module!"); + return NULL; + } + // Check for a request for device metrics + if (decoded->which_variant == meshtastic_Telemetry_host_metrics_tag) { + LOG_INFO("Device telemetry reply to request"); + return allocDataProtobuf(getHostMetrics()); + } + } + return NULL; +} + */ + +#if ARCH_PORTDUINO +meshtastic_Telemetry HostMetricsModule::getHostMetrics() +{ + std::string file_line; + meshtastic_Telemetry t = meshtastic_HostMetrics_init_zero; + t.which_variant = meshtastic_Telemetry_host_metrics_tag; + + if (access("/proc/uptime", R_OK) == 0) { + std::ifstream proc_uptime("/proc/uptime"); + if (proc_uptime.is_open()) { + std::getline(proc_uptime, file_line, ' '); + proc_uptime.close(); + t.variant.host_metrics.uptime_seconds = stoul(file_line); + } + } + + std::filesystem::space_info root = std::filesystem::space("/"); + t.variant.host_metrics.diskfree1_bytes = root.available; + + if (access("/proc/meminfo", R_OK) == 0) { + std::ifstream proc_meminfo("/proc/meminfo"); + if (proc_meminfo.is_open()) { + do { + std::getline(proc_meminfo, file_line); + } while (file_line.find("MemAvailable") == std::string::npos); + proc_meminfo.close(); + t.variant.host_metrics.freemem_bytes = stoull(file_line.substr(file_line.find_first_of("0123456789"))) * 1024; + } + } + if (access("/proc/loadavg", R_OK) == 0) { + std::ifstream proc_loadavg("/proc/loadavg"); + if (proc_loadavg.is_open()) { + std::getline(proc_loadavg, file_line, ' '); + t.variant.host_metrics.load1 = stof(file_line) * 100; + std::getline(proc_loadavg, file_line, ' '); + t.variant.host_metrics.load5 = stof(file_line) * 100; + std::getline(proc_loadavg, file_line, ' '); + t.variant.host_metrics.load15 = stof(file_line) * 100; + proc_loadavg.close(); + } + } + + return t; +} + +bool HostMetricsModule::sendMetrics() +{ + meshtastic_Telemetry telemetry = getHostMetrics(); + LOG_INFO("Send: uptime=%u, diskfree=%lu, memory free=%lu, load=%04.2f, %04.2f, %04.2f", + telemetry.variant.host_metrics.uptime_seconds, telemetry.variant.host_metrics.diskfree1_bytes, + telemetry.variant.host_metrics.freemem_bytes, static_cast(telemetry.variant.host_metrics.load1) / 100, + static_cast(telemetry.variant.host_metrics.load5) / 100, + static_cast(telemetry.variant.host_metrics.load15) / 100); + + meshtastic_MeshPacket *p = allocDataProtobuf(telemetry); + p->to = NODENUM_BROADCAST; + p->decoded.want_response = false; + p->priority = meshtastic_MeshPacket_Priority_BACKGROUND; + p->channel = settingsMap[hostMetrics_channel]; + LOG_INFO("Send packet to mesh"); + service->sendToMesh(p, RX_SRC_LOCAL, true); + return true; +} +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/HostMetrics.h b/src/modules/Telemetry/HostMetrics.h new file mode 100644 index 000000000..99ee631c1 --- /dev/null +++ b/src/modules/Telemetry/HostMetrics.h @@ -0,0 +1,40 @@ +#pragma once +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "ProtobufModule.h" + +class HostMetricsModule : private concurrency::OSThread, public ProtobufModule +{ + CallbackObserver nodeStatusObserver = + CallbackObserver(this, &HostMetricsModule::handleStatusUpdate); + + public: + HostMetricsModule() + : concurrency::OSThread("HostMetrics"), + ProtobufModule("HostMetrics", meshtastic_PortNum_TELEMETRY_APP, &meshtastic_Telemetry_msg) + { + uptimeWrapCount = 0; + uptimeLastMs = millis(); + nodeStatusObserver.observe(&nodeStatus->onNewStatus); + setIntervalFromNow(setStartDelay()); // Wait until NodeInfo is sent + } + virtual bool wantUIFrame() { return false; } + + protected: + /** Called to handle a particular incoming message + @return true if you've guaranteed you've handled this message and no other handlers should be considered for it + */ + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *p) override; + // virtual meshtastic_MeshPacket *allocReply() override; + virtual int32_t runOnce() override; + /** + * Send our Telemetry into the mesh + */ + bool sendMetrics(); + + private: + meshtastic_Telemetry getHostMetrics(); + + uint32_t lastSentToMesh = 0; + uint32_t uptimeWrapCount; + uint32_t uptimeLastMs; +}; \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 4b96e662a..c6aa30629 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -600,6 +600,11 @@ bool loadConfig(const char *configPath) (yamlConfig["Webserver"]["SSLCert"]).as("/etc/meshtasticd/ssl/certificate.pem"); } + if (yamlConfig["HostMetrics"]) { + settingsMap[hostMetrics_channel] = (yamlConfig["HostMetrics"]["Channel"]).as(0); + settingsMap[hostMetrics_interval] = (yamlConfig["HostMetrics"]["ReportInterval"]).as(0); + } + if (yamlConfig["General"]) { settingsMap[maxnodes] = (yamlConfig["General"]["MaxNodes"]).as(200); settingsMap[maxtophone] = (yamlConfig["General"]["MaxMessageQueue"]).as(100); @@ -650,4 +655,18 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac) } else { return false; } +} + +std::string exec(const char *cmd) +{ // https://stackoverflow.com/a/478960 + std::array buffer; + std::string result; + std::unique_ptr pipe(popen(cmd, "r"), pclose); + if (!pipe) { + throw std::runtime_error("popen() failed!"); + } + while (fgets(buffer.data(), static_cast(buffer.size()), pipe.get()) != nullptr) { + result += buffer.data(); + } + return result; } \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index 6393d7294..0cf0201aa 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -100,7 +100,9 @@ enum configNames { ascii_logs, config_directory, available_directory, - mac_address + mac_address, + hostMetrics_interval, + hostMetrics_channel }; enum { no_screen, x11, fb, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d }; enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 }; @@ -114,4 +116,5 @@ int initGPIOPin(int pinNum, std::string gpioChipname, int line); bool loadConfig(const char *configPath); static bool ends_with(std::string_view str, std::string_view suffix); void getMacAddr(uint8_t *dmac); -bool MAC_from_string(std::string mac_str, uint8_t *dmac); \ No newline at end of file +bool MAC_from_string(std::string mac_str, uint8_t *dmac); +std::string exec(const char *cmd); \ No newline at end of file