From 8d2a5657accd311e3f75578c46882313bdd4ec65 Mon Sep 17 00:00:00 2001 From: Blake Latchford Date: Thu, 17 Sep 2026 22:12:53 -0400 Subject: [PATCH 1/2] Pin Radiolab for stm32 and replace ltoa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The major rev from 19.x to 20.x breaks Radiolab, so pin it for now. This should fix the failing wio-e5-mini_repeater builds. ltoa is removed upstream, so it was replaced with snprintf. The p[] buffer is always 16 bytes. Copy/paste for why claude thinks this is fine below, but also if this is broken it wouldn't be new. ``` exp2 in [23, 30] (int_part = mantissa << (exp2 - 23)): this is where int_part can reach its true max, up to 2,147,483,520 — 10 digits. That's what the snprintf bound of 11 (10 digits + NUL) is sized for. But in this branch frac_part is never assigned anything other than its initial 0, so only *p++ = '0' runs for the fraction — 1 char, not 7. exp2 in [0, 22] (int_part = mantissa >> (23 - exp2)): this is the only branch where frac_part can also be nonzero and enter the 7-digit loop. Here int_part < 2^23 by construction, so it's capped at 7 digits, never 10. ``` --- platformio.ini | 4 +++- src/helpers/TxtDataHelpers.cpp | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platformio.ini b/platformio.ini index de4d6c29c3..f296f83821 100644 --- a/platformio.ini +++ b/platformio.ini @@ -110,7 +110,9 @@ build_flags = ${arduino_base.build_flags} [stm32_base] extends = arduino_base -platform = ststm32 +; Pinned pending upstream fix for upstream conversions. +; https://github.com/jgromes/RadioLib/issues/1873 +platform = ststm32@19.7.1 extra_scripts = post:arch/stm32/build_hex.py build_flags = ${arduino_base.build_flags} -D STM32_PLATFORM diff --git a/src/helpers/TxtDataHelpers.cpp b/src/helpers/TxtDataHelpers.cpp index d327931fde..f2621c0dec 100644 --- a/src/helpers/TxtDataHelpers.cpp +++ b/src/helpers/TxtDataHelpers.cpp @@ -27,8 +27,9 @@ bool StrHelper::isBlank(const char* str) { } #include +#include -union int32_Float_t +union int32_Float_t { int32_t Long; float Float; @@ -100,11 +101,9 @@ static void _ftoa(float f, char *p, int *status) *p++ = '-'; if (int_part == 0) *p++ = '0'; - else + else { - ltoa(int_part, p, 10); - while (*p) - p++; + p += snprintf(p, 11, "%ld", (long)int_part); } *p++ = '.'; if (frac_part == 0) From 12a8c8d4d42bf42189526a02906d328a893f2177 Mon Sep 17 00:00:00 2001 From: Blake Latchford Date: Sun, 20 Sep 2026 15:16:33 -0400 Subject: [PATCH 2/2] Add missing include, and revert removal of lota --- src/helpers/TxtDataHelpers.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/helpers/TxtDataHelpers.cpp b/src/helpers/TxtDataHelpers.cpp index f2621c0dec..4358c8b832 100644 --- a/src/helpers/TxtDataHelpers.cpp +++ b/src/helpers/TxtDataHelpers.cpp @@ -28,6 +28,10 @@ bool StrHelper::isBlank(const char* str) { #include #include +#if __has_include() +// https://github.com/stm32duino/Arduino_Core_STM32/issues/3084 +#include +#endif union int32_Float_t { @@ -103,7 +107,9 @@ static void _ftoa(float f, char *p, int *status) *p++ = '0'; else { - p += snprintf(p, 11, "%ld", (long)int_part); + ltoa(int_part, p, 10); + while (*p) + p++; } *p++ = '.'; if (frac_part == 0)