Files
project-vesper/docs/reference/firmware-variants.md
T
bonaminandClaude Sonnet 4.6 d4bd990e53 feat: semver versioning, FastAPI OTA integration, health alerts via MQTT
- Version.hpp: extract FW_VERSION from main.cpp into shared header
- OTAManager: replace uint16_t version with SemVer struct; update API URLs
  to new FastAPI backend (/api/firmware/{hw_type}/{channel}/latest);
  add postDownloadTelemetry() and postFlashTelemetry() for fleet visibility
- ConfigManager: remove fwVersion from DeviceConfig (always read from
  FW_VERSION constant); saveDeviceConfig/loadDeviceConfig are now no-ops;
  fallbackServerUrl replaced with fallbackServerUrls[2] array
- HealthMonitor: add AlertCallback + setAlertCallback() firing on state
  transitions (including CLEARED on recovery)
- CommunicationRouter: wire HealthMonitor alert callback on begin();
  add publishAlert() and publishInfo() for MQTT status topics
- MQTTDriver: add _alertsTopic + _infoTopic; add publishDirect() for
  absolute topic publishing; migrate heartbeat to JsonDocument
- ResponseBuilder, ClientManager, BellEngine: StaticJsonDocument /
  DynamicJsonDocument → JsonDocument; remove dead notifyBellsFired()
- docs: reorganise into architecture/, dev/, features/, reference/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 22:15:27 +02:00

4.3 KiB

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:

# From repo root
pio run -e vesper-v1
# Output: vesper/.pio/build/vesper-v1/firmware.bin

Full erase + upload:

pio run -e vesper-v1 --target upload --upload-port COM8

Flash NVS after full upload (NVS is wiped by full erase — must reflash separately):

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:

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:

-DBOARD_TYPE="VS"
-DBOARD_VERSION="01"
-DBOARD_NAME="Vesper"
-DPSRAM_ENABLED=0
-DHAS_RF=0
-DHAS_LCD=0
-DMQTT_SECRET="<set-locally-not-committed>"

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):

[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:

pio run -e vesper-plus-v1 --target upload --upload-port <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:

pio run -e vesper-pro-v1 --target upload --upload-port <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.