From ac3e5684d6887704eb0e317223e0c7bc8394ac76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 14 Jul 2025 12:11:26 +0200 Subject: [PATCH 1/6] get git url part from local repo (#7331) --- bin/platformio-custom.py | 13 +++++++++++++ src/main.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index be2a9ab71..fc1b4bc2e 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -3,6 +3,7 @@ # trunk-ignore-all(flake8/F821): For SConstruct imports import sys from os.path import join +import subprocess import json import re @@ -92,6 +93,17 @@ prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" verObj = readProps(prefsLoc) print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"] + " on " + env.get("PIOENV")) +# get repository owner if git is installed +try: + r_owner = ( + subprocess.check_output(["git", "config", "--get", "remote.origin.url"]) + .decode("utf-8") + .strip().split("/") + ) + repo_owner = r_owner[-2] + "/" + r_owner[-1].replace(".git", "") +except subprocess.CalledProcessError: + repo_owner = "unknown" + jsonLoc = env["PROJECT_DIR"] + "/userPrefs.jsonc" with open(jsonLoc) as f: jsonStr = re.sub("//.*","", f.read(), flags=re.MULTILINE) @@ -117,6 +129,7 @@ flags = [ "-DAPP_VERSION=" + verObj["long"], "-DAPP_VERSION_SHORT=" + verObj["short"], "-DAPP_ENV=" + env.get("PIOENV"), + "-DAPP_REPO=" + repo_owner, ] + pref_flags print ("Using flags:") diff --git a/src/main.cpp b/src/main.cpp index 395291766..640f0b1fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -286,7 +286,7 @@ void lateInitVariant() {} */ void printInfo() { - LOG_INFO("S:B:%d,%s,%s", HW_VENDOR, optstr(APP_VERSION), optstr(APP_ENV)); + LOG_INFO("S:B:%d,%s,%s,%s", HW_VENDOR, optstr(APP_VERSION), optstr(APP_ENV), optstr(APP_REPO)); } #ifndef PIO_UNIT_TESTING void setup() From 1be4fc5ae95dc22e63688f78e9050981d50d88d8 Mon Sep 17 00:00:00 2001 From: Chloe Bethel Date: Mon, 14 Jul 2025 11:12:26 +0100 Subject: [PATCH 2/6] GPS for STM32WL (#7297) * Enable GPS for Wio-E5 variant on Serial2 * Add ability to override GPS serial port using GPS_SERIAL_PORT, and make RAK2560 use it. * Don't try to send ATAK packets if ATAK is disabled, +4k flash --- arch/stm32/stm32.ini | 4 ++-- src/gps/GPS.cpp | 6 +++--- src/modules/PositionModule.cpp | 2 ++ variants/rak2560/variant.h | 1 + variants/wio-e5/platformio.ini | 7 ++++++- variants/wio-e5/variant.h | 2 ++ 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index be1ed662f..03e0bf392 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -23,11 +23,11 @@ build_flags = -DMESHTASTIC_EXCLUDE_SCREEN=1 -DMESHTASTIC_EXCLUDE_MQTT=1 -DMESHTASTIC_EXCLUDE_BLUETOOTH=1 - -DMESHTASTIC_EXCLUDE_GPS=1 -DMESHTASTIC_EXCLUDE_WIFI=1 -DMESHTASTIC_EXCLUDE_TZ=1 ; Exclude TZ to save some flash space. + -DSERIAL_RX_BUFFER_SIZE=256 ; For GPS - the default of 64 is too small. -DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF ; This is REQUIRED for at least traceroute debug prints - without it the length ends up uninitialized. - ;-DDEBUG_MUTE + -DDEBUG_MUTE ; You can #undef DEBUG_MUTE in certain source files if you need the logs. -fmerge-all-constants -ffunction-sections -fdata-sections diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 345c738d6..3a6b19f64 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -39,9 +39,9 @@ template std::size_t array_count(const T (&)[N]) return N; } -#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) -#if defined(RAK2560) -HardwareSerial *GPS::_serial_gps = &Serial2; +#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL) +#if defined(GPS_SERIAL_PORT) +HardwareSerial *GPS::_serial_gps = &GPS_SERIAL_PORT; #else HardwareSerial *GPS::_serial_gps = &Serial1; #endif diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 93c65ecc1..8b6a9f19c 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -266,9 +266,11 @@ meshtastic_MeshPacket *PositionModule::allocPositionPacket() LOG_INFO("Position packet: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i); +#ifndef MESHTASTIC_EXCLUDE_ATAK // TAK Tracker devices should send their position in a TAK packet over the ATAK port if (config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) return allocAtakPli(); +#endif return allocDataProtobuf(p); } diff --git a/variants/rak2560/variant.h b/variants/rak2560/variant.h index a03fc3933..f922e8a61 100644 --- a/variants/rak2560/variant.h +++ b/variants/rak2560/variant.h @@ -222,6 +222,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG // #define PIN_GPS_EN PIN_3V3_EN #define PIN_GPS_PPS (17) // Pulse per second input from the GPS +#define GPS_SERIAL_PORT Serial2 // On RAK2560 the GPS is be on a different UART // #define GPS_RX_PIN PIN_SERIAL2_RX // #define GPS_TX_PIN PIN_SERIAL2_TX diff --git a/variants/wio-e5/platformio.ini b/variants/wio-e5/platformio.ini index 1ef7abd78..90251c7aa 100644 --- a/variants/wio-e5/platformio.ini +++ b/variants/wio-e5/platformio.ini @@ -15,7 +15,12 @@ build_flags = -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 - -DHAS_SENSOR + -DHAS_SENSOR=1 + -DENABLE_HWSERIAL2 + -DPIN_SERIAL2_TX=PA2 + -DPIN_SERIAL2_RX=PA3 + -DHAS_GPS=1 + -DGPS_SERIAL_PORT=Serial2 upload_port = stlink diff --git a/variants/wio-e5/variant.h b/variants/wio-e5/variant.h index 5421eaeb9..6098b4ce6 100644 --- a/variants/wio-e5/variant.h +++ b/variants/wio-e5/variant.h @@ -17,6 +17,8 @@ Do not expect a working Meshtastic device with this target. #define LED_PIN PB5 #define LED_STATE_ON 1 +#define WIO_E5 + #if (defined(LED_BUILTIN) && LED_BUILTIN == PNUM_NOT_DEFINED) #undef LED_BUILTIN #define LED_BUILTIN (LED_PIN) From 3599ca6845c3b9788226e875ef7c11a4a6be7da1 Mon Sep 17 00:00:00 2001 From: Chloe Bethel Date: Mon, 14 Jul 2025 11:12:38 +0100 Subject: [PATCH 3/6] Add heap info via standard mallinfo() function for STM32 (#7327) Co-authored-by: Ben Meadors --- src/memGet.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/memGet.cpp b/src/memGet.cpp index ef1102f1e..e8cd177dd 100644 --- a/src/memGet.cpp +++ b/src/memGet.cpp @@ -10,6 +10,10 @@ #include "memGet.h" #include "configuration.h" +#ifdef ARCH_STM32WL +#include +#endif + MemGet memGet; /** @@ -24,6 +28,9 @@ uint32_t MemGet::getFreeHeap() return dbgHeapFree(); #elif defined(ARCH_RP2040) return rp2040.getFreeHeap(); +#elif defined(ARCH_STM32WL) + struct mallinfo m = mallinfo(); + return m.fordblks; // Total free space (bytes) #else // this platform does not have heap management function implemented return UINT32_MAX; @@ -42,6 +49,9 @@ uint32_t MemGet::getHeapSize() return dbgHeapTotal(); #elif defined(ARCH_RP2040) return rp2040.getTotalHeap(); +#elif defined(ARCH_STM32WL) + struct mallinfo m = mallinfo(); + return m.arena; // Non-mmapped space allocated (bytes) #else // this platform does not have heap management function implemented return UINT32_MAX; From f197f0e5ec791c6944e73ec52ded417884ad3f08 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 05:12:52 -0500 Subject: [PATCH 4/6] Upgrade trunk (#7336) Co-authored-by: vidplace7 <1779290+vidplace7@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 f0271c856..7d27efe58 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,7 +9,7 @@ plugins: lint: enabled: - checkov@3.2.450 - - renovate@41.29.1 + - renovate@41.30.5 - prettier@3.6.2 - trufflehog@3.89.2 - yamllint@1.37.1 From daa1d582cbdf1a8ae20175d1353feb2e6524526f Mon Sep 17 00:00:00 2001 From: Quency-D <55523105+Quency-D@users.noreply.github.com> Date: Mon, 14 Jul 2025 18:43:25 +0800 Subject: [PATCH 5/6] The screen display of the heltec wireless tracker is abnormal. (#7337) The screen of the heltec wireless tracker uses the same power source as the GPS. If the GPS turns off the power during the screen shutdown period and then turns on the power, the screen will not function properly. So initialize the screen every time it starts. --- src/graphics/Screen.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 1f2e7e4d9..e46f7dffe 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -386,9 +386,7 @@ 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 @@ -400,10 +398,7 @@ 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(); - } #endif #ifdef USE_ST7789 pinMode(VTFT_CTRL, OUTPUT); From 86af5f5252f408fce0fc1509e2430c98395c7d49 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 14 Jul 2025 05:44:29 -0500 Subject: [PATCH 6/6] Trunk --- src/graphics/Screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index e46f7dffe..e1b4101c4 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -398,7 +398,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) dispdev->displayOn(); #ifdef HELTEC_TRACKER_V1_X - ui->init(); + ui->init(); #endif #ifdef USE_ST7789 pinMode(VTFT_CTRL, OUTPUT);