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.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
// ST4Pulse stub for native testing
|
|
// Replaces the real ST4Pulse which uses esp_timer callbacks and FreeRTOS tasks
|
|
#include "ST4Pulse.h"
|
|
|
|
ST4Pulse* ST4Pulse::instance_ = nullptr;
|
|
|
|
ST4Pulse::ST4Pulse()
|
|
: timer_(nullptr), pulseDoneSem_(nullptr), mutex_(nullptr),
|
|
pulseTaskHandle_(nullptr), activeAxis_(nullptr), activeTracker_(nullptr),
|
|
active_(false), shutdown_(false) {}
|
|
|
|
ST4Pulse::~ST4Pulse() { instance_ = nullptr; }
|
|
|
|
void ST4Pulse::begin() { instance_ = this; }
|
|
|
|
bool ST4Pulse::pulse(ST4Axis& axis, ST4Tracker& tracker,
|
|
ST4Direction dir, double slewRate, uint32_t ms) {
|
|
if (dir == ST4Direction::STOP || ms == 0) return false;
|
|
active_ = true;
|
|
activeAxis_ = &axis;
|
|
activeTracker_ = &tracker;
|
|
axis.move(dir);
|
|
tracker.start(slewRate);
|
|
// Stub: immediately complete the pulse
|
|
axis.stop();
|
|
tracker.stop();
|
|
active_ = false;
|
|
return true;
|
|
}
|
|
|
|
bool ST4Pulse::isActive() const { return active_; }
|
|
|
|
void ST4Pulse::cancel() {
|
|
if (activeAxis_) activeAxis_->stop();
|
|
if (activeTracker_) activeTracker_->stop();
|
|
active_ = false;
|
|
activeAxis_ = nullptr;
|
|
activeTracker_ = nullptr;
|
|
}
|
|
|
|
void ST4Pulse::cancelLocked() { cancel(); }
|
|
void ST4Pulse::timerCallback(void*) {}
|
|
void ST4Pulse::pulseTaskFunc(void*) {}
|