diff --git a/drivers.xml b/drivers.xml
index 029038344b..d5d0d7c9b2 100644
--- a/drivers.xml
+++ b/drivers.xml
@@ -121,11 +121,11 @@
indi_rainbow_telescope
- 1.1
+ 1.3
indi_rainbow_telescope
- 1.1
+ 1.3
indi_crux_mount
diff --git a/drivers/telescope/rainbow.cpp b/drivers/telescope/rainbow.cpp
index 46586ac98a..a9c79bad62 100644
--- a/drivers/telescope/rainbow.cpp
+++ b/drivers/telescope/rainbow.cpp
@@ -33,7 +33,7 @@ static std::unique_ptr scope(new Rainbow());
Rainbow::Rainbow() : INDI::Telescope ()
{
- setVersion(1, 2);
+ setVersion(1, 3);
SetTelescopeCapability(TELESCOPE_CAN_GOTO |
TELESCOPE_CAN_SYNC |
@@ -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);
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -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)
@@ -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
/////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/telescope/rainbow.h b/drivers/telescope/rainbow.h
index 2b16428a6d..8f5b070a1a 100644
--- a/drivers/telescope/rainbow.h
+++ b/drivers/telescope/rainbow.h
@@ -86,6 +86,7 @@ class Rainbow : public INDI::Telescope, public INDI::GuiderInterface
///////////////////////////////////////////////////////////////////////////////
void getStartupStatus();
bool getFirmwareVersion();
+ TelescopePierSide getSideOfPier();
///////////////////////////////////////////////////////////////////////////////
/// Location & Time