Initial release v1.1.0 — ESP32 automated telescope flat panel

Firmware (Arduino Nano ESP32 / PlatformIO):
- Native ASCOM Alpaca CoverCalibrator REST API on port 11111
- Alnitak serial protocol on USB at 9600 baud (simultaneous with WiFi)
- MG995 servo cover mechanism with non-blocking state machine (D9)
- LED brightness PWM via IRLZ44N MOSFET, LEDC channel 0 (D3)
- 12V dew heater PWM via IRLZ44N MOSFET, LEDC channel 1 (D5)
- mDNS + UDP Alpaca discovery, WiFi watchdog reconnect
- SERIAL_DEBUG flag to silence debug output in USB-only mode

INDI driver (C++ / libcurl / nlohmann-json):
- WiFi mode: HTTP Alpaca via libcurl
- USB mode: Alnitak serial via POSIX termios
- LightBoxInterface + DustCapInterface + dew heater number property

Python controller (PyQt6):
- Dark-themed desktop app for direct manual control
- AlpacaBackend (requests) + AlnitakBackend (pyserial)
- PollWorker QThread; cover, brightness, dew heater panels
- QSettings persistence; auto serial port discovery

Docs:
- system-diagram.svg, wiring-diagram.svg (browser-renderable SVG)
- BUILD_NOTES.md with BOM, LM2596 calibration, power-on checklist
- WIRING.md quick-reference, README.md, CHANGELOG.md
This commit is contained in:
Laurence 2026-05-17 08:51:29 +01:00
commit c32f00a2be
15 changed files with 3653 additions and 0 deletions

101
CHANGELOG.md Normal file
View file

@ -0,0 +1,101 @@
# Changelog
All notable changes to this project are documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
---
## [1.1.0] — 2026-05-17
### Added
#### Dew heater
- 12V PWM-controlled dew heater output on **D5** via a second IRLZ44N MOSFET
- `applyDewHeater(int pct)` firmware function maps 0100% to 8-bit LEDC PWM
- Non-standard Alpaca GET/PUT endpoint `dewheater` for direct polling and control by the Python app and INDI driver
- Dew heater exposed as `SupportedActions` entries `SetDewHeater` / `GetDewHeater` for full Alpaca Action compatibility
- Custom Alnitak extension commands: `>T` (set percent) / `>U` (get percent)
- Dew heater number property in the INDI driver (`MAIN_CONTROL_TAB`)
- Dew heater slider + On/Off buttons in the Python controller
#### USB / Alnitak serial mode
- Full implementation of the **Alnitak Flip-Flat serial protocol** on the ESP32 USB CDC port (9600 baud)
- Supports all standard Alnitak commands: `P` ping, `S` state, `B`/`J` brightness set/get, `L`/`D` light on/off, `O`/`C`/`H` cover open/close/halt
- Compatible with N.I.N.A., Sequence Generator Pro, Astro Photography Tool, and INDI `indi_flipflat` out of the box — no additional driver required
- `SERIAL_DEBUG` compile flag in `config.h`: set `false` to silence all debug output and use the serial line exclusively for the Alnitak protocol
- Serial baud rate set to **9600** to match all consumer Alnitak software defaults
#### Python desktop controller (`controller/flatpanel_controller.py`)
- Dark-themed PyQt6 application suitable for night-time observatory use
- Supports both WiFi/Alpaca and USB/Alnitak connection modes selectable at runtime
- `AlpacaBackend` — HTTP via `requests.Session`, full Alpaca property access including custom `dewheater` endpoint
- `AlnitakBackend``pyserial` serial communication with timeout handling and response validation
- `PollWorker``QThread` subclass polling device state every 1 second without blocking the GUI
- Cover panel: status dot (colour-coded by state), Open / Close / Halt buttons
- Flat panel: brightness slider linked bidirectionally to a spinbox, Light On/Off
- Dew heater panel: power slider (0100%), Heater On/Off, live % status indicator
- Scrolling, timestamped log panel (500-line cap)
- `QSettings` persistence for connection mode, host, port, serial port, last brightness, last dew %
- Auto-discovery of available serial ports with refresh button
- `requirements.txt` added: `PyQt6`, `requests`, `pyserial`
#### INDI driver enhancements
- **USB serial mode** added alongside existing WiFi/Alpaca mode; switchable via a `Connection Mode` switch property in the driver UI
- Serial port text property (`/dev/ttyUSB0` default) shown when USB mode is selected
- POSIX serial port implementation using `termios` / `select` with 2-second read timeout
- Alnitak helper methods: `openSerial`, `closeSerial`, `sendAlnitak`, `alnitakGetBrightness`, `alnitakSetBrightness`, `alnitakGetCoverState`, `alnitakGetDewPercent`, `alnitakSetDewPercent`
- `DewHeaterNP` number property (`0100%`, step 5) exposed in `MAIN_CONTROL_TAB`
- Dew heater control routes through Alpaca `dewheater` PUT (WiFi) or custom Alnitak `>T` (USB)
#### Documentation
- `docs/system-diagram.svg` — architecture block diagram (800×520, browser-renderable SVG)
- `docs/wiring-diagram.svg` — colour-coded component wiring diagram (960×640, browser-renderable SVG), includes build-order warning panel and legend
- `docs/BUILD_NOTES.md` — full step-by-step assembly guide with BOM, dew heater sizing table, LM2596 calibration procedure, MOSFET wiring, 7-step first power-on checklist, software setup for all platforms, and troubleshooting table
### Changed
- `Serial.begin()` baud rate changed from `115200` to **9600** to match Alnitak software defaults (USB CDC baud rate is virtual and has no real-world effect, but driver compatibility requires this)
- `supportedactions` endpoint now returns `["SetDewHeater", "GetDewHeater"]` instead of an empty array
- `description` endpoint updated to mention dew heater
- `driverversion` bumped to `1.1.0`
- WIRING.md updated: second MOSFET added to wiring diagram, dew heater element sizing table, USB/WiFi mode comparison table, pin summary table, PSU rating increased from ≥3A to **≥4A**
### Fixed
- Cover `haltcover` Alpaca route now correctly reads current servo position via `coverServo.read()` before holding, preventing a potential servo jitter on halt
---
## [1.0.0] — 2026-05-17
Initial release.
### Added
#### Firmware
- ASCOM Alpaca `CoverCalibrator` device type implemented natively on the ESP32 (no PC-side COM driver needed)
- All standard `CoverCalibrator` properties and methods:
- GET: `coverstate`, `calibratorstate`, `brightness`, `maxbrightness`, `connected`, `name`, `description`, `driverinfo`, `driverversion`, `interfaceversion`, `supportedactions`
- PUT: `connected`, `calibratoron` (with `Brightness` parameter), `calibratoroff`, `opencover`, `closecover`, `haltcover`
- MG995 servo cover mechanism on D9; non-blocking state machine with configurable movement timeout (`COVER_MOVE_TIMEOUT_MS`)
- 8-bit LED brightness PWM on D3 via LEDC channel 0 (5kHz, above visible flicker)
- WiFi connection with 30-second boot timeout and 10-second watchdog reconnect loop
- mDNS advertising as `esp32-flatpanel.local` with `_alpaca._tcp` service record
- Alpaca UDP discovery on port 32227 — responds to `alpacadiscovery1` broadcasts with `{"AlpacaPort":11111}`
- `config.h` with all user-configurable settings in one place
#### INDI driver (WiFi / Alpaca mode)
- `INDI::DefaultDevice` + `INDI::LightBoxInterface` + `INDI::DustCapInterface`
- `AlpacaBackend` using `libcurl` for HTTP, `nlohmann/json` for response parsing
- 1-second state polling via `TimerHit()`
- `LightBoxInterface`: `SetLightBoxBrightness()`, `EnableLightBox()` wired to Alpaca `calibratoron`/`calibratoroff`
- `DustCapInterface`: `ParkCap()``closecover`, `UnParkCap()``opencover`
- Host / port text properties in `CONNECTION_TAB`
- INDI device XML descriptor for indiserver auto-registration
- `CMakeLists.txt` with `FetchContent` fallback for `nlohmann_json`
#### Documentation
- `WIRING.md` — wiring diagram, BOM, component roles, MOSFET pinout, servo colour codes, ASCOM and INDI setup instructions
---
[1.1.0]: https://github.com/your-repo/flatpanel/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/your-repo/flatpanel/releases/tag/v1.0.0