Adds repeater, room_server, companion_radio_usb and kiss_modem
environments for the NUCLEO-WL55JC1 (STM32WL55JC, integrated SubGHz radio).
Notes on the board setup:
- Uses the upstream nucleo_wl55jc board. PlatformIO's boards_remap maps it
to the core's NUCLEO_WL55JC1 variant, so the LEDs, user buttons and the
LPUART1 -> ST-LINK VCP serial mapping all come from the core rather than
being redefined here.
- The RF switch table is built from the core's LORAWAN_RFSWITCH_* macros
(SP3T front end on PC3/PC4/PC5) so it tracks upstream if those are ever
revised. Both RFO_LP and RFO_HP are registered, so RadioLib selects HP
above 14 dBm and LP below it.
- board_build.extra_flags pins the device to STM32WL55xx. The stock board
manifest declares product_line STM32WL55xx but extra_flags -DSTM32WLE5xx;
that only works because every #elif chain happens to test WL55xx first.
- The Nucleo's LD1..LD3 are driven active HIGH, so the TX LED hooks are
inverted relative to STM32Board's active-LOW default.
- 32 KB reserved at the top of flash for LittleFS, as on the other
STM32WL variants.
Verified on hardware: all four environments build; repeater and room_server
flash and run over ST-LINK; identity and prefs persist across reboot and
across a firmware swap; and GPIOC reads back the documented RX levels at
idle, confirming the front-end switch is driven correctly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The room server gated its filesystem paths on NRF52_PLATFORM only, so an
STM32 build fell through to the ESP32 branch and failed to compile:
MyMesh.cpp:147: no matching function for call to
'Adafruit_LittleFS::open(const char*&, const char [2], bool)'
main.cpp:69: 'store' was not declared in this scope
STM32 uses the same InternalFS / Adafruit_LittleFS API as nRF52, including
append semantics (FILE_O_WRITE opens LFS_O_RDWR|LFS_O_CREAT and then seeks
to the end), so the nRF52 branch is already correct for it. Add
STM32_PLATFORM alongside NRF52_PLATFORM in the four remaining gates;
saveIdentity() already did this.
This unblocks the room_server example on the existing STM32WL boards
(wio-e5-mini, wio-e5-dev, rak3x72, tiny_relay) as well as new ones.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add a dimmed heartbeat for the SenseCAP Solar (P1 Pro) white LED in the
repeater firmware, implemented entirely as a SenseCapSolarBoard::loop()
override so no example main.cpp needs to be touched:
- 100 ms pulse every 5 s, dimmed to 10% brightness via hardware PWM
(NRF_PWM0 / HwPWM0, 1 kHz, COUNTERTOP 16000, compare 1600)
- during the 4.9 s off phase the PWM peripheral is stopped (ENABLE=0),
the pin is released (PSEL disconnect) and GPIO 11 is held LOW, so no
HFCLK is demanded between pulses
- on successful application-level "start ota" the PWM is stopped and the
white LED goes steady full-brightness while BLE OTA is advertised;
on failed start the heartbeat keeps blinking
- powerOff() stops/releases the heartbeat PWM before shutting the LED off
- non-blocking millis() timing with wrap-safe unsigned arithmetic
- gated by SENSECAP_SOLAR_WHITE_LED, defined only in the
SenseCap_Solar_repeater PlatformIO env, so the room-server and
companion firmwares sharing this board class are unaffected
No changes to LoRa/repeater forwarding, the blue TX LED, charging LEDs,
GPS, power management, config storage or the bootloader.
'sensor list' appended 'name=value' lines into the 160-byte CLI reply with
unbounded sprintf, only checking the position before each write (< 134).
A single long value (or several medium ones) could write past the end of
the buffer.
Write each entry with snprintf against the remaining space, keep room for
the '... next:N' paging hint, and move entries that do not fit to the next
page. Also guard against NULL names/values from a sensor manager.
ESP32Board.h defined _rtc_backup_time and _rtc_backup_magic as static in the
header, so every translation unit that includes it has its own copy, and the
inline members of ESP32RTCClock read and write the copy of the unit they are
compiled in. Today one unit per image uses them; a second one could restore a
copy that setCurrentTime() never wrote. The header now declares them, and
ESP32Board.cpp defines them once.
"set af nan" is accepted and stores a NaN in airtime_factor, the duty cycle
budget the roles hand to their airtime accounting. strtof() consumes the
token, so the parse guard does not fire, and no ordered comparison is true for
a NaN, so "af < 0 || af > 9" cannot reject it. "set dutycycle" writes the same
field and has the same hole.
Both commands now check the text before it is parsed: after optional white
space and sign, a number has to start with a digit or a '.'. That refuses
"nan", "inf" and their variants, and keeps every spelling that was accepted
before (signs, leading white space, ".5"). The ranges and both reply strings
are unchanged.
The check is on the text rather than on the parsed float on purpose. nRF52
builds use -Ofast, and under -ffast-math the compiler may assume a float is
never NaN or infinite. A test on the value, even one that reads its bits, can
then be folded away: clang does exactly that with a bit test at -Ofast, while
arm-none-eabi-gcc keeps it. A character test does not depend on that.
CMD_SEND_CHANNEL_TXT_MSG reads txt_type, channel_idx and a 4 byte timestamp, so
the frame needs 7 bytes before the text starts, and the branch had no length
guard. For a shorter frame "len - i" is computed in size_t, wraps, and reaches
sendGroupMessage() as a negative int. The clamp there tests
"text_len + prefix_len > MAX_TEXT_LEN", which a negative value passes, and the
following memcpy() converts the length back to a size_t: a 3 byte frame asks for
4294967292 bytes into a 197 byte stack buffer.
Two guards, because there are two mistakes. The branch now states its minimum
like most other branches of handleCmdFrame do, so a frame below 7 bytes is
answered through the existing path instead of being parsed. And
sendGroupMessage() refuses a negative length the way sendGroupData() in the same
file already does, which protects every other caller.
A frame of exactly 7 bytes keeps working and sends an empty message, as before.
Evidence. On a T-Echo running dev 428a95c6, built with
FIRMWARE_BUILD_DATE "f1-dev" and confirmed by "ver => v1.18.0 (Build: f1-dev)":
CH_TXT len=7 -> RESP_CODE_OK
GET_STATS core -> uptime=78s
CH_TXT len=3 -> NO REPLY
DEVICE_QUERY -> NO REPLY (three times over 8 s, node never came back)