Files
remote-rig/firmware/platformio.ini
T
Joshua King 2fb73ec8c4 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>
2026-06-04 18:12:01 -04:00

77 lines
2.6 KiB
INI

; RemoteRig — Dual-Board Camera Node Firmware
; ============================================
; Each camera node has TWO boards connected via UART:
;
; ESP8266 (Camera Bridge): Connects to GoPro AP → HTTP status/control
; ESP32 (MQTT Bridge): Connects to travel router → MQTT to hub
;
; ESP8266 ←──UART──→ ESP32
; (TX/RX) (RX16/TX17)
;
; Build:
; 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 seeed_xiao_esp32c6 --target upload
;
; Filesystem:
; pio run -e esp8266-camera --target uploadfs
; pio run -e seeed_xiao_esp32c6 --target uploadfs
[common]
lib_deps =
knolleary/PubSubClient @ ^2.8
bblanchon/ArduinoJson @ ^7.3
build_flags =
-D CORE_DEBUG_LEVEL=0
; ── ESP8266: Camera Bridge ──────────────────────────────────
; Flashed onto D1 Mini. Talks to GoPro over Wi-Fi, relays to
; ESP32 over UART (TX/RX pins). No MQTT, no router connection.
[env:esp8266-camera]
platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200
upload_speed = 921600
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
-D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
board_build.flash_mode = dio
board_build.f_cpu = 160000000L
build_src_filter =
-<*.cpp>
+<esp8266-camera-bridge.cpp>
+<../lib/>
; ── 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: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
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 =
-<*.cpp>
+<esp32-mqtt-bridge.cpp>
+<../lib/>