Skip to content

Commit

Permalink
Add support to report pier side. Needs testing #1932
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Sep 12, 2023
1 parent b640316 commit d3f78b4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions drivers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@
</device>
<device label="Rainbow RST-135" manufacturer="Rainbow Astro">
<driver name="Rainbow">indi_rainbow_telescope</driver>
<version>1.1</version>
<version>1.3</version>
</device>
<device label="Rainbow RST-300" manufacturer="Rainbow Astro">
<driver name="Rainbow">indi_rainbow_telescope</driver>
<version>1.1</version>
<version>1.3</version>
</device>
<device label="CRUX TitanTCS" manufacturer="HOBYM">
<driver name="CRUX TitanTCS">indi_crux_mount</driver>
Expand Down
37 changes: 34 additions & 3 deletions drivers/telescope/rainbow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static std::unique_ptr<Rainbow> scope(new Rainbow());

Rainbow::Rainbow() : INDI::Telescope ()
{
setVersion(1, 2);
setVersion(1, 3);

SetTelescopeCapability(TELESCOPE_CAN_GOTO |
TELESCOPE_CAN_SYNC |
Expand All @@ -42,8 +42,7 @@ Rainbow::Rainbow() : INDI::Telescope ()
TELESCOPE_CAN_CONTROL_TRACK |
TELESCOPE_HAS_TIME |
TELESCOPE_HAS_LOCATION |
TELESCOPE_HAS_TRACK_MODE |
TELESCOPE_HAS_PIER_SIDE_SIMULATION, 4);
TELESCOPE_HAS_TRACK_MODE, 4);
}

/////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -756,6 +755,8 @@ bool Rainbow::ReadScopeStatus()
}
IDSetNumber(&HorizontalCoordsNP, nullptr);

setPierSide(getSideOfPier());

NewRaDec(m_CurrentRA, m_CurrentDE);

if (PullVoltTempS[PULL_VOLTTEMP_ENABLED].s == ISS_ON)
Expand Down Expand Up @@ -1656,6 +1657,36 @@ bool Rainbow::sendScopeLocation()
return true;
}

/////////////////////////////////////////////////////////////////////////////
/// Send Command
/////////////////////////////////////////////////////////////////////////////
Rainbow::TelescopePierSide Rainbow::getSideOfPier()
{
float decAxisAlignmentOffset {0}, decAxis {0};
char cyResponse[DRIVER_LEN] = {0}, cg3Response[DRIVER_LEN] = {0};

if (!sendCommand(":CG3#", cg3Response))
return PIER_UNKNOWN;

sscanf(cg3Response + 3, "%g", &decAxisAlignmentOffset);

if (!sendCommand(":CY#", cyResponse))
return PIER_UNKNOWN;

char rotationAngle[16] = {0};

strncpy(rotationAngle, cyResponse + 3, 7);

sscanf(rotationAngle, "%g", &decAxis);

auto offset = decAxis - decAxisAlignmentOffset;

if (offset > 90)
return PIER_WEST;
else
return PIER_EAST;
}

/////////////////////////////////////////////////////////////////////////////
/// Send Command
/////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions drivers/telescope/rainbow.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class Rainbow : public INDI::Telescope, public INDI::GuiderInterface
///////////////////////////////////////////////////////////////////////////////
void getStartupStatus();
bool getFirmwareVersion();
TelescopePierSide getSideOfPier();

///////////////////////////////////////////////////////////////////////////////
/// Location & Time
Expand Down

0 comments on commit d3f78b4

Please sign in to comment.