diff --git a/drivers.xml b/drivers.xml index ad21d2449c..2498b6e59b 100644 --- a/drivers.xml +++ b/drivers.xml @@ -95,7 +95,7 @@ indi_paramount_telescope - 0.1 + 1.0 indi_rainbow_telescope diff --git a/drivers/telescope/paramount.cpp b/drivers/telescope/paramount.cpp index 44ae7b8a5a..1d12d433a3 100644 --- a/drivers/telescope/paramount.cpp +++ b/drivers/telescope/paramount.cpp @@ -102,11 +102,13 @@ void ISSnoopDevice(XMLEle *root) Paramount::Paramount() { + setVersion(1, 0); + DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE"); SetTelescopeCapability(TELESCOPE_CAN_PARK | TELESCOPE_CAN_SYNC | TELESCOPE_CAN_GOTO | TELESCOPE_CAN_ABORT | TELESCOPE_HAS_TIME | TELESCOPE_HAS_LOCATION | TELESCOPE_HAS_TRACK_MODE | TELESCOPE_HAS_TRACK_RATE | - TELESCOPE_CAN_CONTROL_TRACK, + TELESCOPE_CAN_CONTROL_TRACK | TELESCOPE_HAS_PIER_SIDE, 9); setTelescopeConnection(CONNECTION_TCP); } @@ -361,6 +363,45 @@ bool Paramount::getMountRADE() return false; } +INDI::Telescope::TelescopePierSide Paramount::getPierSide() +{ + int rc = 0, nbytes_written = 0, nbytes_read = 0; + char pCMD[MAXRBUF] = {0}, pRES[MAXRBUF] = {0}; + + //"if (sky6RASCOMTele.IsConnected==0) sky6RASCOMTele.Connect();" + strncpy(pCMD, + "/* Java Script */" + "var Out;" + "sky6RASCOMTele.DoCommand(11, \"Pier Side\");" + "Out = sky6RASCOMTele.DoCommandOutput", + MAXRBUF); + + LOGF_DEBUG("CMD: %s", pCMD); + + if ((rc = tty_write_string(PortFD, pCMD, &nbytes_written)) != TTY_OK) + { + LOG_ERROR("Error writing to TheSky6 TCP server."); + return PIER_UNKNOWN; + } + + // Should we read until we encounter string terminator? or what? + if (static_cast(rc == tty_read_section(PortFD, pRES, '\0', PARAMOUNT_TIMEOUT, &nbytes_read)) != TTY_OK) + { + LOG_ERROR("Error reading from TheSky6 TCP server."); + return PIER_UNKNOWN; + } + + LOGF_DEBUG("RES: %s", pRES); + + std::regex rgx(R"((\d+)\|(.+)\. Error = (\d+)\.)"); + std::smatch match; + std::string input(pRES); + if (std::regex_search(input, match, rgx)) + return std::stoi(match.str(1)) == 0 ? PIER_WEST : PIER_EAST; + + return PIER_UNKNOWN; +} + bool Paramount::ReadScopeStatus() { if (isSimulation()) @@ -408,6 +449,8 @@ bool Paramount::ReadScopeStatus() DEBUGF(DBG_SCOPE, "Current RA: %s Current DEC: %s", RAStr, DecStr); + setPierSide(getPierSide()); + NewRaDec(currentRA, currentDEC); return true; } diff --git a/drivers/telescope/paramount.h b/drivers/telescope/paramount.h index 7a62cbce72..9241d94764 100644 --- a/drivers/telescope/paramount.h +++ b/drivers/telescope/paramount.h @@ -80,6 +80,7 @@ class Paramount : public INDI::Telescope, public INDI::GuiderInterface bool startOpenLoopMotion(uint8_t motion, uint16_t rate); bool stopOpenLoopMotion(); bool setTheSkyTracking(bool enable, bool isSidereal, double raRate, double deRate); + INDI::Telescope::TelescopePierSide getPierSide(); // Homing bool findHome();