Skip to content

Commit

Permalink
Add preliminary support to inquire pier side for Paramount. Not teste…
Browse files Browse the repository at this point in the history
…d yet
  • Loading branch information
knro committed Feb 7, 2021
1 parent ef4e73f commit 0b670b1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers.xml
Expand Up @@ -95,7 +95,7 @@
</device>
<device label="Paramount" manufacturer="Software Bisque">
<driver name="Paramount">indi_paramount_telescope</driver>
<version>0.1</version>
<version>1.0</version>
</device>
<device label="Rainbow RST-135" manufacturer="Rainbow Astro">
<driver name="Rainbow">indi_rainbow_telescope</driver>
Expand Down
45 changes: 44 additions & 1 deletion drivers/telescope/paramount.cpp
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<int>(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())
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/telescope/paramount.h
Expand Up @@ -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();
Expand Down

0 comments on commit 0b670b1

Please sign in to comment.