- Fix lock hierarchy: stopAll() cancels pulse before touching axes - Add configASSERT bounds checks on axis index in move/pulseGuide - Enforce ST4Pulse singleton with configASSERT - Check esp_timer_start_once return, rollback hardware on failure - Validate SYNC coordinates (reject garbage → silent 0.0) - Discard truncated serial commands on buffer overflow - Guard WiFi update()/broadcastState() against null ws_ pointer - Report connection errors to WebSocket clients on move/pulse - Remove redundant Serial.begin() from pulse_guide example
30 lines
804 B
C++
30 lines
804 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_;
|
|
bool bufferOverflow_;
|
|
|
|
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();
|
|
};
|