APSF //- This script toggles tracking off and on for a Meade Autostar 497 //- controller. It will only work with Autostar firmware 43Eg or later. //- If tracking is off it will turn it on and vice-versa. //- Works for both Alt-Az and Polar alignments. //- //- The first time you run this script, or if you run it with the Shift //- key down, it will ask for the serial port that the telescope is //- connected to. //- //- NOTE: This script will NOT work if the telescope is "connected" to //- AstroPlanner (since it interferes with AstroPlanner's usage of the //- serial port). Future versions of the AstroPlanner app should work //- better in this regard. //- //- Thanks to Dick Seymour for help on this one. //- //- V1.0 7/15/07 Original release dim i as integer, sp as APSerialPort, sn(-1),s,spname as string // Main program // Get stored parameters SaveRestoreTag("AutostarTrackingSuspend") spname=RestoreStringValue("spname","") if spname="" or KeyDown(kbd_Shift) then // Get serial port for i=1 to nSerialPorts sn.Append SerialPort(i).Name next i=0 SetPopupParameter("Autostar Serial Port",i,sn) if not EditParameters("Autostar Tracking Suspend") then return i=GetPopupParameter("Autostar Serial Port") spname=sn(i) end if for i=1 to nSerialPorts if SerialPort(i).Name=spname then sp=SerialPort(i) next if sp=nil then return sp.Open // Check for suitable version sp.Send "#:GVN#" s = sp.Receive("#",1) s=ReplaceAll(s,"#","") if s="" then print "No response from "+spname+". Either AstroPlanner is connected, or the telescope controller isn't responding." return end if if len(s)<>4 or s<"43Eg" then Print "Autostar firmware reported as '"+s+"', which is not recent enough!" return end if // Find current state of Autostar sp.Send "#:GW#" s = sp.Receive("",0.5) if left(s,2)="PT" or left(s,2)="AT" then // Polar or Alt-Az, Tracking // Change to Land mode to stop tracking sp.Send "#:AL#" s = sp.Receive("",0.1) elseif left(s,2)="PN" then // Polar, not tracking // Start polar mode sp.Send "#:AP#" s = sp.Receive("",0.1) elseif left(s,2)="AN" then // Alt-Az, not tracking // Start Alt-Az mode sp.Send "#:AA#" s = sp.Receive("",0.1) end if sp.Close SaveStringValue("spname",spname)