Port of arduino-st4 (Kevin Ferrare) to ESP32/PlatformIO with: - FreeRTOS mutex protection at every layer (Pin, Axis, Pulse, Controller) - Hardware timer pulse guiding with ISR-safe deferred stop pattern - Backward-compatible serial protocol (57600 baud, #-terminated) - Extended commands: PULSE, POS?, SYNC, STATUS?, VERSION? - Optional WiFi/WebSocket control (gated by ST4_WIFI_ENABLED) - Dead-reckoning position tracker using esp_timer microsecond precision All 4 examples build clean against esp32dev target.
29 lines
777 B
C++
29 lines
777 B
C++
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
// ST4-ESP32: Serial protocol handler (ASCOM/INDI compatible)
|
|
// Drop-in replacement for original ArduinoCode.ino serial protocol
|
|
// Extended mode adds PULSE, POS?, SYNC, STATUS?, VERSION?
|
|
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include "ST4Controller.h"
|
|
|
|
class ST4Serial {
|
|
ST4Controller* controller_;
|
|
HardwareSerial* serial_;
|
|
String buffer_;
|
|
bool extendedMode_;
|
|
|
|
void processCommand(const String& cmd);
|
|
void processExtendedCommand(const String& cmd);
|
|
String directionStr(ST4Direction dir) const;
|
|
|
|
public:
|
|
ST4Serial();
|
|
|
|
void begin(ST4Controller& controller,
|
|
HardwareSerial& serial = Serial,
|
|
bool extendedMode = true);
|
|
void update();
|
|
};
|