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:
commit
c32f00a2be
15 changed files with 3653 additions and 0 deletions
88
indi-driver/indi_esp32_flatpanel.h
Normal file
88
indi-driver/indi_esp32_flatpanel.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#pragma once
|
||||
|
||||
#include <libindi/defaultdevice.h>
|
||||
#include <libindi/indilightboxinterface.h>
|
||||
#include <libindi/indidustcapinterface.h>
|
||||
#include <curl/curl.h>
|
||||
#include <string>
|
||||
|
||||
class ESP32FlatPanel : public INDI::DefaultDevice,
|
||||
public INDI::LightBoxInterface,
|
||||
public INDI::DustCapInterface
|
||||
{
|
||||
public:
|
||||
ESP32FlatPanel();
|
||||
~ESP32FlatPanel() override;
|
||||
|
||||
// DefaultDevice
|
||||
const char* getDefaultName() override;
|
||||
bool initProperties() override;
|
||||
bool updateProperties() override;
|
||||
bool Connect() override;
|
||||
bool Disconnect() override;
|
||||
void TimerHit() override;
|
||||
|
||||
bool ISNewText (const char* dev, const char* name, char* texts[], char* names[], int n) override;
|
||||
bool ISNewSwitch(const char* dev, const char* name, ISState* states, char* names[], int n) override;
|
||||
bool ISNewNumber(const char* dev, const char* name, double values[], char* names[], int n) override;
|
||||
bool ISSnoopDevice(XMLEle* root) override;
|
||||
|
||||
// LightBoxInterface
|
||||
bool SetLightBoxBrightness(uint16_t value) override;
|
||||
bool EnableLightBox(bool enable) override;
|
||||
|
||||
// DustCapInterface
|
||||
IPState ParkCap() override;
|
||||
IPState UnParkCap() override;
|
||||
|
||||
private:
|
||||
// ---- Connection mode switch ------------------------------------------
|
||||
enum ConnMode { CONN_WIFI, CONN_USB };
|
||||
ConnMode m_connMode { CONN_WIFI };
|
||||
|
||||
ISwitch ConnModeS[2]{};
|
||||
ISwitchVectorProperty ConnModeSP;
|
||||
|
||||
// ---- WiFi / Alpaca settings ------------------------------------------
|
||||
IText HostT[2]{};
|
||||
ITextVectorProperty HostTP;
|
||||
|
||||
std::string m_host {"esp32-flatpanel.local"};
|
||||
int m_port {11111};
|
||||
uint32_t m_clientID {1};
|
||||
uint32_t m_txID {0};
|
||||
|
||||
// ---- USB / Alnitak settings ------------------------------------------
|
||||
IText SerialPortT[1]{};
|
||||
ITextVectorProperty SerialPortTP;
|
||||
|
||||
int m_serialFd {-1};
|
||||
|
||||
// ---- Dew heater property --------------------------------------------
|
||||
INumber DewHeaterN[1]{};
|
||||
INumberVectorProperty DewHeaterNP;
|
||||
|
||||
// ---- CURL / HTTP helpers (WiFi mode) --------------------------------
|
||||
static size_t writeCallback(void* ptr, size_t size, size_t nmemb, std::string* out);
|
||||
std::string httpGet(const std::string& endpoint);
|
||||
bool httpPut(const std::string& endpoint, const std::string& body);
|
||||
std::string alpacaURL(const std::string& endpoint) const;
|
||||
std::string commonPutBody();
|
||||
int alpacaGetInt (const std::string& endpoint, int defaultVal = 0);
|
||||
bool alpacaGetBool(const std::string& endpoint, bool defaultVal = false);
|
||||
bool alpacaPutVoid(const std::string& endpoint, const std::string& extraBody = "");
|
||||
|
||||
// ---- Alnitak serial helpers (USB mode) ------------------------------
|
||||
bool openSerial(const std::string& device);
|
||||
void closeSerial();
|
||||
std::string sendAlnitak(const std::string& cmd);
|
||||
int alnitakGetBrightness();
|
||||
bool alnitakSetBrightness(int b);
|
||||
int alnitakGetCoverState(); // returns Alpaca CoverStatus int
|
||||
int alnitakGetDewPercent();
|
||||
bool alnitakSetDewPercent(int pct);
|
||||
|
||||
// ---- Common helpers -------------------------------------------------
|
||||
void setDewHeater(int pct);
|
||||
void pollState();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue