# Firmware Variants — Project Vesper > Reference for all PlatformIO build environments defined in `vesper/platformio.ini`. --- ## Active Environments ### `vesper-v1` — Vesper (VS) | Property | Value | |---|---| | Board | Kincony KC868-A6 | | MCU | ESP32-D0WD-V3 (rev 3.1) | | PlatformIO board target | `esp32dev` | | Flash size | 4 MB | | Partition table | `min_spiffs.csv` | | Board type code | `VS` | | Board version | `01` | | PSRAM | No | | RF remote | No | | Onboard LCD | No | **Partition layout (`min_spiffs.csv`):** | Partition | Address | Size | |---|---|---| | nvs | `0x9000` | 20 KB (0x5000) | | app0 (active) | `0x10000` | ~1.8 MB | | app1 (OTA) | `0x1F0000` | ~1.8 MB | | spiffs | `0x3D0000` | 128 KB | **Build:** ```bash # From repo root pio run -e vesper-v1 # Output: vesper/.pio/build/vesper-v1/firmware.bin ``` **Full erase + upload:** ```bash pio run -e vesper-v1 --target upload --upload-port COM8 ``` **Flash NVS after full upload** (NVS is wiped by full erase — must reflash separately): ```bash C:/Users/espi_/.espressif/python_env/idf5.4_py3.11_env/Scripts/python.exe \ -m esptool --chip esp32 --port COM8 --baud 921600 \ write_flash 0x9000 vesper/provisioning/nvs_lab_device.bin ``` **Serial monitor:** ```bash pio device monitor # 115200 baud ``` **OTA URL pattern (VPS NGINX):** ``` http://72.61.191.197/ota/vs/stable/firmware.bin http://72.61.191.197/ota/vs/{channel}/firmware.bin ``` Channels: `stable`, `beta` **Key build flags:** ```ini -DBOARD_TYPE="VS" -DBOARD_VERSION="01" -DBOARD_NAME="Vesper" -DPSRAM_ENABLED=0 -DHAS_RF=0 -DHAS_LCD=0 -DMQTT_SECRET="" ``` > **Important:** `MQTT_SECRET` must match the `MQTT_SECRET` in the backend `.env` on the VPS. > Never commit the real secret. Override locally via a `platformio.ini.local` file (gitignored): > ```ini > [env:vesper-v1] > build_flags = > ... (copy existing flags) ... > -DMQTT_SECRET=\"your_actual_secret\" > ``` --- ## Planned Environments (Not Yet Active) ### `vesper-plus-v1` — Vesper+ (VP) | Property | Value | |---|---| | Board target | `esp32dev` | | Board type code | `VP` | | RF remote | **Yes** (`HAS_RF=1`) | | Onboard LCD | No | | Status | Commented out in `platformio.ini` | **When activated, upload command:** ```bash pio run -e vesper-plus-v1 --target upload --upload-port ``` **OTA URL pattern:** ``` http://72.61.191.197/ota/vp/stable/firmware.bin ``` --- ### `vesper-pro-v1` — Vesper Pro (VX) | Property | Value | |---|---| | Board target | `esp32dev` | | Board type code | `VX` | | RF remote | No | | Onboard LCD | **Yes** (`HAS_LCD=1`) | | Status | Commented out in `platformio.ini` | **When activated, upload command:** ```bash pio run -e vesper-pro-v1 --target upload --upload-port ``` **OTA URL pattern:** ``` http://72.61.191.197/ota/vx/stable/firmware.bin ``` --- ## NVS Identity (All Variants) Each device has a pre-flashed NVS partition at `0x9000` containing: | NVS namespace | Key | Example | |---|---|---| | `device_id` | `device_uid` | `PV-26B18-VS01R-X7KQA` | | `device_id` | `hw_type` | `VS` | | `device_id` | `hw_version` | `01` | NVS binaries are generated by the admin console at: ``` GET /api/manufacturing/devices/{sn}/nvs.bin ``` The lab device NVS CSV and binary live at: ``` vesper/provisioning/nvs_lab_device.csv vesper/provisioning/nvs_lab_device.bin ``` --- ## Shared Library Dependencies All variants share the same `lib_deps` (defined in `[common]`): | Library | Purpose | |---|---| | `tzapu/WiFiManager` | WiFi provisioning captive portal | | `me-no-dev/ESPAsyncWebServer` | Async HTTP server + WebSocket | | `me-no-dev/AsyncTCP` | Async TCP (required by above) | | `bblanchon/ArduinoJson` | JSON parsing (v7) | | `adafruit/Adafruit PCF8574` | I2C GPIO expander (relay control) | | `adafruit/RTClib` | Real-time clock | | `marvinroger/async-mqtt-client` | Async MQTT client | --- ## Adding a New Variant 1. Copy a `[env:vesper-*]` block in `vesper/platformio.ini` and uncomment it. 2. Set the correct `BOARD_TYPE`, `BOARD_VERSION`, `HAS_RF`, `HAS_LCD` flags. 3. Add the new `BoardType` value to `backend/manufacturing/models.py` (`BoardType` enum and `BOARD_TYPE_LABELS`). 4. Add the NVS gen path for the new `hw_type` in `backend/utils/nvs_generator.py` if needed. 5. Create the NGINX OTA directory on the VPS: `/srv/ota/{new_type}/stable/`. 6. Upload a firmware binary and update the firmware manager entry.