| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | ######################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # NexStarCtl - NexStar control library | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # (c)2013-2016 by Rumen G.Bogdanovski | ||||||||||||||||||||||||||||||||||||||||||
| 8 | ######################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | NexStarCtl - API to control NexStar compatible telescopes | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | use NexStarCtl; | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | my $port = open_telescope_port("/dev/XXX"); | ||||||||||||||||||||||||||||||||||||||||||
| 19 | if (!defined $port) { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | print "Can not open communication port.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | exit; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | # check if the mount is aligned | ||||||||||||||||||||||||||||||||||||||||||
| 25 | if (tc_check_align($port)) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | print "The telescope is aligned.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 27 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | print "The telescope is not aligned.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # Read the stored coordinates of the location | ||||||||||||||||||||||||||||||||||||||||||
| 32 | my ($lon,$lat) = tc_get_location_str($port); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | if (! defined($lon)) { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | print "Telescope did not respond\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | close_telescope_port($port); | ||||||||||||||||||||||||||||||||||||||||||
| 36 | exit; | ||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | print "Location coordinates:\n LON=$lon\n LAT=$lat\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | my ($date,$time,$tz,$dst) = tc_get_time_str($port); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # Do some other stuff | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | close_telescope_port($port); | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | This module implements the serial commands supported by the Celestron NexStar hand control (HC) and SkyWatcher/Orion SynScan HC. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | This applies to the Celestron: NexStar GPS, NexStar GPS-SA, NexStar iSeries, NexStar SE Series, NexStar GT, CPC, SLT, Advanced-VX, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | Advanced-GT, CGE, CGEM etc. SkyWatcher: EQ5, HEQ5, EQ6 (Pro), AZ-EQ5 GT, AZ-EQ6 GT, EQ8 etc. and the corresponding Orion mounts. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | Communication to the hand control is 9600 bits/sec, no parity and one stop bit via the RS-232 port on the base of the | ||||||||||||||||||||||||||||||||||||||||||
| 54 | hand control. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | Communication can be established over TCP/IP if nexbridge is running on the computer connected to the telescope. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | For extended example how to use this perl module look in to the distribution folder for nexstarctl/nexstarctl.pl. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | This program is a complete console tool to control NexStar telescopes based on NexStarCtl module. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | NOTE: For SkyWatcher/Orion mounts it is highly recommended to enforce protocol version checking (see enforce_protocol_version()) as | ||||||||||||||||||||||||||||||||||||||||||
| 62 | the AUX commands are not supported or may behave erratically. | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | package NexStarCtl; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | use POSIX; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | use Time::Local; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | if ($^O eq "MSWin32") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | eval "use Win32::SerialPort"; die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | ▶ | eval "use Device::SerialPort"; die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | VER_1_2 => 0x10200, | |||||||||||||||||||||||||||||||||||||||||
| 82 | VER_1_6 => 0x10600, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | VER_2_2 => 0x20200, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | VER_2_3 => 0x20300, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | VER_3_1 => 0x30100, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | VER_4_10 => 0x40A00, | ||||||||||||||||||||||||||||||||||||||||||
| 87 | VER_4_37_8 => 0x042508, | ||||||||||||||||||||||||||||||||||||||||||
| 88 | # All protocol versions | ||||||||||||||||||||||||||||||||||||||||||
| 89 | VER_AUX => 0xFFFFFF, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | # Auto detect version by HC | ||||||||||||||||||||||||||||||||||||||||||
| 91 | VER_AUTO => 0x0, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | # Protocol vendors | ||||||||||||||||||||||||||||||||||||||||||
| 94 | VNDR_CELESTRON => 0x1, | ||||||||||||||||||||||||||||||||||||||||||
| 95 | VNDR_SKYWATCHER => 0x2, | ||||||||||||||||||||||||||||||||||||||||||
| 96 | VNDR_ALL_SUPPORTED => 0x3, # VNDR_CELESTRON | VNDR_SKYWATCHER | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # version manipulation | ||||||||||||||||||||||||||||||||||||||||||
| 99 | RELEASE_MASK => 0xFF0000, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | REVISION_MASK => 0x00FF00, | ||||||||||||||||||||||||||||||||||||||||||
| 101 | PATCH_MASK => 0x0000FF | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | my $is_tcp = 0; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | my $proto_version = VER_AUX; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | my $mount_vendor = VNDR_ALL_SUPPORTED; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | # There is no way to tell SkyWatcher from Celestron. Unfortunately both share the | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # same IDs and some Celestron mounts have RTC wile SW does not. That is why the user | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # should decide. Set use_rtc to 1 to enable using the RTC on the mounts that have RTC. | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | our $use_rtc = 0; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | # 0 => no error | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # -5 => unsupported command | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | our $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | use constant TIMEOUT => 4; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 122 | VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | use_rtc | ||||||||||||||||||||||||||||||||||||||||||
| 125 | error | ||||||||||||||||||||||||||||||||||||||||||
| 126 | VER_1_2 VER_1_6 VER_2_2 VER_2_3 | ||||||||||||||||||||||||||||||||||||||||||
| 127 | VER_3_1 VER_4_10 VER_4_37_8 VER_AUX VER_AUTO | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | VNDR_CELESTRON VNDR_SKYWATCHER | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | DEG2RAD RAD2DEG | ||||||||||||||||||||||||||||||||||||||||||
| 132 | notnum precess round | ||||||||||||||||||||||||||||||||||||||||||
| 133 | d2hms d2dms d2dm dms2d hms2d | ||||||||||||||||||||||||||||||||||||||||||
| 134 | dd2nex dd2pnex nex2dd pnex2dd | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | get_model_name | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | open_telescope_port | ||||||||||||||||||||||||||||||||||||||||||
| 139 | close_telescope_port | ||||||||||||||||||||||||||||||||||||||||||
| 140 | read_telescope | ||||||||||||||||||||||||||||||||||||||||||
| 141 | enforce_protocol_version | ||||||||||||||||||||||||||||||||||||||||||
| 142 | guess_mount_vendor | ||||||||||||||||||||||||||||||||||||||||||
| 143 | enforce_vendor_protocol | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | tc_pass_through_cmd | ||||||||||||||||||||||||||||||||||||||||||
| 146 | tc_check_align tc_get_orientation | ||||||||||||||||||||||||||||||||||||||||||
| 147 | tc_goto_rade tc_goto_rade_p | ||||||||||||||||||||||||||||||||||||||||||
| 148 | tc_goto_azalt tc_goto_azalt_p | ||||||||||||||||||||||||||||||||||||||||||
| 149 | tc_get_rade tc_get_rade_p | ||||||||||||||||||||||||||||||||||||||||||
| 150 | tc_get_azalt tc_get_azalt_p | ||||||||||||||||||||||||||||||||||||||||||
| 151 | tc_sync_rade tc_sync_rade_p | ||||||||||||||||||||||||||||||||||||||||||
| 152 | tc_goto_in_progress tc_goto_cancel | ||||||||||||||||||||||||||||||||||||||||||
| 153 | tc_get_model | ||||||||||||||||||||||||||||||||||||||||||
| 154 | tc_get_version | ||||||||||||||||||||||||||||||||||||||||||
| 155 | tc_echo | ||||||||||||||||||||||||||||||||||||||||||
| 156 | tc_get_location tc_get_location_str | ||||||||||||||||||||||||||||||||||||||||||
| 157 | tc_get_time tc_get_time_str | ||||||||||||||||||||||||||||||||||||||||||
| 158 | tc_set_time tc_set_location | ||||||||||||||||||||||||||||||||||||||||||
| 159 | tc_get_tracking_mode tc_set_tracking_mode | ||||||||||||||||||||||||||||||||||||||||||
| 160 | tc_slew_variable tc_slew_fixed | ||||||||||||||||||||||||||||||||||||||||||
| 161 | tc_get_autoguide_rate tc_set_autoguide_rate | ||||||||||||||||||||||||||||||||||||||||||
| 162 | tc_get_backlash tc_set_backlash | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | TC_TRACK_OFF | ||||||||||||||||||||||||||||||||||||||||||
| 165 | TC_TRACK_ALT_AZ | ||||||||||||||||||||||||||||||||||||||||||
| 166 | TC_TRACK_EQ_NORTH | ||||||||||||||||||||||||||||||||||||||||||
| 167 | TC_TRACK_EQ_SOUTH | ||||||||||||||||||||||||||||||||||||||||||
| 168 | TC_TRACK_EQ | ||||||||||||||||||||||||||||||||||||||||||
| 169 | TC_TRACK_EQ_PEC | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | TC_DIR_POSITIVE | ||||||||||||||||||||||||||||||||||||||||||
| 172 | TC_DIR_NEGATIVE | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | TC_AXIS_RA_AZM | ||||||||||||||||||||||||||||||||||||||||||
| 175 | TC_AXIS_DE_ALT | ||||||||||||||||||||||||||||||||||||||||||
| 176 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | our $VERSION = "0.15"; | |||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | NX_TC_TRACK_OFF => 0, | |||||||||||||||||||||||||||||||||||||||||
| 182 | NX_TC_TRACK_ALT_AZ => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 183 | NX_TC_TRACK_EQ_NORTH => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 184 | NX_TC_TRACK_EQ_SOUTH => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | SW_TC_TRACK_OFF => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 187 | SW_TC_TRACK_ALT_AZ => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | SW_TC_TRACK_EQ => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 189 | SW_TC_TRACK_EQ_PEC => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | TC_TRACK_OFF => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | TC_TRACK_ALT_AZ => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | TC_TRACK_EQ_NORTH => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | TC_TRACK_EQ_SOUTH => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | TC_TRACK_EQ => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 196 | TC_TRACK_EQ_PEC => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | TC_DIR_POSITIVE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 199 | TC_DIR_NEGATIVE => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | TC_AXIS_RA_AZM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 202 | TC_AXIS_DE_ALT => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | _TC_DIR_POSITIVE => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 205 | _TC_DIR_NEGATIVE => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | _TC_AXIS_RA_AZM => 16, | ||||||||||||||||||||||||||||||||||||||||||
| 208 | _TC_AXIS_DE_ALT => 17, | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | DEG2RAD => 3.1415926535897932384626433832795/180.0, | ||||||||||||||||||||||||||||||||||||||||||
| 211 | RAD2DEG => 180.0/3.1415926535897932384626433832795 | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | my %mounts = ( | ||||||||||||||||||||||||||||||||||||||||||
| 215 | &VNDR_CELESTRON => { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 => "NexStar GPS Series", | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 3 => "NexStar i-Series", | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 4 => "NexStar i-Series SE", | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 5 => "CGE", | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 6 => "Advanced GT", | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 7 => "SLT", | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 9 => "CPC", | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 10 => "GT", | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 11 => "NexStar 4/5 SE", | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 12 => "NexStar 6/8 SE", | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 14 => "CGEM", | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 20 => "Advanced VX", | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 22 => "Nexstar Evolution"}, | ||||||||||||||||||||||||||||||||||||||||||
| 229 | &VNDR_SKYWATCHER => { | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 => "EQ6 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 => "HEQ5 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 2 => "EQ5 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 3 => "EQ3 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 4 => "EQ8 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 5 => "AZ-EQ6 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 => "AZ-EQ5 Series", | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 160 => "AllView Series", | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 16 | ( map { $_ => "AZ Series" } (128..143)), | |||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | ( map { $_ => "DOB Series" } (144..159)) | |||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub release_before($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
release_before: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my ($release) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ((($proto_version & RELEASE_MASK) >> 16) < $release) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | sub revision_before($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
revision_before: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my ($revision) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if ((($proto_version & REVISION_MASK) >> 8) < $revision) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub patch_before($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
patch_before: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my ($patch) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | if (($proto_version & PATCH_MASK) < $patch) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 273 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub version_before($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version_before: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my ($version) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | if ($proto_version < $version) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub vendor_not($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vendor_not: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my ($vendor) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ($mount_vendor == $vendor) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $error = 0; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | return $error; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub vendor_is($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vendor_is: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my ($vendor) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | if ($mount_vendor == $vendor) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | =head1 TELESCOPE COMMUNICATION | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | =item open_telescope_port(port_name) | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | Opens a communication port to the telescope by name (like "/dev/ttyUSB0") and | ||||||||||||||||||||||||||||||||||||||||||
| 321 | returns it to be used in other functions. If the port_name has "tcp://" prefix | ||||||||||||||||||||||||||||||||||||||||||
| 322 | the rest of the string is interpreted as an IP address and port where to connect to | ||||||||||||||||||||||||||||||||||||||||||
| 323 | (like "tcp://localhost:9999"). In case of error undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | NOTE: To be used with TCP you need to run nexbridge on the remote computer. | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub open_telescope_port($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open_telescope_port: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my ($portname) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $port; | |||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if ($portname =~ /^tcp:\/\//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $portname =~ s/^tcp:\/\///; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $is_tcp=1; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | $is_tcp=0; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if ($is_tcp) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | my $port = new IO::Socket::INET( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | PeerHost => $portname, | ||||||||||||||||||||||||||||||||||||||||||
| 343 | Proto => 'tcp' | ||||||||||||||||||||||||||||||||||||||||||
| 344 | ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return $port; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ($^O eq "MSWin32") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $port = new Win32::SerialPort($portname); | |||||||||||||||||||||||||||||||||||||||||
| 350 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $port = new Device::SerialPort($portname); | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | if (! defined $port) {return undef;} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | #$port->debug(1); | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $port->baudrate(9600); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $port->parity("none"); | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $port->databits(8); | |||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $port->stopbits(1); | |||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $port->datatype('raw'); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $port->write_settings; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $port->read_char_time(0); # don't wait for each character | |||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $port->read_const_time(TIMEOUT*1000); | |||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $mount_vendor = guess_mount_vendor($port); | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | if (! defined $mount_vendor) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $port->close(); | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | return $port; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | # For internal library use only! | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub read_byte($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_byte: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my ($byte, $count, $char); | |||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | if ($is_tcp == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ($count,$char)=$port->read(1); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | local $SIG{ALRM} = sub { die "TimeOut" }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | alarm TIMEOUT; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $count=$port->read($char,1); | |||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | alarm 0; | |||||||||||||||||||||||||||||||||||||||||
| 388 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if ($@ and $@ !~ /TimeOut/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and not $@ =~ /TimeOut/
MC/DC0%0/2
$@ and not $@ =~ /TimeOut/
$@
not $@ =~ /TimeOut/
Truth table0%0/3
A and not(B)
A= $@B= not $@ =~ /TimeOut/
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | return ($count,$char); | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | =item read_telescope(port, len) | ||||||||||||||||||||||||||||||||||||||||||
| 398 | =item read_telescope(port, len , vl) | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | Reads data from the telescope. On error or in case less than len bytes are read undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 401 | If "vl" is true the function will return success if "#" is read before the len bytes are read. | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub read_telescope { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_telescope: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my ($port,$len,$vl) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my $response; | |||||||||||||||||||||||||||||||||||||||||
| 407 | my $char; | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $count; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $total=0; | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ($count,$char)=read_byte($port); | |||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if ($count == 0) { return undef; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $total += $count; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | $response .= $char; | |||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if (($vl) and ($char eq "#")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$vl and $char eq "#"
MC/DC0%0/2
$vl and $char eq "#"
$vl
$char eq "#"
Truth table0%0/3
A and B
A= $vlB= $char eq "#"
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | } while ($total < $len); | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | # if the last byte is not '#', this means that the device did | ||||||||||||||||||||||||||||||||||||||||||
| 421 | # not respond and the next byte should be '#' (hopefully) | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | if ($char ne "#") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ($count,$char)=read_byte($port); | |||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | =item write_telescope(port, data) | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | Writes data to the telescope and the result of write is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub write_telescope($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_telescope: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my ($port, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return $port->write($data); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | =item close_telescope_port(port) | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | Closes the communication port to the telescope. | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | sub close_telescope_port($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close_telescope_port: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $port->close; | |||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | undef $port; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | =item enforce_protocol_version(port, ver) | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | Enforce protocol minimal version checking. If a specific command is not supported by the firmware version given | ||||||||||||||||||||||||||||||||||||||||||
| 456 | in ver, the corresponding tc_*() call will fail as unsupported and return undef (in this case $NexStarCtl::error | ||||||||||||||||||||||||||||||||||||||||||
| 457 | will be set to -5). If version is VER_AUX, version enforcement | ||||||||||||||||||||||||||||||||||||||||||
| 458 | is disabled and all commands are enabled but some may fail, because they may not be supported by the current hand controller | ||||||||||||||||||||||||||||||||||||||||||
| 459 | firmware. To avoid this use VER_AUTO (or omit it) to set the version to the value reported by the currently connected hand | ||||||||||||||||||||||||||||||||||||||||||
| 460 | controller. By default protocol version enforcement is disabled and the unsupported commands will either timeout | ||||||||||||||||||||||||||||||||||||||||||
| 461 | or return erratic results. Because of this, calling enforce_protocol_version() with VER_AUTO or no ver parameter right after | ||||||||||||||||||||||||||||||||||||||||||
| 462 | open_telescope_port() is highly recommended. The predefined versions are: VER_1_2, VER_1_6, VER_2_2, VER_2_3, VER_3_1, VER_4_10 and VER_4_37_8. | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | NOTE: The non-documented (AUX) commands are available only when the enforcement is disabled. | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | sub enforce_protocol_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enforce_protocol_version: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my ($port, $ver) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | if ((defined $ver) and ($ver != 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ver and $ver != 0
MC/DC0%0/2
defined $ver and $ver != 0
defined $ver
$ver != 0
Truth table0%0/3
A and B
A= defined $verB= $ver != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $proto_version = $ver; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my ($major,$minor,$subminor) = tc_get_version($port); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | if (!defined $major) { return undef; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $proto_version = ($major << 16) + ($minor << 8) + $subminor; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | =item guess_mount_vendor(port) | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | This function guesses the manufacturer of the mount by a slight difference in the protocol. The firmware version command returns 2 bytes for Celestron mounts and 6 bytes for SkyWatcher mounts (since version 4.37.8). On success the guessed value is returned (VNDR_CELESTRON or VNDR_SKYWATCHER). On error undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | NOTE: SkyWather mounts with firmware before 4.37.8 will be threated as Celestron in this case enforce_vendor_protocol() can be used. | ||||||||||||||||||||||||||||||||||||||||||
| 486 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub guess_mount_vendor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
guess_mount_vendor: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $port->write("V"); | |||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $response = read_telescope($port, 7, 1); | |||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | return undef unless (defined $response); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | if (length($response) == 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | return VNDR_CELESTRON; | |||||||||||||||||||||||||||||||||||||||||
| 499 | } elsif (length($response) == 7) { | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | return VNDR_SKYWATCHER; | |||||||||||||||||||||||||||||||||||||||||
| 501 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | =item enforce_vendor_protocol(vendor) | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | This function enforces protocol of the specified vendor to be used overriding the guessed one. | ||||||||||||||||||||||||||||||||||||||||||
| 509 | Valid vendor IDs are VNDR_CELESTRON and VNDR_SKYWATCHER. This way the commands not supported | ||||||||||||||||||||||||||||||||||||||||||
| 510 | by the vendor version of the protocol will fail and $NexStarCtl::error will be set to -5. | ||||||||||||||||||||||||||||||||||||||||||
| 511 | On success the vendor ID is returned otherwise it returns undef. | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub enforce_vendor_protocol($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enforce_vendor_protocol: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my ($vendor) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | if (!(VNDR_ALL_SUPPORTED & $vendor)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $mount_vendor = $vendor; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | # | ||||||||||||||||||||||||||||||||||||||||||
| 526 | # Telescope Commands | ||||||||||||||||||||||||||||||||||||||||||
| 527 | # | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | =head1 TELESCOPE COMMANDS | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | =item tc_check_align(port) | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | If the telescope is aligned 1 is returned else 0 is returned. If no response received, | ||||||||||||||||||||||||||||||||||||||||||
| 538 | undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | sub tc_check_align($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_check_align: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $port->write("J"); | |||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $response = read_telescope($port,2); | |||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | return ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 550 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | =item tc_get_orientation(port) | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | Get the telescope orientation. "E" or "W" is returned for East and West respectively. If no response received, | ||||||||||||||||||||||||||||||||||||||||||
| 558 | undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | sub tc_get_orientation($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_orientation: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | return undef if vendor_not(VNDR_SKYWATCHER); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | return undef if release_before(3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | return undef if revision_before(37); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $port->write("p"); | |||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $response = read_telescope($port,2); | |||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | return substr($response, 0, 1); | |||||||||||||||||||||||||||||||||||||||||
| 572 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | =item tc_goto_rade(port, ra, de) | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | =item tc_goto_rade_p(port, ra, de) | ||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | Slew the telescope to RA/DEC coordinates ra, de (in decimal degrees). | ||||||||||||||||||||||||||||||||||||||||||
| 582 | Function tc_goto_rade_p uses precise GOTO. | ||||||||||||||||||||||||||||||||||||||||||
| 583 | If RA is not in [0;360] function returns -1. If DEC is not in [-90;90] -2 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 584 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | sub tc_goto_rade { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_rade: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | my ($port, $ra, $de, $precise) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if (($ra < 0) or ($ra > 360)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ra < 0 or $ra > 360
MC/DC0%0/2
$ra < 0 or $ra > 360
$ra < 0
$ra > 360
Truth table0%0/3
A or B
A= $ra < 0B= $ra > 360
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | if (($de < -90) or ($de > 90)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$de < -90 or $de > 90
MC/DC0%0/2
$de < -90 or $de > 90
$de < -90
$de > 90
Truth table0%0/3
A or B
A= $de < -90B= $de > 90
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return -2; | |||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my $nex; | |||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | if((defined $precise) and ($precise =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $precise and
MC/DC0%0/1
defined $precise and
defined $precise
Truth table0%0/2
A
A= defined $precise
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | return undef if version_before(VER_1_6); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $nex=dd2pnex($ra, $de); | |||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $port->write("r".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 600 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $nex=dd2nex($ra, $de); | |||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $port->write("R".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | my $response = read_telescope($port,1); | |||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 608 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | sub tc_goto_rade_p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_rade_p: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | return tc_goto_rade(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | =item tc_goto_azalt(port, az, alt) | ||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | =item tc_goto_azalt_p(port, az, alt) | ||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | Slew the telescope to AZ/ALT coordinates az, alt (in decimal degrees). Function tc_goto_azalt_p uses precise GOTO. | ||||||||||||||||||||||||||||||||||||||||||
| 622 | If AZ is not in [0;360] function returns -1. If ALT is not in [-90;90] -2 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 623 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | sub tc_goto_azalt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_azalt: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | my ($port, $az, $alt, $precise) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | if (($az < 0) or ($az > 360)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$az < 0 or $az > 360
MC/DC0%0/2
$az < 0 or $az > 360
$az < 0
$az > 360
Truth table0%0/3
A or B
A= $az < 0B= $az > 360
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | if (($alt < -90) or ($alt > 90)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$alt < -90 or $alt > 90
MC/DC0%0/2
$alt < -90 or $alt > 90
$alt < -90
$alt > 90
Truth table0%0/3
A or B
A= $alt < -90B= $alt > 90
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | return -2; | |||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $nex; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | if((defined $precise) and ($precise =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $precise and
MC/DC0%0/1
defined $precise and
defined $precise
Truth table0%0/2
A
A= defined $precise
| |||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | return undef if version_before(VER_2_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | $nex=dd2pnex($az, $alt); | |||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $port->write("b".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 639 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | $nex=dd2nex($az, $alt); | |||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | $port->write("B".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | my $response = read_telescope($port,1); | |||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 647 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | ▶ | sub tc_goto_azalt_p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_azalt_p: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | return tc_goto_azalt(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | =item tc_get_rade(port) | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | =item tc_get_rade_p(port) | ||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | Returns the the current telescope RA/DEC coordinates ra, de (in decimal degrees). Function | ||||||||||||||||||||||||||||||||||||||||||
| 661 | tc_get_rade_p uses precise GET. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | ▶ | sub tc_get_rade { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_rade: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my ($port, $precise) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | my $ra; | |||||||||||||||||||||||||||||||||||||||||
| 668 | my $de; | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | if((defined $precise) and ($precise =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $precise and
MC/DC0%0/1
defined $precise and
defined $precise
Truth table0%0/2
A
A= defined $precise
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | return undef if version_before(VER_1_6); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | $port->write("e"); | |||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | my $response = read_telescope($port, 18); | |||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ($ra,$de) = pnex2dd($response); | |||||||||||||||||||||||||||||||||||||||||
| 678 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | $port->write("E"); | |||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | my $response = read_telescope($port, 10); | |||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ($ra,$de) = nex2dd($response); | |||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | return ($ra, $de); | |||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | sub tc_get_rade_p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_rade_p: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | return tc_get_rade(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | =item tc_get_azalt(port) | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | =item tc_get_azalt_p(port) | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | Returns the the currents telescope AZ/ALT coordinates az, alt (in decimal degrees). Function | ||||||||||||||||||||||||||||||||||||||||||
| 700 | tc_get_azalt_p uses precise GET. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | sub tc_get_azalt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_azalt: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my ($port, $precise) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | my $az; | |||||||||||||||||||||||||||||||||||||||||
| 707 | my $alt; | ||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | if((defined $precise) and ($precise =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $precise and
MC/DC0%0/1
defined $precise and
defined $precise
Truth table0%0/2
A
A= defined $precise
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | return undef if version_before(VER_2_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | $port->write("z"); | |||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $response = read_telescope($port, 18); | |||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ($az,$alt) = pnex2dd($response); | |||||||||||||||||||||||||||||||||||||||||
| 717 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | $port->write("Z"); | |||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | my $response = read_telescope($port, 10); | |||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | ($az,$alt) = nex2dd($response); | |||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | return ($az, $alt); | |||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | sub tc_get_azalt_p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_azalt_p: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | return tc_get_azalt(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||
| 734 | =item tc_sync_rade(port, ra, de) | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | =item tc_sync_rade_p(port, ra, de) | ||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||
| 738 | Syncs the telescope to RA/DEC coordinates ra, de (in decimal degrees). Function tc_sync_rade_p uses precise sync. | ||||||||||||||||||||||||||||||||||||||||||
| 739 | If RA is not in [0;360] function returns -1. If DEC is not in [-90;90] -2 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 740 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | sub tc_sync_rade { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_sync_rade: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | my ($port, $ra, $de, $precise) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | if(vendor_is(VNDR_SKYWATCHER)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | ▶ | return undef if release_before(3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | return undef if revision_before(37); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 749 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | return undef if version_before(VER_4_10); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if (($ra < 0) or ($ra > 360)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ra < 0 or $ra > 360
MC/DC0%0/2
$ra < 0 or $ra > 360
$ra < 0
$ra > 360
Truth table0%0/3
A or B
A= $ra < 0B= $ra > 360
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ▶ | if (($de < -90) or ($de > 90)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$de < -90 or $de > 90
MC/DC0%0/2
$de < -90 or $de > 90
$de < -90
$de > 90
Truth table0%0/3
A or B
A= $de < -90B= $de > 90
| |||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | return -2; | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | my $nex; | |||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | if((defined $precise) and ($precise =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $precise and
MC/DC0%0/1
defined $precise and
defined $precise
Truth table0%0/2
A
A= defined $precise
| |||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $nex=dd2pnex($ra, $de); | |||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | $port->write("s".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 763 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $nex=dd2nex($ra, $de); | |||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $port->write("S".$nex); | |||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | my $response = read_telescope($port, 1); | |||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 770 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | sub tc_sync_rade_p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_sync_rade_p: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | return tc_sync_rade(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | =item tc_goto_in_progress(port) | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | Returns 1 if GOTO is in progress else 0 is returned. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub tc_goto_in_progress($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_in_progress: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | $port->write("L"); | |||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my $response = read_telescope($port, 2); | |||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | return substr($response, 0, 1); | |||||||||||||||||||||||||||||||||||||||||
| 793 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | =item tc_goto_cancel(port) | ||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||
| 800 | Cancels the GOTO operation. On success 1 is returned. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | sub tc_goto_cancel($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_goto_cancel: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | $port->write("M"); | |||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my $response = read_telescope($port, 1); | |||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 812 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | =item tc_echo(port, char) | ||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | Checks the communication with the telescope. This function sends char to the telescope and | ||||||||||||||||||||||||||||||||||||||||||
| 820 | returns the echo received. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | ▶ | sub tc_echo($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_echo: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | my ($port, $char) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | $port->write("K".substr($char, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | my $response = read_telescope($port, 2); | |||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | return substr($response, 0, 1); | |||||||||||||||||||||||||||||||||||||||||
| 832 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | =item tc_get_model(port) | ||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | This function returns the mount model as a number. See CELESTRON documentation. | ||||||||||||||||||||||||||||||||||||||||||
| 840 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | sub tc_get_model($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_model: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | return undef if version_before(VER_2_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | $port->write("m"); | |||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | my $response = read_telescope($port, 2); | |||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | return ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 852 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||
| 857 | =item tc_get_version(port) | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | This function returns the mount version as a strng or as major and minor numbers in array context See CELESTRON documentation. | ||||||||||||||||||||||||||||||||||||||||||
| 860 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | ▶ | sub tc_get_version($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_version: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | return undef if version_before(VER_1_2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | $port->write("V"); | |||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | my $response = read_telescope($port, 7, 1); | |||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | ▶ | if (length($response) == 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | return wantarray ? (ord(substr($response, 0, 1)),ord(substr($response, 1, 1))) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 873 | : ord(substr($response, 0, 1)).".".ord(substr($response, 1, 1)); | ||||||||||||||||||||||||||||||||||||||||||
| 874 | } elsif (length($response) == 7) { | ||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | ▶ | return wantarray ? (hex(substr($response, 0, 2)),hex(substr($response, 2, 2)),hex(substr($response, 4, 2))) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 876 | : hex(substr($response, 0, 2)).".".hex(substr($response, 2, 2)).".".hex(substr($response, 4, 2)); | ||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | =item tc_get_location(port) | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | This function returns the stored location coordinates lon, lat in decimal degrees. | ||||||||||||||||||||||||||||||||||||||||||
| 887 | Negative longitude is WEST. Negative latitude is SOUTH. | ||||||||||||||||||||||||||||||||||||||||||
| 888 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | =item tc_get_location_str(port) | ||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||
| 892 | This function returns the stored location coordinates lon and lat as strings. | ||||||||||||||||||||||||||||||||||||||||||
| 893 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | ▶ | sub tc_get_location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_location: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | my ($port,$str) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | return undef if version_before(VER_2_3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | $port->write("w"); | |||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $response = read_telescope($port, 9); | |||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | my $latd=ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $latm=ord(substr($response, 1, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my $lats=ord(substr($response, 2, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | my $lato=ord(substr($response, 3, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $lond=ord(substr($response, 4, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | my $lonm=ord(substr($response, 5, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my $lons=ord(substr($response, 6, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | my $lono=ord(substr($response, 7, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my $lon; | |||||||||||||||||||||||||||||||||||||||||
| 917 | my $lat; | ||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | if((defined $str) and ($str =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $str and
MC/DC0%0/1
defined $str and
defined $str
Truth table0%0/2
A
A= defined $str
| |||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | $lat=sprintf("%d %02d'%02d\"N",$latd,$latm,$lats); | |||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $lon=sprintf("%d %02d'%02d\"E",$lond,$lonm,$lons); | |||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ▶ | if ($lato) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | $lat =~ s/N$/S/; | |||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if ($lono) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $lon =~ s/E$/W/; | |||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 927 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $lat=($latd + $latm/60.0 + $lats/3600.0); | |||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $lon=($lond + $lonm/60.0 + $lons/3600.0); | |||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | if ($lato) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | $lat *= -1; | |||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | if ($lono) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | $lon *= -1; | |||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | return ($lon, $lat); | |||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | sub tc_get_location_str { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_location_str: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | return tc_get_location(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||
| 944 | =item tc_set_location(port,lon,lat) | ||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | This function sets the location coordinates lon, lat in decimal degrees. | ||||||||||||||||||||||||||||||||||||||||||
| 947 | Negative longitude is WEST. Negative latitude is SOUTH. | ||||||||||||||||||||||||||||||||||||||||||
| 948 | If the coordinates are invalid -1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 949 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||
| 951 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | sub tc_set_location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_set_location: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | my ($port,$lon,$lat) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | my $issouth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | my $iswest = 0; | |||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | return undef if version_before(VER_2_3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | ▶ | if ($lon < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | $lon *= -1; | |||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | $iswest = 1; | |||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | if ($lat < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | $lat *= -1; | |||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | $issouth = 1; | |||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | if (($lat > 90) or ($lon > 180)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lat > 90 or $lon > 180
MC/DC0%0/2
$lat > 90 or $lon > 180
$lat > 90
$lon > 180
Truth table0%0/3
A or B
A= $lat > 90B= $lon > 180
| |||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | my ($lond,$lonm,$lons) = d2dms2($lon); | |||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | my ($latd,$latm,$lats) = d2dms2($lat); | |||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | $port->write("W"); | |||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | $port->write(chr($latd)); | |||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | $port->write(chr($latm)); | |||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | $port->write(chr($lats)); | |||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | $port->write(chr($issouth)); | |||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | $port->write(chr($lond)); | |||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | $port->write(chr($lonm)); | |||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | $port->write(chr($lons)); | |||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | $port->write(chr($iswest)); | |||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my $response = read_telescope($port, 1); | |||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 988 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||
| 993 | =item tc_get_time(port) | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | This function returns the stored time (in Unix time format), timezone (in hours) and daylight saving time(0|1). | ||||||||||||||||||||||||||||||||||||||||||
| 996 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||
| 998 | =item tc_get_time_str(port) | ||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||
| 1000 | This function returns the stored date, time (as strings), timezone (in hours) and daylight saving time(0|1). | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||
| 1003 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | sub tc_get_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_time: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | my ($port,$str) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | ▶ | return undef if version_before(VER_2_3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | $port->write("h"); | |||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | my $response = read_telescope($port, 9); | |||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | my $h=ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | my $m=ord(substr($response, 1, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | my $s=ord(substr($response, 2, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | my $mon=ord(substr($response, 3, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | my $day=ord(substr($response, 4, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | my $year=ord(substr($response, 5, 1))+2000; | |||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | my $tz=ord(substr($response, 6, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | $tz -= 256 if ($tz > 12); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | my $dst=ord(substr($response, 7, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | ▶ | if((defined $str) and ($str =! 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
defined $str and
MC/DC0%0/1
defined $str and
defined $str
Truth table0%0/2
A
A= defined $str
| |||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | my $time=sprintf("%2d:%02d:%02d",$h,$m,$s); | |||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | my $date=sprintf("%02d-%02d-%04d",$day,$mon,$year); | |||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | return ($date,$time, $tz, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 1030 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | my $time = timelocal($s,$m,$h,$day,$mon-1,$year); | |||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | return ($time, $tz, $dst); | |||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | sub tc_get_time_str { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_time_str: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | return tc_get_time(@_, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | =item tc_set_time(port, time, timezone, daylightsaving) | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | This function sets the time (in Unix time format), timezone (in hours) and daylight saving time(0|1). | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | On success 1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | If no response received, undef is returned. If the mount is known to have RTC | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | (currently only CGE and AdvancedVX) and NexStarCtl::use_rtc is defined and != 0 (default is 0), the date/time is | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | set to the RTC too. | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | NOTE: Do not set NexStarCtl::use_rtc if the mount is SkyWatcher otherwise tc_set_time() may fail. | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | ▶ | sub tc_set_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_set_time: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | my ($port, $time, $tz, $dst) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | ▶ | return undef if version_before(VER_2_3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | my $timezone = $tz; | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | ▶ | $tz += 256 if ($tz < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | ▶ | if ((defined $dst) and ($dst != 0)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $dst and $dst != 0
MC/DC0%0/2
defined $dst and $dst != 0
defined $dst
$dst != 0
Truth table0%0/3
A and B
A= defined $dstB= $dst != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | $dst=1; | |||||||||||||||||||||||||||||||||||||||||
| 1061 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | $dst=0; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | my ($s,$m,$h,$day,$mon,$year,$wday,$yday,$isdst) = localtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | $port->write("H"); | |||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | $port->write(chr($h)); | |||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $port->write(chr($m)); | |||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | $port->write(chr($s)); | |||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | $port->write(chr($mon+1)); | |||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | $port->write(chr($day)); | |||||||||||||||||||||||||||||||||||||||||
| 1073 | # $year is actual_year-1900 | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | # here is required actual_year-2000 | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | # so we need $year-100 | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | $port->write(chr($year-100)); | |||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | $port->write(chr($tz)); | |||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | $port->write(chr($dst)); | |||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | my $response = read_telescope($port, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||
| 1085 | # return success if the RTC is not used | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | ▶ | if (($use_rtc == 0) or ($use_rtc == undef)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$use_rtc == 0 or $use_rtc == undef
MC/DC0%0/2
$use_rtc == 0 or $use_rtc == undef
$use_rtc == 0
$use_rtc == undef
Truth table0%0/3
A or B
A= $use_rtc == 0B= $use_rtc == undef
| |||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | my $model = tc_get_model($port); | |||||||||||||||||||||||||||||||||||||||||
| 1091 | # If the mount has RTC set date/time to RTC too | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | # I only know CGE(5) and AdvancedVX(20) to have RTC | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | if (($model == 5) or ($model == 20)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$model == 5 or $model == 20
MC/DC0%0/2
$model == 5 or $model == 20
$model == 5
$model == 20
Truth table0%0/3
A or B
A= $model == 5B= $model == 20
| |||||||||||||||||||||||||||||||||||||||||||
| 1094 | # RTC expects UT, convert localtime to UT | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | my ($s,$m,$h,$day,$mon,$year,$wday,$yday,$isdst) = localtime($time - (($timezone + $dst) * 3600)); | |||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | # Set year | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | my $response = tc_pass_through_cmd($port, 3, 178, 132, | |||||||||||||||||||||||||||||||||||||||||
| 1099 | int(($year + 1900) / 256), | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | int(($year + 1900) % 256), 0, 0); | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | # Set month and day | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | my $response = tc_pass_through_cmd($port, 3, 178, 131, $mon+1, $day, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | # Set time | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | my $response = tc_pass_through_cmd($port, 4, 178, 179, $h, $m, $s, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | if (! defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||
| 1120 | =item tc_get_tracking_mode(port) | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | Reads the tracking mode of the mount and returns one of the folowing: | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | TC_TRACK_OFF, TC_TRACK_ALT_AZ, TC_TRACK_EQ_NORTH (Celestron only), TC_TRACK_EQ_SOUTH (Celestron only), | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | TC_TRACK_EQ (SkyWatcher only) and TC_TRACK_EQ_PEC (Sky-Watcher only). | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | ▶ | sub tc_get_tracking_mode($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_tracking_mode: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | my ($port) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | my $mode; | |||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | return undef if version_before(VER_2_3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | $port->write("t"); | |||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | my $response = read_telescope($port, 2); | |||||||||||||||||||||||||||||||||||||||||
| 1136 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | $mode = ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1138 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||
| 1142 | # Sky-Watcher mount | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | ▶ | if(vendor_is(VNDR_SKYWATCHER)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | if ($mode == SW_TC_TRACK_OFF) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1145 | 0 | return TC_TRACK_OFF; | |||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||
| 1147 | } elsif ($mode == SW_TC_TRACK_ALT_AZ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | return TC_TRACK_ALT_AZ; | |||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | } elsif ($mode == SW_TC_TRACK_EQ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | return TC_TRACK_EQ; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||
| 1153 | } elsif ($mode == SW_TC_TRACK_EQ_PEC) { | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | return TC_TRACK_EQ_PEC; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | # Celestron mount | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | ▶ | if ($mode == NX_TC_TRACK_OFF) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | return TC_TRACK_OFF; | |||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | } elsif ($mode == NX_TC_TRACK_ALT_AZ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | 0 | return TC_TRACK_ALT_AZ; | |||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||
| 1164 | } elsif ($mode == NX_TC_TRACK_EQ_NORTH) { | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | return TC_TRACK_EQ_NORTH; | |||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | } elsif ($mode == NX_TC_TRACK_EQ_SOUTH) { | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | return TC_TRACK_EQ_SOUTH; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | =item tc_set_tracking_mode(port, mode) | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | Sets the tracking mode of the mount to one of the folowing: | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | TC_TRACK_OFF, TC_TRACK_ALT_AZ, TC_TRACK_EQ_NORTH, TC_TRACK_EQ_SOUTH, TC_TRACK_EQ and TC_TRACK_EQ_PEC. | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | For Sky-Watcher TC_TRACK_EQ_NORTH, TC_TRACK_EQ_SOUTH and TC_TRACK_EQ do the same thing. For Celestron | ||||||||||||||||||||||||||||||||||||||||||
| 1179 | TC_TRACK_EQ is interpreted as TC_TRACK_EQ_NORTH or TC_TRACK_EQ_SOUTH depending on the geographic latitude | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | of the location (Northern or Southern hemisphere). If the mode is not one of the listed -1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | 0 | ▶ | sub tc_set_tracking_mode($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_set_tracking_mode: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1185 | 0 | my ($port,$mode) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | my $_mode; | |||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | ▶ | return undef if version_before(VER_1_6); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | # Sky-Watcher mount | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | 0 | ▶ | if(vendor_is(VNDR_SKYWATCHER)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1192 | 0 | ▶ | if ($mode == TC_TRACK_OFF) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | $_mode = TC_TRACK_OFF; | |||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | } elsif ($mode == TC_TRACK_ALT_AZ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | $_mode = SW_TC_TRACK_ALT_AZ; | |||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||
| 1198 | ▶ | } elsif (($mode == TC_TRACK_EQ) or | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$mode == 4 or $mode == 2 or $mode == 3
$mode == 4 or $mode == 2
MC/DC0%0/3
$mode == 4 or $mode == 2 or $mode == 3
$mode == 4
$mode == 2
$mode == 3
Truth table0%0/4
A or B or C
A= $mode == 4B= $mode == 2C= $mode == 3
| |||||||||||||||||||||||||||||||||||||||||||
| 1199 | ($mode == TC_TRACK_EQ_NORTH) or | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | ($mode == TC_TRACK_EQ_SOUTH)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | $_mode = SW_TC_TRACK_EQ; | |||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | } elsif ($mode == TC_TRACK_EQ_PEC) { | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | $_mode = SW_TC_TRACK_EQ_PEC; | |||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | # Celestron mount | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | if ($mode == TC_TRACK_OFF) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | $_mode = NX_TC_TRACK_OFF; | |||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | } elsif ($mode == TC_TRACK_ALT_AZ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | $_mode = NX_TC_TRACK_ALT_AZ; | |||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | } elsif ($mode == TC_TRACK_EQ_NORTH) { | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | $_mode = NX_TC_TRACK_EQ_NORTH; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | } elsif ($mode == TC_TRACK_EQ_SOUTH) { | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | $_mode = NX_TC_TRACK_EQ_SOUTH; | |||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | } elsif ($mode == TC_TRACK_EQ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | my (undef, $lat) = tc_get_location($port); | |||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | if (!defined $lat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | ▶ | if ($lat < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | $_mode = NX_TC_TRACK_EQ_SOUTH; | |||||||||||||||||||||||||||||||||||||||||
| 1231 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | $_mode = NX_TC_TRACK_EQ_NORTH; | |||||||||||||||||||||||||||||||||||||||||
| 1233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | } elsif ($mode == TC_TRACK_EQ_PEC) { | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | # unsupported on Celestron | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | $error = -5; | |||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | $port->write("T"); | |||||||||||||||||||||||||||||||||||||||||
| 1246 | 0 | $port->write(chr($_mode)); | |||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | my $response = read_telescope($port, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1250 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | =item tc_slew_fixed(port, axis, direction, rate) | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | Move the telescope the telescope around a specified axis in a given direction with fixed rate. | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction can accept values | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | TC_DIR_POSITIVE and TC_DIR_NEGATIVE. Rate is from 0 to 9. Where 0 stops slewing and 9 is | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | the fastest speed. | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | On success 1 is returned. If rate is out of range -1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||||||||||||
| 1266 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | ▶ | sub tc_slew_fixed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_slew_fixed: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | my ($port,$axis,$direction,$rate) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | 0 | ▶ | if(vendor_is(VNDR_SKYWATCHER)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | ▶ | return undef if release_before(3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | return undef if revision_before(1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1273 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | ▶ | return undef if version_before(VER_1_6); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | ▶ | if ($axis>0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1279 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | ▶ | if ($direction > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | $direction = _TC_DIR_POSITIVE + 30; | |||||||||||||||||||||||||||||||||||||||||
| 1285 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | $direction = _TC_DIR_NEGATIVE + 30; | |||||||||||||||||||||||||||||||||||||||||
| 1287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | ▶ | if (($rate < 0) or ($rate > 9)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rate < 0 or $rate > 9
MC/DC0%0/2
$rate < 0 or $rate > 9
$rate < 0
$rate > 9
Truth table0%0/3
A or B
A= $rate < 0B= $rate > 9
| |||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | $rate = int($rate); | |||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | my $response = tc_pass_through_cmd($port, 2, $axis, $direction, $rate, 0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1297 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||
| 1302 | =item tc_slew_variable(port, axis, direction, rate) | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||
| 1304 | Move the telescope the telescope around a specified axis in a given direction with specified rate. | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||
| 1306 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction can accept values | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | TC_DIR_POSITIVE and TC_DIR_NEGATIVE. Rate is the speed in arcsec/sec. For example 3600 | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | represents 1degree/sec. | ||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | On success 1 is returned. If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||
| 1312 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | ▶ | sub tc_slew_variable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_slew_variable: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | my ($port,$axis,$direction,$rate) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | ▶ | if(vendor_is(VNDR_SKYWATCHER)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | ▶ | return undef if release_before(3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | ▶ | return undef if revision_before(1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1319 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | ▶ | return undef if version_before(VER_1_6); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | ▶ | if ($axis>0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1325 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | 0 | ▶ | if ($direction > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1330 | 0 | $direction = _TC_DIR_POSITIVE; | |||||||||||||||||||||||||||||||||||||||||
| 1331 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | $direction = _TC_DIR_NEGATIVE; | |||||||||||||||||||||||||||||||||||||||||
| 1333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | $rate = int(4*$rate); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | my $rateH = int($rate / 256); | |||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | my $rateL = $rate % 256; | |||||||||||||||||||||||||||||||||||||||||
| 1338 | #print "RATEf : $rateH $rateL\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||
| 1340 | 0 | my $response = tc_pass_through_cmd($port, 3, $axis, $direction, $rateH, $rateL, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1341 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1342 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1343 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | =item get_model_name(model_id) | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||
| 1350 | Return the name of the mount by the id from tc_get_model(). | ||||||||||||||||||||||||||||||||||||||||||
| 1351 | If the mount is not known undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | ▶ | sub get_model_name($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_model_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | my ($model_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | return $mounts{$mount_vendor}{$model_id}; | |||||||||||||||||||||||||||||||||||||||||
| 1358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||
| 1360 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||||||||||||||||
| 1362 | =head1 AUX COMMANDS | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | The following commands are not officially documented by Celestron. Please note that these | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | commands are reverse engineered and may not work exactly as expected. | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | =item tc_get_autoguide_rate(port, axis) | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | Get autoguide rate for the given axis in percents of the sidereal rate. | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||
| 1375 | On success current value of autoguide rate is returned in the range [0-99]. | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | ▶ | sub tc_get_autoguide_rate($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_autoguide_rate: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | my ($port,$axis) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | ▶ | return undef if version_before(VER_AUX); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | ▶ | if ($axis > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1384 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1385 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | # Get autoguide rate (0x47) | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | my $response = tc_pass_through_cmd($port, 1, $axis, 0x47, 0, 0, 0, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1392 | 0 | my $rate = ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | return int(100 * $rate / 256); | |||||||||||||||||||||||||||||||||||||||||
| 1394 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | =item tc_set_autoguide_rate(port, axis, rate) | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||
| 1401 | Set autoguide rate for the given axis in percents of the sidereal rate. | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | Rate must be in the range [0-99]. | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | On success 1 is returned. If rate is out of range -1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | ▶ | sub tc_set_autoguide_rate($$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_set_autoguide_rate: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | my ($port,$axis,$rate) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||||||||||||
| 1412 | 0 | ▶ | return undef if version_before(VER_AUX); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | if ($axis > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1416 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | # $rate should be [0%-99%] | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | 0 | my $rate = int($rate); | |||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | ▶ | if (($rate < 0) or ($rate > 99)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rate < 0 or $rate > 99
MC/DC0%0/2
$rate < 0 or $rate > 99
$rate < 0
$rate > 99
Truth table0%0/3
A or B
A= $rate < 0B= $rate > 99
| |||||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | # This is wired, but is done to match as good as | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | # possible the values given by the HC | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | 0 | my$rrate; | |||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | ▶ | if ($rate == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | $rrate = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1431 | } elsif ($rate == 99) { | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | 0 | $rrate = 255; | |||||||||||||||||||||||||||||||||||||||||
| 1433 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | 0 | $rrate = int((256 * $rate / 100) + 1); | |||||||||||||||||||||||||||||||||||||||||
| 1435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||
| 1437 | # Set autoguide rate (0x46) | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | 0 | my $response = tc_pass_through_cmd($port, 2, $axis, 0x46, $rrate, 0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1439 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1440 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1441 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | =item tc_get_backlash(port, axis, direction) | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||
| 1448 | Get anti-backlash values for the specified axis in a given direction. | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | can accept values TC_DIR_POSITIVE and TC_DIR_NEGATIVE. | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||
| 1453 | On success current value of backlash is returned in the range [0-99]. | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | sub tc_get_backlash($$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_get_backlash: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | my ($port,$axis,$direction) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | ▶ | return undef if vendor_not(VNDR_CELESTRON); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1460 | 0 | ▶ | return undef if version_before(VER_AUX); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | ▶ | if ($axis > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1464 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1465 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | 0 | ▶ | if ($direction > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1469 | 0 | $direction = 0x40; # Get positive backlash | |||||||||||||||||||||||||||||||||||||||||
| 1470 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | 0 | $direction = 0x41; # Get negative backlash | |||||||||||||||||||||||||||||||||||||||||
| 1472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | 0 | my $response = tc_pass_through_cmd($port, 1, $axis, $direction, 0, 0, 0, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1475 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | return ord(substr($response, 0, 1)); | |||||||||||||||||||||||||||||||||||||||||
| 1477 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||
| 1482 | =item tc_set_backlash(port, axis, direction, backlash) | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||
| 1484 | Set anti-backlash values for the specified axis in a given direction. | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction can accept | ||||||||||||||||||||||||||||||||||||||||||
| 1487 | values TC_DIR_POSITIVE and TC_DIR_NEGATIVE. Backlash must be in the range [0-99]. | ||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | On success 1 is returned. If backlash is out of range -1 is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | If no response received, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1491 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | ▶ | sub tc_set_backlash($$$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_set_backlash: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1493 | 0 | my ($port,$axis,$direction,$backlash) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | 0 | ▶ | return undef if vendor_not(VNDR_CELESTRON); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1496 | 0 | ▶ | return undef if version_before(VER_AUX); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||
| 1498 | 0 | ▶ | if ($axis > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1499 | 0 | $axis = _TC_AXIS_RA_AZM; | |||||||||||||||||||||||||||||||||||||||||
| 1500 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | 0 | $axis = _TC_AXIS_DE_ALT; | |||||||||||||||||||||||||||||||||||||||||
| 1502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||||||||||||
| 1504 | 0 | ▶ | if ($direction > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1505 | 0 | $direction = 0x10; # Set positive backlash | |||||||||||||||||||||||||||||||||||||||||
| 1506 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1507 | 0 | $direction = 0x11; # Set negative backlash | |||||||||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||
| 1510 | 0 | my $backlash = int($backlash); | |||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | ▶ | if (($backlash < 0) or ($backlash > 99)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$backlash < 0 or $backlash > 99
MC/DC0%0/2
$backlash < 0 or $backlash > 99
$backlash < 0
$backlash > 99
Truth table0%0/3
A or B
A= $backlash < 0B= $backlash > 99
| |||||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | my $response = tc_pass_through_cmd($port, 2, $axis, $direction, $backlash, 0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 1516 | 0 | ▶ | if (defined $response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1517 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1518 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | =item tc_pass_through_cmd(port, msg_len, dest_id, cmd_id, data1, data2, data3, res_len) | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | Send a pass through command to a specific device. This function is meant for an internal | ||||||||||||||||||||||||||||||||||||||||||
| 1526 | library use and should not be used, unless you know exactly what you are doing. | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | Calling this function with wrong parameters can be dangerous and can break the telescope! | ||||||||||||||||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||||||||||||||||
| 1529 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | ▶ | sub tc_pass_through_cmd($$$$$$$$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tc_pass_through_cmd: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1531 | 0 | my ($port, $msg_len, $dest_id, $cmd_id, $data1, $data2, $data3, $res_len) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | $port->write("P"); | |||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | $port->write(chr($msg_len)); | |||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | $port->write(chr($dest_id)); | |||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | $port->write(chr($cmd_id)); | |||||||||||||||||||||||||||||||||||||||||
| 1537 | 0 | $port->write(chr($data1)); | |||||||||||||||||||||||||||||||||||||||||
| 1538 | 0 | $port->write(chr($data2)); | |||||||||||||||||||||||||||||||||||||||||
| 1539 | 0 | $port->write(chr($data3)); | |||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | $port->write(chr($res_len)); | |||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||
| 1542 | # we should read $res_len + 1 byes to accomodate '#' at the end | ||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | return read_telescope($port, $res_len + 1); | |||||||||||||||||||||||||||||||||||||||||
| 1544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1545 | |||||||||||||||||||||||||||||||||||||||||||
| 1546 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||
| 1548 | =head1 UTILITY FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||
| 1550 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | =item notnum(n) | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | If "n" is a real number returns 0 else it returns 1. | ||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||
| 1556 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | sub notnum($) | ||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | ▶ | { my ($num) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
notnum: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | if ($num=~ /^[-+]?\d+\.?\d*$/) {return 0;} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | else {return 1;} | |||||||||||||||||||||||||||||||||||||||||
| 1561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||
| 1564 | =item precess(ra0, dec0, equinox0, equinox1) | ||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||
| 1566 | Precesses coordinates ra0 and dec0 from equinox0 to equinox1 and returns the calculated ra1 and dec1. | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | Where ra and dec should be in decimal degrees and equinox should be in years (and fraction of the year). | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||
| 1569 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | sub precess(@) | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
precess: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1572 | 0 | my ($ra0,$de0,$eq0,$eq1)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1573 | 0 | my ($cosd,$ra,$dec, | |||||||||||||||||||||||||||||||||||||||||
| 1574 | $A,$B,$C, | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | $x0,$y0,$z0, | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | $x1,$y1,$z1, | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | $ST,$T,$sec2rad); | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | my @rot; | |||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | my ($sinA,$sinB,$sinC,$cosA,$cosB,$cosC,$sind); | |||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my ($ra1,$de1); | |||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | $ra = $ra0*DEG2RAD; | |||||||||||||||||||||||||||||||||||||||||
| 1585 | 0 | $dec = $de0*DEG2RAD; | |||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | 0 | $cosd = cos($dec); | |||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | 0 | $x0=$cosd*cos($ra); | |||||||||||||||||||||||||||||||||||||||||
| 1590 | 0 | $y0=$cosd*sin($ra); | |||||||||||||||||||||||||||||||||||||||||
| 1591 | 0 | $z0=sin($dec); | |||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | 0 | $ST=($eq0-2000.0)*0.001; | |||||||||||||||||||||||||||||||||||||||||
| 1594 | 0 | $T=($eq1-$eq0)*0.001; | |||||||||||||||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||||||||||||||||
| 1596 | 0 | $sec2rad=(DEG2RAD)/3600.0; | |||||||||||||||||||||||||||||||||||||||||
| 1597 | 0 | $A=$sec2rad*$T*(23062.181+$ST*(139.656+0.0139*$ST)+$T* | |||||||||||||||||||||||||||||||||||||||||
| 1598 | (30.188-0.344*$ST+17.998*$T)); | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | 0 | $B=$sec2rad*$T*$T*(79.280+0.410*$ST+0.205*$T)+$A; | |||||||||||||||||||||||||||||||||||||||||
| 1600 | 0 | $C=$sec2rad*$T*(20043.109-$ST*(85.33+0.217*$ST)+$T* | |||||||||||||||||||||||||||||||||||||||||
| 1601 | (-42.665-0.217*$ST-41.833*$T)); | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | 0 | $sinA=sin($A); $sinB=sin($B); $sinC=sin($C); | |||||||||||||||||||||||||||||||||||||||||
| 1604 | 0 | $cosA=cos($A); $cosB=cos($B); $cosC=cos($C); | |||||||||||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||||||||||||
| 1606 | 0 | $rot[0][0]=$cosA*$cosB*$cosC-$sinA*$sinB; | |||||||||||||||||||||||||||||||||||||||||
| 1607 | 0 | $rot[0][1]=(-1)*$sinA*$cosB*$cosC-$cosA*$sinB; | |||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | $rot[0][2]=(-1)*$sinC*$cosB; | |||||||||||||||||||||||||||||||||||||||||
| 1609 | |||||||||||||||||||||||||||||||||||||||||||
| 1610 | 0 | $rot[1][0]=$cosA*$cosC*$sinB+$sinA*$cosB; | |||||||||||||||||||||||||||||||||||||||||
| 1611 | 0 | $rot[1][1]=(-1)*$sinA*$cosC*$sinB+$cosA*$cosB; | |||||||||||||||||||||||||||||||||||||||||
| 1612 | 0 | $rot[1][2]=(-1)*$sinB*$sinC; | |||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | $rot[2][0]=$cosA*$sinC; | |||||||||||||||||||||||||||||||||||||||||
| 1615 | 0 | $rot[2][1]=(-1)*$sinA*$sinC; | |||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | $rot[2][2]=$cosC; | |||||||||||||||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||||||||||||||||
| 1618 | 0 | $x1=$rot[0][0]*$x0+$rot[0][1]*$y0+$rot[0][2]*$z0; | |||||||||||||||||||||||||||||||||||||||||
| 1619 | 0 | $y1=$rot[1][0]*$x0+$rot[1][1]*$y0+$rot[1][2]*$z0; | |||||||||||||||||||||||||||||||||||||||||
| 1620 | 0 | $z1=$rot[2][0]*$x0+$rot[2][1]*$y0+$rot[2][2]*$z0; | |||||||||||||||||||||||||||||||||||||||||
| 1621 | |||||||||||||||||||||||||||||||||||||||||||
| 1622 | 0 | ▶ | if ($x1==0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | if ($y1 > 0) { $ra1=90.0;} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1624 | 0 | else { $ra1=270.0;} | |||||||||||||||||||||||||||||||||||||||||
| 1625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1626 | 0 | else {$ra1=atan2($y1,$x1)*RAD2DEG;} | |||||||||||||||||||||||||||||||||||||||||
| 1627 | 0 | ▶ | if($ra1<0) { $ra1+=360;} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | $de1=RAD2DEG*atan2($z1,sqrt(1-$z1*$z1)); | |||||||||||||||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||||||||||||||||
| 1631 | 0 | return ($ra1,$de1); | |||||||||||||||||||||||||||||||||||||||||
| 1632 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | |||||||||||||||||||||||||||||||||||||||||||
| 1634 | ######################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1635 | ######## Mathematics | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | ######################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||
| 1638 | =item round(n) | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||
| 1640 | Returns the rounded number n. | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||||||||||||||||
| 1642 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | ▶ | sub round($){ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
round: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1644 | 0 | my($num)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1645 | 0 | my ($retval); | |||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | ▶ | if (($num - floor($num)) < 0.5) { $retval = floor($num); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | else { $retval = floor($num) + 1; } | |||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | return $retval; | |||||||||||||||||||||||||||||||||||||||||
| 1649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||
| 1652 | =item d2hms(deg) | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||
| 1654 | Converts deg (in decimal degrees) to string in hours, minutes and seconds notion (like "12h 10m 44s"). | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||
| 1656 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | sub d2hms($) # Looks OK! :) | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d2hms: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1659 | 0 | my ($ra)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | 0 | $ra=$ra/15; | |||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | my $hr=int($ra*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1663 | 0 | my $hour=int($hr/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1664 | 0 | my $f=int($hr%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | my $sec=int($f%60); | |||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | my $ra_str = sprintf "%02dh %02dm %02ds", $hour,$min,$sec; | |||||||||||||||||||||||||||||||||||||||||
| 1668 | 0 | return $ra_str; | |||||||||||||||||||||||||||||||||||||||||
| 1669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | =item d2dms(deg) | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | Converts deg (in decimal degrees) to string in degrees, minutes and seconds notion | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | (like "33:20:44"). | ||||||||||||||||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||||||||||||||||
| 1676 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1677 | sub d2dms($) # Looks OK! :) | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d2dms: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | my ($ang)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | ▶ | if ($ang >= 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | my $a=int($ang*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | my $deg=int($a/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | my $f=int($a%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1685 | 0 | my $sec=int($f%60); | |||||||||||||||||||||||||||||||||||||||||
| 1686 | 0 | my $ang_str=sprintf "%02d:%02d:%02d",$deg,$min,$sec; | |||||||||||||||||||||||||||||||||||||||||
| 1687 | 0 | return $ang_str; | |||||||||||||||||||||||||||||||||||||||||
| 1688 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | 0 | $ang*=-1; | |||||||||||||||||||||||||||||||||||||||||
| 1690 | 0 | my $a=int($ang*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | my $deg=int($a/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | my $f=int($a%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1693 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | my $sec=int($f%60); | |||||||||||||||||||||||||||||||||||||||||
| 1695 | 0 | my $ang_str=sprintf "-%02d:%02d:%02d",$deg,$min,$sec; | |||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | return $ang_str; | |||||||||||||||||||||||||||||||||||||||||
| 1697 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | ▶ | sub d2dms2($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d2dms2: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1701 | 0 | my ($ang)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | ▶ | if ($ang >= 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1703 | 0 | my $a=int($ang*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1704 | 0 | my $deg=int($a/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | my $f=int($a%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1706 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1707 | 0 | my $sec=int($f%60); | |||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | return ($deg,$min,$sec); | |||||||||||||||||||||||||||||||||||||||||
| 1709 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | 0 | $ang*=-1; | |||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | my $a=int($ang*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1712 | 0 | my $deg=int($a/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1713 | 0 | my $f=int($a%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | my $sec=int($f%60); | |||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | return (-1*$deg,$min,$sec); | |||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | |||||||||||||||||||||||||||||||||||||||||||
| 1720 | =item d2dms(deg) | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||
| 1722 | converts deg (in decimal degrees) to string in degrees and minutes notion (like "33:20"). | ||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | sub d2dm($) | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
d2dm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1727 | 0 | my ($ang)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1728 | 0 | my $a=int($ang*3600+0.5); | |||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | my $deg=int($a/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1730 | 0 | my $f=int($a%3600); | |||||||||||||||||||||||||||||||||||||||||
| 1731 | 0 | my $min=int($f/60); | |||||||||||||||||||||||||||||||||||||||||
| 1732 | 0 | my $ang_str=sprintf "%02d:%02d",$deg,$min; | |||||||||||||||||||||||||||||||||||||||||
| 1733 | 0 | return $ang_str; | |||||||||||||||||||||||||||||||||||||||||
| 1734 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | |||||||||||||||||||||||||||||||||||||||||||
| 1736 | =item dms2d(string) | ||||||||||||||||||||||||||||||||||||||||||
| 1737 | |||||||||||||||||||||||||||||||||||||||||||
| 1738 | converts string of the format "dd:mm:ss" to decimal degrees. If the string format | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | is invalid format, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | sub dms2d($) | ||||||||||||||||||||||||||||||||||||||||||
| 1743 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dms2d: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1744 | 0 | my ($angle)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | my (@dms)=split(/:/,$angle); | |||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | ▶ | if (@dms>3 or $angle eq "") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@dms > 3 or $angle eq ""
MC/DC0%0/2
@dms > 3 or $angle eq ""
@dms > 3
$angle eq ""
Truth table0%0/3
A or B
A= @dms > 3B= $angle eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 1748 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||
| 1751 | 0 | ▶ | if (!($dms[0]=~ /^[+-]?\d+$/)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1752 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1753 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | 0 | ▶ | if ($dms[1]<0 or $dms[1]>59 or $dms[1]=~/[\D]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$dms[1] < 0 or $dms[1] > 59 or $dms[1] =~ /[\D]/
$dms[1] < 0 or $dms[1] > 59
MC/DC0%0/3
$dms[1] < 0 or $dms[1] > 59 or $dms[1] =~ /[\D]/
$dms[1] < 0
$dms[1] > 59
$dms[1] =~ /[\D]/
Truth table0%0/4
A or B or C
A= $dms[1] < 0B= $dms[1] > 59C= $dms[1] =~ /[\D]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1755 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1756 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | 0 | ▶ | if ($dms[2]<0 or $dms[2]>59 or $dms[2]=~/[\D]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$dms[2] < 0 or $dms[2] > 59 or $dms[2] =~ /[\D]/
$dms[2] < 0 or $dms[2] > 59
MC/DC0%0/3
$dms[2] < 0 or $dms[2] > 59 or $dms[2] =~ /[\D]/
$dms[2] < 0
$dms[2] > 59
$dms[2] =~ /[\D]/
Truth table0%0/4
A or B or C
A= $dms[2] < 0B= $dms[2] > 59C= $dms[2] =~ /[\D]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1758 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1759 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1760 | |||||||||||||||||||||||||||||||||||||||||||
| 1761 | 0 | ▶ | if ($dms[0]=~ /^-/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1762 | 0 | return ($dms[0]-$dms[1]/60-$dms[2]/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1763 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | return ($dms[0]+$dms[1]/60+$dms[2]/3600); | |||||||||||||||||||||||||||||||||||||||||
| 1765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||
| 1768 | =item hms2d(string) | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | Converts string of the format "hh:mm:ss" to decimal degrees. If the string format | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | is invalid format, undef is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | sub hms2d($) | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hms2d: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1776 | 0 | my ($hours)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 1777 | |||||||||||||||||||||||||||||||||||||||||||
| 1778 | 0 | my (@hms)=split(/:/,$hours); | |||||||||||||||||||||||||||||||||||||||||
| 1779 | 0 | ▶ | if (@hms>3 or $hours eq "") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@hms > 3 or $hours eq ""
MC/DC0%0/2
@hms > 3 or $hours eq ""
@hms > 3
$hours eq ""
Truth table0%0/3
A or B
A= @hms > 3B= $hours eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 1780 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||
| 1783 | 0 | ▶ | if ($hms[0]<0 or $hms[0]>23 or $hms[0]=~/[\D]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$hms[0] < 0 or $hms[0] > 23 or $hms[0] =~ /[\D]/
$hms[0] < 0 or $hms[0] > 23
MC/DC0%0/3
$hms[0] < 0 or $hms[0] > 23 or $hms[0] =~ /[\D]/
$hms[0] < 0
$hms[0] > 23
$hms[0] =~ /[\D]/
Truth table0%0/4
A or B or C
A= $hms[0] < 0B= $hms[0] > 23C= $hms[0] =~ /[\D]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1784 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | 0 | ▶ | if ($hms[1]<0 or $hms[1]>59 or $hms[1]=~/[\D]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$hms[1] < 0 or $hms[1] > 59 or $hms[1] =~ /[\D]/
$hms[1] < 0 or $hms[1] > 59
MC/DC0%0/3
$hms[1] < 0 or $hms[1] > 59 or $hms[1] =~ /[\D]/
$hms[1] < 0
$hms[1] > 59
$hms[1] =~ /[\D]/
Truth table0%0/4
A or B or C
A= $hms[1] < 0B= $hms[1] > 59C= $hms[1] =~ /[\D]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1787 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1788 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | 0 | ▶ | if ($hms[2]<0 or $hms[2]>59 or $hms[2]=~/[\D]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$hms[2] < 0 or $hms[2] > 59 or $hms[2] =~ /[\D]/
$hms[2] < 0 or $hms[2] > 59
MC/DC0%0/3
$hms[2] < 0 or $hms[2] > 59 or $hms[2] =~ /[\D]/
$hms[2] < 0
$hms[2] > 59
$hms[2] =~ /[\D]/
Truth table0%0/4
A or B or C
A= $hms[2] < 0B= $hms[2] > 59C= $hms[2] =~ /[\D]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1790 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1791 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||
| 1793 | 0 | return (($hms[0]+$hms[1]/60+$hms[2]/3600)*15); | |||||||||||||||||||||||||||||||||||||||||
| 1794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||
| 1796 | ############################################### | ||||||||||||||||||||||||||||||||||||||||||
| 1797 | # NexStar coordinate conversion | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | ############################################### | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | =item nex2dd(string) | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | Converts NexStar hexadecimal coordinate string (in fraction of a revolution) of | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | the format "34AB,12CE" to two decimal degree coordinates. | ||||||||||||||||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||||||||||||||||
| 1805 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1806 | 0 | ▶ | sub nex2dd ($){ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nex2dd: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1807 | 0 | my ($nexres) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1808 | 0 | my $d1_factor = hex(substr($nexres, 0, 4)) / 65536; | |||||||||||||||||||||||||||||||||||||||||
| 1809 | 0 | my $d2_factor = hex(substr($nexres, 5, 4)) / 65536; | |||||||||||||||||||||||||||||||||||||||||
| 1810 | 0 | my $d1 = 360 * $d1_factor; | |||||||||||||||||||||||||||||||||||||||||
| 1811 | 0 | my $d2 = 360 * $d2_factor; | |||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||
| 1813 | # bring $d2 in [-90,+90] range | ||||||||||||||||||||||||||||||||||||||||||
| 1814 | # use 90.00001 to fix some float errors | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | # that lead +90 to be converted to -270 | ||||||||||||||||||||||||||||||||||||||||||
| 1816 | 0 | ▶ | $d2 = $d2 + 360 if ($d2 < -90.0002); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1817 | 0 | ▶ | $d2 = $d2 - 360 if ($d2 > 90.0002); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1818 | |||||||||||||||||||||||||||||||||||||||||||
| 1819 | 0 | return($d1, $d2); | |||||||||||||||||||||||||||||||||||||||||
| 1820 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | =item pnex2dd(string) | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | Converts precision NexStar hexadecimal coordinate string (in fraction of a revolution) | ||||||||||||||||||||||||||||||||||||||||||
| 1825 | of the format "12AB0500,40000500" to two decimal degree coordinates. | ||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||
| 1827 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1828 | 0 | ▶ | sub pnex2dd ($){ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pnex2dd: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | my ($nexres) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1830 | 0 | my $d1_factor = hex(substr($nexres, 0, 8)) / 0xffffffff; | |||||||||||||||||||||||||||||||||||||||||
| 1831 | 0 | my $d2_factor = hex(substr($nexres, 9, 8)) / 0xffffffff; | |||||||||||||||||||||||||||||||||||||||||
| 1832 | 0 | my $d1 = 360 * $d1_factor; | |||||||||||||||||||||||||||||||||||||||||
| 1833 | 0 | my $d2 = 360 * $d2_factor; | |||||||||||||||||||||||||||||||||||||||||
| 1834 | |||||||||||||||||||||||||||||||||||||||||||
| 1835 | # bring $d2 in [-90,+90] range | ||||||||||||||||||||||||||||||||||||||||||
| 1836 | # use 90.00001 to fix some float errors | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | # that lead +90 to be converted to -270 | ||||||||||||||||||||||||||||||||||||||||||
| 1838 | 0 | ▶ | $d2 = $d2 + 360 if ($d2 < -90.0002); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1839 | 0 | ▶ | $d2 = $d2 - 360 if ($d2 > 90.0002); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1840 | |||||||||||||||||||||||||||||||||||||||||||
| 1841 | 0 | return($d1, $d2); | |||||||||||||||||||||||||||||||||||||||||
| 1842 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||
| 1845 | =item dd2nex(deg1,deg2) | ||||||||||||||||||||||||||||||||||||||||||
| 1846 | |||||||||||||||||||||||||||||||||||||||||||
| 1847 | Converts coordinates deg1 and deg2 (in decimal degrees) to NexStar hexadecimal coordinate | ||||||||||||||||||||||||||||||||||||||||||
| 1848 | string (in fraction of a revolution) of the format "34AB,12CE". | ||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||
| 1850 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1851 | 0 | ▶ | sub dd2nex ($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dd2nex: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1852 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||
| 1854 | # bring $d1,$d2 in the range [0-360] | ||||||||||||||||||||||||||||||||||||||||||
| 1855 | 0 | $d1 = $d1 - 360 * int($d1/360); | |||||||||||||||||||||||||||||||||||||||||
| 1856 | 0 | $d2 = $d2 - 360 * int($d2/360); | |||||||||||||||||||||||||||||||||||||||||
| 1857 | 0 | ▶ | $d1 = $d1 + 360 if ($d1 < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1858 | 0 | ▶ | $d2 = $d2 + 360 if ($d2 < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||
| 1860 | 0 | my $d2_factor = $d2 / 360; | |||||||||||||||||||||||||||||||||||||||||
| 1861 | 0 | my $d1_factor = $d1 / 360; | |||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||
| 1863 | 0 | my $nex1 = int($d1_factor*65536); | |||||||||||||||||||||||||||||||||||||||||
| 1864 | 0 | my $nex2 = int($d2_factor*65536); | |||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||
| 1866 | 0 | return sprintf("%04X,%04X", $nex1,$nex2); | |||||||||||||||||||||||||||||||||||||||||
| 1867 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1868 | |||||||||||||||||||||||||||||||||||||||||||
| 1869 | =item dd2nex(deg1,deg2) | ||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||
| 1871 | Converts coordinates deg1 and deg2 (in decimal degrees) to precise NexStar hexadecimal | ||||||||||||||||||||||||||||||||||||||||||
| 1872 | coordinate string (in fraction of a revolution) of the format "12AB0500,40000500". | ||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | ▶ | sub dd2pnex ($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dd2pnex: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1876 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||
| 1878 | # bring $d1,$d2 in the range [0-360] | ||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | $d1 = $d1 - 360 * int($d1/360); | |||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | $d2 = $d2 - 360 * int($d2/360); | |||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | ▶ | $d1 = $d1 + 360 if ($d1 < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1882 | 0 | ▶ | $d2 = $d2 + 360 if ($d2 < 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||||||||||||||||
| 1884 | 0 | my $d2_factor = $d2 / 360; | |||||||||||||||||||||||||||||||||||||||||
| 1885 | 0 | my $d1_factor = $d1 / 360; | |||||||||||||||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||||||||||||||||
| 1887 | 0 | my $nex1 = int($d1_factor*0xffffffff); | |||||||||||||||||||||||||||||||||||||||||
| 1888 | 0 | my $nex2 = int($d2_factor*0xffffffff); | |||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||
| 1890 | 0 | return sprintf("%08X,%08X", $nex1,$nex2); | |||||||||||||||||||||||||||||||||||||||||
| 1891 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||||||||||||||||
| 1893 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||
| 1895 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||||||||||||||||
| 1897 | For more information about the NexStar commands please refer to the original | ||||||||||||||||||||||||||||||||||||||||||
| 1898 | protocol specification described here: | ||||||||||||||||||||||||||||||||||||||||||
| 1899 | http://www.celestron.com/c3/images/files/downloads/1154108406_nexstarcommprot.pdf | ||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||
| 1901 | The undocumented commands are described here: | ||||||||||||||||||||||||||||||||||||||||||
| 1902 | http://www.paquettefamily.ca/nexstar/NexStar_AUX_Commands_10.pdf | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | |||||||||||||||||||||||||||||||||||||||||||
| 1904 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||||||||||||||||
| 1906 | Rumen Bogdanovski, E<lt>rumen@skyarchive.orgE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 1907 | |||||||||||||||||||||||||||||||||||||||||||
| 1908 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1909 | |||||||||||||||||||||||||||||||||||||||||||
| 1910 | Copyright (C) 2013-2014 by Rumen Bogdanovski | ||||||||||||||||||||||||||||||||||||||||||
| 1911 | |||||||||||||||||||||||||||||||||||||||||||
| 1912 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 1913 | it under the same terms as Perl itself, either Perl version 5.12.4 or, | ||||||||||||||||||||||||||||||||||||||||||
| 1914 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||||||||||||||||
| 1916 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1917 | |||||||||||||||||||||||||||||||||||||||||||
| 1918 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||