mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
Pin Radiolab for stm32 and replace ltoa
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. ```
This commit is contained in:
+3
-1
@@ -110,7 +110,9 @@ build_flags = ${arduino_base.build_flags}
|
|||||||
|
|
||||||
[stm32_base]
|
[stm32_base]
|
||||||
extends = arduino_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
|
extra_scripts = post:arch/stm32/build_hex.py
|
||||||
build_flags = ${arduino_base.build_flags}
|
build_flags = ${arduino_base.build_flags}
|
||||||
-D STM32_PLATFORM
|
-D STM32_PLATFORM
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ bool StrHelper::isBlank(const char* str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
union int32_Float_t
|
union int32_Float_t
|
||||||
{
|
{
|
||||||
@@ -102,9 +103,7 @@ static void _ftoa(float f, char *p, int *status)
|
|||||||
*p++ = '0';
|
*p++ = '0';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ltoa(int_part, p, 10);
|
p += snprintf(p, 11, "%ld", (long)int_part);
|
||||||
while (*p)
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
*p++ = '.';
|
*p++ = '.';
|
||||||
if (frac_part == 0)
|
if (frac_part == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user