From addc63715db2a8c8084af1a05582882e5a50deeb Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Mon, 17 Oct 2022 15:26:28 +0200 Subject: [PATCH] Implement abortSlew command in LX200 --- .../src/Lx200/Lx200Connection.cpp | 15 +++++++++++++++ .../src/Lx200/Lx200Connection.hpp | 2 ++ .../src/Lx200/TelescopeClientDirectLx200.cpp | 7 +++++++ .../src/Lx200/TelescopeClientDirectLx200.hpp | 1 + 4 files changed, 25 insertions(+) diff --git a/plugins/TelescopeControl/src/Lx200/Lx200Connection.cpp b/plugins/TelescopeControl/src/Lx200/Lx200Connection.cpp index 846b9884054dd..ef29d28177740 100644 --- a/plugins/TelescopeControl/src/Lx200/Lx200Connection.cpp +++ b/plugins/TelescopeControl/src/Lx200/Lx200Connection.cpp @@ -350,3 +350,18 @@ void Lx200Connection::sendCommand(Lx200Command *command) } } +void Lx200Connection::sendAbort() +{ + #ifdef DEBUG4 + *log_file << Now() + << "Lx200Connection::sendAbort()" + << StelUtils::getEndLineChar(); + #endif + command_list.clear(); + read_buff_end = read_buff; + write_buff_end = write_buff; + command_list.push_back(new Lx200CommandStopSlew(server)); + flushCommandList(); + //*log_file << Now() << "Lx200Connection::sendAbort() end" + // << StelUtils::getEndLineChar(); +} diff --git a/plugins/TelescopeControl/src/Lx200/Lx200Connection.hpp b/plugins/TelescopeControl/src/Lx200/Lx200Connection.hpp index 5dc8a9711de06..837fe6e154438 100644 --- a/plugins/TelescopeControl/src/Lx200/Lx200Connection.hpp +++ b/plugins/TelescopeControl/src/Lx200/Lx200Connection.hpp @@ -39,6 +39,8 @@ class Lx200Connection : public SerialPort void sendGoto(unsigned int ra_int, int dec_int); void sendSync(unsigned int ra_int, int dec_int); void sendCommand(Lx200Command * command); + //! Delete pending commands and send abort signal. + void sendAbort(); void setTimeBetweenCommands(long long int micro_seconds) { time_between_commands = micro_seconds; diff --git a/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.cpp b/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.cpp index 10d3f1ad1aa06..2d7b438d6bafe 100644 --- a/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.cpp +++ b/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.cpp @@ -151,6 +151,13 @@ void TelescopeClientDirectLx200::telescopeSync(const Vec3d &j2000Pos, StelObject syncReceived(ra_int, dec_int); } +void TelescopeClientDirectLx200::telescopeAbortSlew() +{ + if (!isConnected()) + return; + lx200->sendAbort(); +} + void TelescopeClientDirectLx200::gotoReceived(unsigned int ra_int, int dec_int) { lx200->sendGoto(ra_int, dec_int); diff --git a/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.hpp b/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.hpp index 7963dad64e648..6909e04215e53 100644 --- a/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.hpp +++ b/plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.hpp @@ -71,6 +71,7 @@ class TelescopeClientDirectLx200 : public TelescopeClient, public Server void performCommunication() override; void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject) override; void telescopeSync(const Vec3d &j2000Pos, StelObjectP selectObject) override; + void telescopeAbortSlew() override; bool isInitialized(void) const override; //======================================================================