firmware: retarget camera-node MQTT bridge to XIAO ESP32-C6

The MCU changed from ESP32 Dev Board to a Seeed Studio XIAO ESP32-C6,
but the firmware still targeted esp32dev. Retarget it and fix the
build so it compiles and flashes for the C6.

platformio.ini:
- env esp32-mqtt -> seeed_xiao_esp32c6 on the pioarduino platform fork
  (mainline espressif32 lags the Arduino-core 3.x the C6 needs)
- add ARDUINO_USB_MODE=1 / ARDUINO_USB_CDC_ON_BOOT=1 for Serial over
  the C6 native USB
- fix build_src_filter ordering in BOTH envs: -<*.cpp> ran last and
  re-excluded the target, leaving setup()/loop() undefined at link

esp32-mqtt-bridge.cpp:
- UART Serial2 RX16/TX17 -> Serial1 RX=D7/TX=D6 (XIAO C6 mapping)
- status LED GPIO2 -> D1 (green channel of the RGB STAT LED)
- fix pre-existing ArduinoJson v7 / PubSubClient build errors
  (.c_str() on a const char*, String topic where const char* required)

Verified: builds clean and boots on hardware (native-USB serial banner
confirmed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Joshua King
2026-06-04 18:12:01 -04:00
parent a478f7d478
commit 2fb73ec8c4
2 changed files with 49 additions and 33 deletions
+25 -16
View File
@@ -9,16 +9,16 @@
; (TX/RX) (RX16/TX17)
;
; Build:
; pio run -e esp8266-camera (ESP8266 D1 Mini — camera bridge)
; pio run -e esp32-mqtt (ESP32 Dev Board — MQTT bridge)
; pio run -e esp8266-camera (ESP8266 — GoPro camera bridge)
; pio run -e seeed_xiao_esp32c6 (XIAO ESP32-C6 — MQTT bridge)
;
; Upload:
; pio run -e esp8266-camera --target upload
; pio run -e esp32-mqtt --target upload
; pio run -e seeed_xiao_esp32c6 --target upload
;
; Filesystem:
; pio run -e esp8266-camera --target uploadfs
; pio run -e esp32-mqtt --target uploadfs
; pio run -e seeed_xiao_esp32c6 --target uploadfs
[common]
lib_deps =
@@ -43,25 +43,34 @@ build_flags = ${common.build_flags}
board_build.flash_mode = dio
board_build.f_cpu = 160000000L
build_src_filter =
+<../lib/>
+<esp8266-camera-bridge.cpp>
-<*.cpp>
+<esp8266-camera-bridge.cpp>
+<../lib/>
; ── ESP32: MQTT Bridge ─────────────────────────────────────
; Flashed onto ESP32 Dev Board. Connects to travel router,
; publishes MQTT to Pi hub. Reads camera status from ESP8266
; over UART2 (RX16/TX17). No direct camera communication.
; ── XIAO ESP32-C6: MQTT Bridge ─────────────────────────────
; Flashed onto a Seeed Studio XIAO ESP32-C6. Connects to the
; travel router, publishes MQTT to the Pi hub. Reads camera
; status from the ESP-01S over UART (Serial1: RX=D7, TX=D6).
; No direct camera communication.
;
; ESP32-C6 requires the pioarduino fork of platform-espressif32
; (mainline espressif32 lagged on the Arduino-core 3.x the C6
; needs). USB-CDC-on-boot is required for Serial over native USB.
;
; Upload fallback if it can't connect: hold B (BOOT), tap
; R (RESET), release B, then re-run upload.
[env:esp32-mqtt]
platform = espressif32
board = esp32dev
[env:seeed_xiao_esp32c6]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
board = seeed_xiao_esp32c6
framework = arduino
monitor_speed = 115200
upload_speed = 921600
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
-D CONFIG_ARDUINO_LOOP_STACK_SIZE=8192
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
build_src_filter =
+<../lib/>
+<esp32-mqtt-bridge.cpp>
-<*.cpp>
+<esp32-mqtt-bridge.cpp>
+<../lib/>