Added an attempt to use the short format to set the TargetRightAscension if the long format fails.

This commit is contained in:
2022-11-10 15:30:16 +00:00
parent 5c3bb7d4ad
commit 129fc23d83
2 changed files with 10 additions and 1 deletions
@@ -2518,6 +2518,7 @@ namespace Meade.net.Telescope.UnitTests
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar(_traceLoggerMock.Object, It.IsAny<string>(), false)).Returns("0");
_utilMock.Setup(x => x.HoursToHMS(It.IsAny<double>(), ":", ":", ":", It.IsAny<int>())).Returns("00:00:00.00");
_utilMock.Setup(x => x.HoursToHM(It.IsAny<double>(), ":", "", It.IsAny<int>())).Returns("00:00:00.00");
ConnectTelescope();
+9 -1
View File
@@ -3496,7 +3496,15 @@ namespace ASCOM.Meade.net
if (value >= 24)
throw new InvalidValueException("Right ascension value cannot be greater than 23:59:59");
var hms = SetTargetRightAscension(value, SharedResourcesWrapper.IsLongFormat);
string hms;
try
{
hms = SetTargetRightAscension(value, SharedResourcesWrapper.IsLongFormat);
}
catch (InvalidOperationException)
{
hms = SetTargetRightAscension(value, !SharedResourcesWrapper.IsLongFormat);
}
SharedResourcesWrapper.TargetRightAscension = _utilities.HMSToHours(hms);
}