Files
project-vesper/variants/bespoke_rs485.hpp
bonaminandClaude Sonnet 4.6 ed1123283b feat: boot-phase OTA, RS485 variant, async melody download, HAL guards
- bootOtaCheck() runs at top of setup() before any task/timer; streams
  firmware to flash on update, reboots, otherwise returns immediately
- New bespoke-rs485-v1 build env + Rs485OutputManager for Waveshare 16CH
  Modbus RTU relay; vesper.hpp renamed vesper-std.hpp, env renamed accordingly
- Player: permanent melodyDownloadTaskFn task; fast path (built-in/SD) before
  async download; uid accepted as alias for pid
- CommunicationRouter: HAS_UART guards throughout so UART transport compiles
  out when Serial2 is claimed by Modbus
- OTAManager: stack 8KB→16KB, pinned to Core 1, HTTPClient recreated per
  retry, download timeout 30s→60s
- FileManager: heap guard before SSL alloc; watchdog log cleanup
- ConfigManager: OTA fallback URLs http (no TLS for firmware servers)
- agnus.hpp: HAS_UART 1 added
- provisioning/nvs_agnus_lab_device.csv added
- Version bumped to v2.0.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:48:26 +03:00

59 lines
4.1 KiB
C++

// ═══════════════════════════════════════════════════════════════════════════════
// variants/bespoke_rs485.hpp — Hardware capability definitions for the
// Waveshare 16CH RS485 relay addon build
// ═══════════════════════════════════════════════════════════════════════════════
//
// This file is auto-included for [env:bespoke-rs485-v1] builds via platformio.ini.
// DO NOT include manually.
//
// Hardware: Kincony KC868-A6 (same base board as Vesper) +
// Waveshare Modbus RTU Relay 16CH connected via KC868-A6's RS485 port.
//
// The internal PCF8574 relays on the KC868-A6 are NOT used in this build.
// All 16 outputs are driven via RS485/Modbus through Rs485OutputManager.
//
// RS485 port on KC868-A6:
// UART2 TX → GPIO27
// UART2 RX → GPIO14
// Transceiver: MAX13487EESA (auto-direction, no DE/RE pin needed)
//
// Waveshare board:
// Default slave address : 0x01
// Operating baud rate : 115200 (upgraded from 9600 on first boot, persisted)
// ═══════════════════════════════════════════════════════════════════════════════
#pragma once
// ── Identity ─────────────────────────────────────────────────────────────────
#define HW_FAMILY "vesper" // Same family as Vesper — uses same OTA channel
// Backend differentiates via NVS hw_type (set at provisioning)
// ── Storage ──────────────────────────────────────────────────────────────────
#define HAS_SD_CARD 1 // SD card present — configs stored on SD
#define HAS_SPIFFS 0
// ── Connectivity ─────────────────────────────────────────────────────────────
#define HAS_ETHERNET 0
#define HAS_RF 0 // No RF on this build (GPIO22 is free but not used)
#define HAS_LCD 0
// ── Output hardware ──────────────────────────────────────────────────────────
#define HAS_PCF8574 0 // Internal PCF8574 relays NOT used in this build
#define FEATURE_RS485 1 // Waveshare 16CH RS485 relay board
#define OUTPUT_COUNT_MAX 16 // 16 outputs via Waveshare board
// RS485 / Modbus configuration
#define RS485_TX_PIN 27 // KC868-A6 UART2 TX
#define RS485_RX_PIN 14 // KC868-A6 UART2 RX
#define RS485_BAUD 115200 // Operating baud (board is upgraded to this on boot)
#define RS485_MODBUS_ADDR 0x01 // Waveshare slave address (factory default)
// ── UART command transport ────────────────────────────────────────────────────
// DISABLED: UART2 (Serial2) is claimed by Rs485OutputManager for Modbus RTU.
// UARTDriver uses the same peripheral (Serial2, GPIO12/13 by default but same
// HardwareSerial instance), which conflicts with RS485 on GPIO27/14.
#define HAS_UART 0
// ── RTC ──────────────────────────────────────────────────────────────────────
#define HAS_RTC 1 // DS3231 RTC present (same base board)