; 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 D1 Mini — camera bridge)
;   pio run -e esp32-mqtt        (ESP32 Dev Board — MQTT bridge)
;
; Upload:
;   pio run -e esp8266-camera --target upload
;   pio run -e esp32-mqtt --target upload
;
; Filesystem:
;   pio run -e esp8266-camera --target uploadfs
;   pio run -e esp32-mqtt --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 =
    +<../lib/>
    +<esp8266-camera-bridge.cpp>
    -<*.cpp>

; ── 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.

[env:esp32-mqtt]
platform = espressif32
board = esp32dev
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
build_src_filter =
    +<../lib/>
    +<esp32-mqtt-bridge.cpp>
    -<*.cpp>
