Native test suite (61 tests, 5 suites) with thin mock layer for Arduino/FreeRTOS/esp_timer enabling host-side testing without hardware. ASCOM Alpaca REST API on port 32323 with UDP discovery, implementing Telescope v3 interface for N.I.N.A., PHD2, and compatible software. Follows existing ST4WiFi conditional compilation pattern. README documents wiring, all three protocols (serial, WebSocket, Alpaca), pin/rate configuration, and build instructions.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
// ST4-ESP32 ASCOM Alpaca Server Example
|
|
// Combines serial control with ASCOM Alpaca REST API
|
|
// Any ASCOM-compatible software (N.I.N.A., PHD2, etc.) can connect
|
|
//
|
|
// Configure WiFi credentials below, then flash to ESP32.
|
|
// The device will appear on your network as an Alpaca telescope.
|
|
|
|
#ifndef ST4_ALPACA_ENABLED
|
|
#define ST4_ALPACA_ENABLED
|
|
#endif
|
|
#include <ST4.h>
|
|
|
|
ST4Controller controller;
|
|
ST4Serial serial;
|
|
ST4Alpaca alpaca;
|
|
|
|
// WiFi credentials
|
|
const char* WIFI_SSID = "YOUR_WIFI_SSID";
|
|
const char* WIFI_PASS = "YOUR_WIFI_PASS";
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
Serial.println("ST4 Alpaca Server");
|
|
|
|
controller.begin(
|
|
ST4_PIN_RA_PLUS, ST4_PIN_RA_MINUS,
|
|
ST4_PIN_DEC_PLUS, ST4_PIN_DEC_MINUS,
|
|
ST4_PIN_LED
|
|
);
|
|
|
|
serial.begin(controller, Serial);
|
|
|
|
// Connect to WiFi (required for Alpaca)
|
|
WiFi.begin(WIFI_SSID, WIFI_PASS);
|
|
Serial.print("Connecting to WiFi");
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
delay(500);
|
|
Serial.print(".");
|
|
}
|
|
Serial.println();
|
|
Serial.print("IP: ");
|
|
Serial.println(WiFi.localIP());
|
|
|
|
// Start Alpaca server (default port 32323, discovery on 32227)
|
|
alpaca.begin(controller);
|
|
Serial.println("Alpaca server started on port 32323");
|
|
Serial.println("Discovery broadcast on port 32227");
|
|
}
|
|
|
|
void loop() {
|
|
serial.update();
|
|
alpaca.update();
|
|
}
|