feat: add ESP8266 support + Akaso camera compatibility config
CI/CD / lint-and-typecheck (push) Failing after 0s
CI/CD / test (push) Has been skipped
CI/CD / build (push) Has been skipped
Build (Dev) / build (push) Failing after 8s
CI/CD / deploy (push) Has been skipped

- Unified firmware for ESP32 (dual-STA) and ESP8266 (time-shared STA)
- ESP8266: alternates between GoPro AP and travel router per poll cycle
- PlatformIO dual-target: esp32dev + esp8266dev (d1_mini)
- camera_ip config field for Akaso/non-GoPro cameras
- LittleFS support for ESP8266 (replaces SPIFFS)
- Camera compatibility table (GoPro H3/H4, Akaso)
- LED polarity handled per-platform (ESP8266 active-low)

ESP8266 time-sharing adds ~4s latency per 30s cycle — invisible at poll rate.
This commit is contained in:
2026-05-22 00:28:48 +00:00
parent 37c5362216
commit 324402f268
4 changed files with 448 additions and 461 deletions
+38 -19
View File
@@ -1,29 +1,58 @@
# RemoteRig — ESP32 Camera Node Firmware
# RemoteRig — ESP32 / ESP8266 Camera Node Firmware
> **Platform:** PlatformIO (esp32dev) | **Framework:** Arduino
> **Platform:** PlatformIO (esp32dev + esp8266dev) | **Framework:** Arduino
> **MQTT Contract:** [docs/MQTT_CONTRACT.md](../docs/MQTT_CONTRACT.md)
> **Hardware:** [hardware/README.md](../hardware/README.md)
## Quick Start
```bash
# Install PlatformIO (if not already)
# Install PlatformIO
pip install platformio
# Build
# Build for ESP32 (recommended — dual-STA)
cd firmware
pio run
pio run -e esp32dev
# Upload to ESP32 (USB connected)
pio run --target upload
# Build for ESP8266 D1 Mini (time-shared STA)
pio run -e esp8266dev
# Upload SPIFFS config (first time only, or after config changes)
pio run --target uploadfs
# Upload to board
pio run -e esp32dev --target upload
pio run -e esp8266dev --target upload
# Upload SPIFFS/LittleFS config (first time only)
pio run -e esp32dev --target uploadfs
pio run -e esp8266dev --target uploadfs
# Serial monitor
pio device monitor
```
## Platform Differences
| Feature | ESP32 | ESP8266 |
|---------|-------|---------|
| Wi-Fi | Dual-STA (simultaneous) | Single STA (time-shared) |
| Poll latency | 0ms (always connected to both) | ~4s per cycle (switch + poll + switch) |
| Power draw | ~80mA active | ~70mA active |
| Cost | ~$5 | ~$3 |
| Build target | `esp32dev` | `esp8266dev` |
| Filesystem | SPIFFS | LittleFS |
| LED pin | GPIO 2 (active high) | GPIO 2 / LED_BUILTIN (active low) |
**ESP8266 workflow:** Every 30s, the ESP8266 switches from the travel router to the GoPro AP (~1s), polls the camera (~2s), switches back to the travel router (~1s), then publishes MQTT. This adds ~4s of latency per cycle but is invisible at 30s poll intervals.
## Camera Compatibility
| Camera | IP | Protocol | Status |
|--------|-----|----------|--------|
| GoPro Hero 3 | `10.5.5.1` | HTTP GET `/bacpac/SH` | ✅ Full support |
| GoPro Hero 4 | `10.5.5.1` | HTTP GET `/gp/gpControl` | ⚠️ Different API — needs adaptation |
| Akaso Brave 4/7/V50 | `192.168.1.1` or `192.168.42.1` | Varies (HTTP or TCP:7878) | 🔬 Needs testing — config `camera_ip` |
For Akaso or other cameras: set `camera_ip` in config.json. The firmware will attempt the GoPro-style HTTP API at that IP. If the camera uses a different protocol, the `fetchCameraStatus()` and `sendCameraCommand()` functions in `main.cpp` need to be adapted.
## Configuration
The ESP32 stores configuration in SPIFFS (`data/config.json`):
@@ -97,16 +126,6 @@ The ESP32 stores configuration in SPIFFS (`data/config.json`):
- **Get password:** `GET /bacpac/sd` (no auth, returns plain text)
- **Status blob:** 60 bytes binary — see `parseStatus()` in main.cpp for field offsets
## ESP8266 Compatibility
To target ESP8266 instead:
1. Change `platformio.ini`: `board = d1_mini` under `[env:d1_mini]`
2. Change `WiFi.h``ESP8266WiFi.h`
3. ESP8266 doesn't do true simultaneous STA — use single STA to travel router, HTTP to GoPro via router bridge
4. SPIFFS → LittleFS on some boards
ESP32 is recommended for dual-STA capability.
## Troubleshooting
| Symptom | Check |