Added attempt to set the TargetRightAscension using the other format if one fails.
This commit is contained in:
@@ -3496,22 +3496,15 @@ namespace ASCOM.Meade.net
|
|||||||
if (value >= 24)
|
if (value >= 24)
|
||||||
throw new InvalidValueException("Right ascension value cannot be greater than 23:59:59");
|
throw new InvalidValueException("Right ascension value cannot be greater than 23:59:59");
|
||||||
|
|
||||||
var hms = SharedResourcesWrapper.IsLongFormat
|
string hms;
|
||||||
? _utilities.HoursToHMS(value, ":", ":", ":", _digitsRa)
|
try
|
||||||
: _utilities.HoursToHM(value, ":", "", _digitsRa).Replace(',', '.');
|
{
|
||||||
|
hms = SetTargetRightAscension(value, SharedResourcesWrapper.IsLongFormat);
|
||||||
var command = $"Sr{hms}";
|
}
|
||||||
LogMessage("TargetRightAscension Set", $"{command}");
|
catch(InvalidOperationException)
|
||||||
var response = SharedResourcesWrapper.SendChar(Tl, command);
|
{
|
||||||
//:SrHH:MM.T#
|
hms = SetTargetRightAscension(value, !SharedResourcesWrapper.IsLongFormat);
|
||||||
//:SrHH:MM:SS#
|
}
|
||||||
//Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting.
|
|
||||||
// Returns:
|
|
||||||
//0 - Invalid
|
|
||||||
//1 - Valid
|
|
||||||
|
|
||||||
if (response == "0")
|
|
||||||
throw new InvalidOperationException("Failed to set TargetRightAscension.");
|
|
||||||
|
|
||||||
SharedResourcesWrapper.TargetRightAscension = _utilities.HMSToHours(hms);
|
SharedResourcesWrapper.TargetRightAscension = _utilities.HMSToHours(hms);
|
||||||
}
|
}
|
||||||
@@ -3523,6 +3516,27 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string SetTargetRightAscension(double value, bool useLongFormat)
|
||||||
|
{
|
||||||
|
var hms = useLongFormat
|
||||||
|
? _utilities.HoursToHMS(value, ":", ":", ":", _digitsRa)
|
||||||
|
: _utilities.HoursToHM(value, ":", "", _digitsRa).Replace(',', '.');
|
||||||
|
|
||||||
|
var command = $"Sr{hms}";
|
||||||
|
LogMessage("TargetRightAscension Set", $"{command}");
|
||||||
|
var response = SharedResourcesWrapper.SendChar(Tl, command);
|
||||||
|
//:SrHH:MM.T#
|
||||||
|
//:SrHH:MM:SS#
|
||||||
|
//Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting.
|
||||||
|
// Returns:
|
||||||
|
//0 - Invalid
|
||||||
|
//1 - Valid
|
||||||
|
|
||||||
|
if (response == "0")
|
||||||
|
throw new InvalidOperationException("Failed to set TargetRightAscension.");
|
||||||
|
return hms;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Tracking
|
public bool Tracking
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user