@@ -883,7 +883,7 @@ Public Class Telescope
883883 TargetRightAscension = RightAscension
884884 ' Looks like there's an LX200 command to sync to target, so...
885885 SyncToTarget()
886-
886+ TL.LogMessage( "SyncToCoordinates" , "Synced to " + utilities.DegreesToDMS(Declination) + ", " + utilities.HoursToHMS(RightAscension))
887887 'If RightAscension <= 24 And RightAscension >= 0 And Declination >= -90 And Declination <= 90 Then
888888 ' Dim sign As String = String.Empty
889889 ' If Declination >= 0 Then
@@ -913,13 +913,14 @@ Public Class Telescope
913913
914914 If targetRASet Then
915915
916- Dim sign As String = String .Empty
917- If TargetDeclination >= 0 Then
918- sign = "+"
919- End If
916+ ' Dim sign As String = String.Empty
917+ ' If TargetDeclination >= 0 Then
918+ ' sign = "+"
919+ ' End If
920920 ' Looks like there's an LX200 command to sync to target, so...
921921
922922 CommandBlind( ":CM" )
923+ TL.LogMessage( "SyncToTarget" , "Synced to " + utilities.DegreesToDMS(TargetDeclination) + ", " + utilities.HoursToHMS(TargetRightAscension))
923924 'Dim success As String = CommandString(":SY" + sign + utilities.DegreesToDMS(TargetDeclination, "*", ":", String.Empty) + "." + utilities.HoursToHMS(TargetRightAscension, ":", ":"), False)
924925 'If success = "1" Then
925926 ' TL.LogMessage("SyncToTarget", "Synced to " + utilities.DegreesToDMS(TargetDeclination) + ", " + utilities.HoursToHMS(TargetRightAscension))
@@ -949,6 +950,7 @@ Public Class Telescope
949950 Public Property TargetDeclination() As Double Implements ITelescopeV3.TargetDeclination
950951 Get
951952 If targetDecSet Then
953+ targetDec = utilities.DMSToDegrees(CommandString( ":Gd" ))
952954 TL.LogMessage( "TargetDeclination Get" , targetDec.ToString)
953955 Return targetDec
954956 Else
@@ -959,9 +961,24 @@ Public Class Telescope
959961 End Get
960962 Set (value As Double )
961963 If value >= - 90 And value <= 90 Then
962- TL.LogMessage( "TargetDeclination Set" , value.ToString)
963- targetDec = value
964- targetDecSet = True
964+
965+ Dim strDeccmd = utilities.DegreesToDMS(value, "*" , ":" , "" )
966+ If Declination >= 0 Then
967+ strDeccmd = "+" + strDeccmd
968+ End If
969+ strDeccmd = ":Sd" + strDeccmd
970+
971+ TL.LogMessage( "TargetDeclination" , strDeccmd)
972+
973+ If CommandString(strDeccmd) <> "1" Then
974+ targetDecSet = False
975+ Throw New ASCOM.DriverException( "ERR TargetDeclination" , strDeccmd)
976+ Else
977+ TL.LogMessage( "TargetDeclination Set" , value.ToString)
978+ targetDec = value
979+ targetDecSet = True
980+ End If
981+
965982 Else
966983 TL.LogMessage( "TargetDeclination Set" , "Invalid Value " + value.ToString)
967984 Throw New ASCOM.InvalidValueException( "TargetDeclination" )
@@ -973,6 +990,7 @@ Public Class Telescope
973990 Public Property TargetRightAscension() As Double Implements ITelescopeV3.TargetRightAscension
974991 Get
975992 If targetRASet Then
993+ targetRA = targetDec = utilities.HMSToHours(CommandString( ":Gr" ))
976994 TL.LogMessage( "TargetRightAscension Get" , targetRA.ToString)
977995 Return targetRA
978996 Else
@@ -982,10 +1000,17 @@ Public Class Telescope
9821000
9831001 End Get
9841002 Set (value As Double )
1003+
9851004 If value >= 0 And value <= 24 Then
986- TL.LogMessage( "TargetRightAscension Set" , value.ToString)
987- targetRA = value
988- targetRASet = True
1005+ Dim strRAcmd = ":Sr" + utilities.HoursToHMS(value, ":" , ":" )
1006+ If CommandString(strRAcmd) <> "1" Then
1007+ targetRASet = False
1008+ Throw New ASCOM.DriverException( "ERR TargetRightAscension" , strRAcmd)
1009+ Else
1010+ TL.LogMessage( "TargetRightAscension Set" , value.ToString)
1011+ targetRA = value
1012+ targetRASet = True
1013+ End If
9891014 Else
9901015 TL.LogMessage( "TargetRightAscension Set" , "Invalid Value " + value.ToString)
9911016 Throw New ASCOM.InvalidValueException( "TargetRightAscension" )
0 commit comments