st-4-esp32/test/mocks/mock_state.cpp
Ryan Malloy 71e5484507 Add native tests, ASCOM Alpaca API, and README
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.
2026-02-18 13:40:34 -07:00

31 lines
698 B
C++

// Mock state implementation
#include "mock_state.h"
#include "Arduino.h"
namespace MockState {
int64_t mockTimeMicros = 0;
std::map<int, int> gpioStates;
std::map<int, int> gpioModes;
std::string serialInput;
std::string serialOutput;
void reset() {
mockTimeMicros = 0;
gpioStates.clear();
gpioModes.clear();
serialInput.clear();
serialOutput.clear();
}
void advanceTime(int64_t microseconds) {
mockTimeMicros += microseconds;
}
void setSerialInput(const std::string& input) {
serialInput = input;
}
}
// Global Serial instance definition
HardwareSerial Serial;