You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Telescope - Fix Set RightAscensionRate and DeclinationRate to throw InvalidOperationExceptions when the telescope is tracking at other than sidereal rate.
// In addition, the sense of required rate corrections is inverted when in the southern hemisphere compared to the northern hemisphere
728
728
if(SouthernHemisphere)// Southern hemisphere
729
729
{
730
-
change.Y+=(SideOfPier==PointingState.Normal?-rateRaDecOffsetInternal.Y:+rateRaDecOffsetInternal.Y)*timeInSecondsSinceLastUpdate;// Add or subtract declination rate depending on pointing state
730
+
change.Y+=(SideOfPier==PointingState.Normal?-rateRaDecOffsetInternal.Y:+rateRaDecOffsetInternal.Y)*timeInSecondsSinceLastUpdate;// Add or subtract declination rate depending on pointing state
731
731
}
732
732
else// Northern hemisphere
733
733
{
@@ -1413,8 +1413,15 @@ public static double DeclinationRate
1413
1413
get{returnrateRaDecOffsetExternal.Y;}
1414
1414
set
1415
1415
{
1416
-
rateRaDecOffsetExternal.Y=value;// Save the provided rate to be returned through the Get property
1417
-
rateRaDecOffsetInternal.Y=value*ARCSECONDS_TO_DEGREES;// Save the rate in the internal units that the simulator uses
1416
+
// Setting DeclinationRate is only valid when tracking at sidereal rate. At other tracking rates the set must be rejected.
1417
+
if(!(TrackingRate==DriveRate.Sidereal))// We are not tracking at sidereal rate
1418
+
thrownewInvalidOperationException($"DeclinationRate can only be set when tracking at sidereal rate. The current tracking rate is: {TrackingRate}.");
1419
+
1420
+
// Save the provided rate to be returned through the Get property
1421
+
rateRaDecOffsetExternal.Y=value;
1422
+
1423
+
// Save the rate in the internal units that the simulator uses
@@ -1513,6 +1520,10 @@ public static double RightAscensionRate
1513
1520
get{returnrateRaDecOffsetExternal.X;}
1514
1521
set
1515
1522
{
1523
+
// Setting RightAscensionRate is only valid when tracking at sidereal rate. At other tracking rates the set must be rejected.
1524
+
if(!(TrackingRate==DriveRate.Sidereal))// We are not tracking at sidereal rate
1525
+
thrownewInvalidOperationException($"RightAscensionRate can only be set when tracking at sidereal rate. The current tracking rate is: {TrackingRate}.");
1526
+
1516
1527
// Save the provided rate (seconds of RA per sidereal second) to be returned through the Get property
0 commit comments