MeshCore has carried companion-over-hardware-UART for a long time — the defines SERIAL_RX/SERIAL_TX, packaged per board as a *_companion_radio_serial env, and the ESP32-S3 twin of this very board already uses the same D6/D7 pads. Our patch was reimplementing it for the one platform it had never been wired into: at our old pin the SERIAL_RX branches lived inside the ESP32 and RP2040 blocks and nRF52 fell through to Serial. So the patch is now the two things actually missing, both upstream-shaped and submitted: a Serial1 reference so the shared block compiles on nRF52, and the Xiao_nrf52_companion_radio_serial env carrying the I2C escape in build_unflags rather than editing the flags every XIAO env inherits. Pin moves to a dev commit, since dev is the branch MeshCore takes work on. flash.py grew the check that was missing when it mattered: a drive letter is not an identity — when one board leaves the USB bus another inherits its letter — so it now reads INFO_UF2.TXT and refuses a bootloader that isn't a XIAO, or that carries S140 6.1.1 and would take this S140-v7 image at the wrong address and never boot. It also stops pretending copy-to-drive is the only route: our bootloader exposes a serial port and no mass storage at all, so it prints the serial-DFU command instead of a dead end. Verified from a clean clone at the new pin: env builds, uf2 converts to the same 811008 bytes at 0x27000 that is now running on the radio, and both Xiao_nrf52_companion_radio_usb and Xiao_S3_WIO_companion_radio_serial still build, so neither side of the new #if moved.
53 lines
1.8 KiB
Diff
53 lines
1.8 KiB
Diff
diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp
|
|
index 89f0e6cb..cf30f9ad 100644
|
|
--- a/examples/companion_radio/main.cpp
|
|
+++ b/examples/companion_radio/main.cpp
|
|
@@ -61,7 +61,13 @@ MultiSerialInterface interface_manager;
|
|
#if defined(SERIAL_RX)
|
|
#include <helpers/ArduinoSerialInterface.h>
|
|
ArduinoSerialInterface hardware_serial_interface;
|
|
- HardwareSerial companion_serial(1);
|
|
+ #if defined(NRF52_PLATFORM)
|
|
+ // nRF52 has no numbered-constructor HardwareSerial; Serial1 is the concrete UARTE0
|
|
+ // instance the core always defines. setPins() below moves it to the requested pads.
|
|
+ Uart& companion_serial = Serial1;
|
|
+ #else
|
|
+ HardwareSerial companion_serial(1);
|
|
+ #endif
|
|
#endif
|
|
|
|
// platform file system
|
|
diff --git a/variants/xiao_nrf52/platformio.ini b/variants/xiao_nrf52/platformio.ini
|
|
index 1076bd8d..1eb216d1 100644
|
|
--- a/variants/xiao_nrf52/platformio.ini
|
|
+++ b/variants/xiao_nrf52/platformio.ini
|
|
@@ -119,3 +119,28 @@ build_src_filter = ${Xiao_nrf52.build_src_filter}
|
|
+<../examples/kiss_modem/*.cpp>
|
|
lib_deps =
|
|
${Xiao_nrf52.lib_deps}
|
|
+
|
|
+[env:Xiao_nrf52_companion_radio_serial]
|
|
+extends = Xiao_nrf52
|
|
+board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
|
+board_upload.maximum_size = 708608
|
|
+build_flags =
|
|
+ ${Xiao_nrf52.build_flags}
|
|
+ -I examples/companion_radio/ui-orig
|
|
+ -D MAX_CONTACTS=350
|
|
+ -D MAX_GROUP_CHANNELS=40
|
|
+ -D OFFLINE_QUEUE_SIZE=256
|
|
+ -D QSPIFLASH=1
|
|
+ -D SERIAL_TX=D6
|
|
+ -D SERIAL_RX=D7
|
|
+ -D PIN_WIRE_SCL=16
|
|
+ -D PIN_WIRE_SDA=17
|
|
+build_unflags =
|
|
+ -D PIN_WIRE_SCL=D6
|
|
+ -D PIN_WIRE_SDA=D7
|
|
+build_src_filter = ${Xiao_nrf52.build_src_filter}
|
|
+ +<../examples/companion_radio/*.cpp>
|
|
+ +<../examples/companion_radio/ui-orig/*.cpp>
|
|
+lib_deps =
|
|
+ ${Xiao_nrf52.lib_deps}
|
|
+ densaugeo/base64 @ ~1.4.0
|