st-4-esp32/include/ST4Tracker.h
Ryan Malloy 4c91fd4811 ESP32 ST-4 autoguider library with thread-safe pulse guiding
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.
2026-02-17 19:46:03 -07:00

32 lines
698 B
C++

// SPDX-License-Identifier: LGPL-3.0-or-later
// ST4-ESP32: Dead-reckoning position tracker
// Port of ASCOM AxisMovementTracker.cs using esp_timer microsecond precision
#pragma once
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include "ST4Types.h"
class ST4Tracker {
double position_;
double slewRate_;
int64_t startTime_;
mutable SemaphoreHandle_t mutex_;
double calculateDelta() const;
public:
ST4Tracker();
~ST4Tracker();
void begin();
void start(double slewRate);
void stop();
double position() const;
void setPosition(double pos);
double slewRate() const;
bool isMoving() const;
};