Files
project-vesper/platformio.ini
T
bonaminandClaude Sonnet 4.6 a4d071d5d5 feat: multi-board HAL guards, RFRemote subsystem, Player/OTA improvements
Multi-board variant support:
- variants/vesper.hpp: enable HAS_RF=1, define RF_RX_PIN=22
- variants/agnus.hpp: enable HAS_RF=1, RF_RX_PIN=22, correct HAS_RTC=0
- main.cpp, Player, HealthMonitor, OTAManager, ConfigManager: wrap all
  RTC/SD/RF-dependent code in #if HAS_RTC / HAS_SD_CARD / HAS_RF guards
  so Agnus builds cleanly without those peripherals

RFRemote subsystem (new):
- src/RFRemote/: RF receiver driver (GPIO RF_RX_PIN) + command handler
- Registered with HealthMonitor and CommunicationRouter when HAS_RF=1

Player improvements:
- uid -> pid rename throughout (Player, BuiltInMelodies, api-reference)
- loadMelodyInRAM() now returns bool
- playerControlTaskFn task added — defers stop/pause/resume out of
  timer callback (Tmr Svc) to avoid stack overflows
- setDependencies() accepts nullptr FileManager for SD-less boards

OTAManager:
- Consume download_url from server metadata response instead of
  constructing firmware path locally
- HTTP redirect following enabled (setFollowRedirects)
- HAS_RTC guards on TimeKeeper references

platformio.ini:
- Add rc-switch library for RF remote support
- Remove BOARD_TYPE/BOARD_NAME/BOARD_VERSION flags (moved to variant headers)
- MQTT_SECRET placeholders only — no secrets in source

Docs:
- docs/architecture/codebase-refactor-plan.md: new migration strategy doc
- docs/reference/api-reference.md: updated for pid, note_assignments, download_url
- Remove stale docs: ota-telemetry-api.md, platformio-commands.md, firmware-variants.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 17:02:01 +02:00

188 lines
8.8 KiB
INI

; ═══════════════════════════════════════════════════════════════════════════════
; Project Vesper — PlatformIO Configuration
; ═══════════════════════════════════════════════════════════════════════════════
;
; Hardware Variants (active):
; vesper-v1 — Kincony KC868-A6 (ESP32-D0WD-V3, 4MB flash) — current production board
; agnus-v1 — ESP32 base, no SD card, NVS-only settings storage
; agnus-mini-v1 — Same binary as agnus-v1, output limit enforced via app/NVS
;
; Future variants (commented out):
; vesper-plus-v1 — Vesper+ with RF remote support
; vesper-pro-v1 — Vesper Pro with onboard LCD
;
; Each environment auto-includes its variant header via -include variants/<name>.hpp
; which defines HAS_SD_CARD, HAS_RTC, OUTPUT_COUNT_MAX, etc. for that build.
;
; Build: pio run -e vesper-v1
; Upload: pio run -e vesper-v1 --target upload --upload-port COM8
; Monitor: pio device monitor
; Clean: pio run -e vesper-v1 --target clean
; ═══════════════════════════════════════════════════════════════════════════════
; ───────────────────────────────────────────────────────────────────────────────
; SHARED SETTINGS — inherited by all environments
; ───────────────────────────────────────────────────────────────────────────────
[common]
platform = espressif32
framework = arduino
monitor_speed = 115200
; All external library dependencies
lib_deps =
; WiFi provisioning portal
tzapu/WiFiManager @ ^2.0.17
; Async web server + WebSocket support
; NOTE: Use the ESP32-compatible fork, not the original
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/me-no-dev/AsyncTCP.git
; JSON parsing
bblanchon/ArduinoJson @ ^7.0.0
; I2C GPIO expanders (relay control) — PCF8575 header is bundled in same library
adafruit/Adafruit PCF8574 @ ^1.1.0
; Real-time clock
adafruit/RTClib @ ^2.1.4
; Async MQTT client
; NOTE: Requires AsyncTCP (already listed above)
https://github.com/marvinroger/async-mqtt-client.git
; RF remote receiver (433MHz, RCSwitch protocol)
sui77/rc-switch @ ^2.6.4
build_flags_common =
-std=gnu++14
-DCORE_DEBUG_LEVEL=0
-DCONFIG_ASYNC_TCP_RUNNING_CORE=0
; ───────────────────────────────────────────────────────────────────────────────
; VESPER v1 — Kincony KC868-A6 (ESP32-D0WD-V3, 4MB Flash)
; Current production board
; ───────────────────────────────────────────────────────────────────────────────
[env:vesper-v1]
platform = ${common.platform}
framework = ${common.framework}
board = esp32dev
; Serial monitor
monitor_speed = ${common.monitor_speed}
; Upload settings
upload_speed = 921600
upload_protocol = esptool
; Partition table — 4MB with OTA support, larger app slots
; min_spiffs.csv: ~1.8MB app + ~1.8MB OTA + 64KB NVS + 128KB SPIFFS
board_build.partitions = min_spiffs.csv
; Upgrade to C++14 so std::make_unique is available
build_unflags = -std=gnu++11
; FreeRTOS timer service task stack — default 2048 is too small when timer callbacks
; do LOG formatting, MQTT connect(), NTP sync, etc. Increase to 4096.
board_build.cmake_extra_args = -DCONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
; Build flags for this variant
; IMPORTANT: MQTT_SECRET must match the MQTT_SECRET in the backend .env file exactly.
; Do NOT commit the real secret value to git.
; To override locally without modifying this file, use a platformio.ini.local file:
; [env:vesper-v1]
; build_flags = ... -DMQTT_SECRET=\"your_actual_secret\"
build_flags =
${common.build_flags_common}
-DPSRAM_ENABLED=0
-DMQTT_SECRET=\"change-me-in-platformio-ini\"
-include variants/vesper.hpp
lib_deps = ${common.lib_deps}
; ───────────────────────────────────────────────────────────────────────────────
; AGNUS v1 — No SD card, NVS-only settings storage
; Same ESP32 base as Vesper. Agnus Mini is the same binary — output limiting
; is handled in the app and NVS, not in firmware.
; ───────────────────────────────────────────────────────────────────────────────
[env:agnus-v1]
platform = ${common.platform}
framework = ${common.framework}
board = esp32dev
monitor_speed = ${common.monitor_speed}
upload_speed = 921600
upload_protocol = esptool
board_build.partitions = min_spiffs.csv
build_unflags = -std=gnu++11
board_build.cmake_extra_args = -DCONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
build_flags =
${common.build_flags_common}
-DPSRAM_ENABLED=0
-DMQTT_SECRET=\"change-me-in-platformio-ini\"
-include variants/agnus.hpp
lib_deps = ${common.lib_deps}
; ───────────────────────────────────────────────────────────────────────────────
; AGNUS MINI v1 — Same binary as agnus-v1, different NVS provisioning
; Output count is limited via the app and NVS key, not in firmware.
; Only exists as a separate env so OTA can target it independently.
; ───────────────────────────────────────────────────────────────────────────────
[env:agnus-mini-v1]
platform = ${common.platform}
framework = ${common.framework}
board = esp32dev
monitor_speed = ${common.monitor_speed}
upload_speed = 921600
upload_protocol = esptool
board_build.partitions = min_spiffs.csv
build_unflags = -std=gnu++11
board_build.cmake_extra_args = -DCONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
build_flags =
${common.build_flags_common}
-DPSRAM_ENABLED=0
-DMQTT_SECRET=\"change-me-in-platformio-ini\"
-include variants/agnus.hpp
lib_deps = ${common.lib_deps}
; ───────────────────────────────────────────────────────────────────────────────
; VESPER+ v1 — Future: adds RF remote support
; ───────────────────────────────────────────────────────────────────────────────
; [env:vesper-plus-v1]
; platform = ${common.platform}
; framework = ${common.framework}
; board = esp32dev
; monitor_speed = ${common.monitor_speed}
; build_flags =
; ${common.build_flags_common}
; -DPSRAM_ENABLED=0
; -DMQTT_SECRET=\"change-me-in-platformio-ini\"
; -include variants/vesper.hpp
; lib_deps = ${common.lib_deps}
; ───────────────────────────────────────────────────────────────────────────────
; VESPER PRO v1 — Future: adds onboard LCD
; ───────────────────────────────────────────────────────────────────────────────
; [env:vesper-pro-v1]
; platform = ${common.platform}
; framework = ${common.framework}
; board = esp32dev
; monitor_speed = ${common.monitor_speed}
; build_flags =
; ${common.build_flags_common}
; -DPSRAM_ENABLED=0
; -DMQTT_SECRET=\"change-me-in-platformio-ini\"
; -include variants/vesper.hpp
; lib_deps = ${common.lib_deps}