44
44
//
45
45
// :Gd#
46
46
// Get Target Declination
47
- // Where s is + or -, DD is degrees, MM is minutes, SS is seconds.
48
47
// Returns: sDD*MM'SS
48
+ // Where s is + or -, DD is degrees, MM is minutes, SS is seconds.
49
49
//
50
50
// :GD#
51
51
// Get Current Declination
52
- // Where s is + or -, DD is degrees, MM is minutes, SS is seconds.
53
52
// Returns: sDD*MM'SS
53
+ // Where s is + or -, DD is degrees, MM is minutes, SS is seconds.
54
54
//
55
55
// :Gr#
56
56
// Get Target Right Ascension
57
- // Where HH is hour, MM is minutes, SS is seconds.
58
57
// Returns: HH:MM:SS
58
+ // Where HH is hour, MM is minutes, SS is seconds.
59
59
//
60
60
// :GR#
61
61
// Get Current Right Ascension
62
- // Where HH is hour, MM is minutes, SS is seconds.
63
62
// Returns: HH:MM:SS
63
+ // Where HH is hour, MM is minutes, SS is seconds.
64
64
//
65
65
// -- GET Extensions --
66
66
// :GIS#
93
93
// | Third character is TRK slewing state ('T' is Tracking, '-' is stopped).
94
94
// +----------------------------------------------- [0] The mount status. One of 'Idle', 'Parked', 'Parking', 'Guiding', 'SlewToTarget', 'FreeSlew', 'ManualSlew', 'Tracking'
95
95
//
96
- //
96
+ // : Gt#
97
+ // Get Site Latitude
98
+ // Returns: sDD*MM
99
+ // Where s is + or - and DD is the latitude in degrees and MM the minutes.
100
+ //
101
+ // : Gg#
102
+ // Get Site Latitude
103
+ // Returns: DDD*MM
104
+ // Where DDD is the longitude in degrees and MM the minutes. Negative (W) longitudes have had 360 added to them.
105
+ //
97
106
// ------------------------------------------------------------------
98
107
// SET FAMILY
99
108
//
109
118
// Where HH is hours, MM is minutes, SS is seconds.
110
119
// Returns: 1 if successfully set, otherwise 0
111
120
//
121
+ // :StsDD*MM#
122
+ // Set Site Latitude
123
+ // This sets the latitude of the location of the mount.
124
+ // Where s is the sign ('+' or '-'), DD is the degree (90 or less), MM is minutes.
125
+ // Returns: 1 if successfully set, otherwise 0
126
+ //
127
+ // :SgDDD*MM#
128
+ // Set Site Longitude
129
+ // This sets the longitude of the location of the mount.
130
+ // Where DDD the nmber of degrees (0 to 360), MM is minutes. W Latitudes get 360 added to them. So W122 (or -122) would be 238.
131
+ // Returns: 1 if successfully set, otherwise 0
132
+ //
133
+ // :SGsHH#
134
+ // Set Site UTC Offset
135
+ // This sets the offset of the timezone in which the mount is in hours from UTC.
136
+ // Where s is the sign and HH is the number of hours.
137
+ // CURRENTLY IGNORED.
138
+ // Returns: 1
139
+ //
140
+ // :SLHH:MM:SS#
141
+ // Set Site Local Time
142
+ // This sets the local time of the timezone in which the mount is located.
143
+ // Where HH is hours, MM is minutes and SS is seconds.
144
+ // CURRENTLY IGNORED.
145
+ // Returns: 1
146
+ //
147
+ // :SCMM/DD/YY#
148
+ // Set Site Date
149
+ // This sets the date
150
+ // Where HHMM is the month, DD is teh day and YY is the year since 2000.
151
+ // CURRENTLY IGNORED.
152
+ // Returns: 1Updating Planetary Data
153
+ //
112
154
// -- SET Extensions --
113
155
// :SHHH:MM#
114
156
// Set Hour Time (HA)
115
157
// This sets the scopes HA.
116
158
// Where HH is hours, MM is minutes.
117
159
// Returns: 1 if successfully set, otherwise 0
118
160
//
161
+ // :SHP#
162
+ // Set Home Point
163
+ // This sets the current orientation of the scope as its home point.
164
+ // Returns: 1
165
+ //
119
166
// :SHLHH:MM#
120
167
// Set LST Time
121
168
// This sets the scopes LST (and HA).
129
176
// Returns: 1 if successfully set, otherwise 0
130
177
//
131
178
// ------------------------------------------------------------------
179
+ // RATE CONTROL FAMILY
180
+ //
181
+ // :Rs#
182
+ // Set Slew rate
183
+ // Where s is one of 'S', 'M', 'C', or 'G' in order of decreasing speed
184
+ // CURRENTLY IGNORED
185
+ // Returns: nothing
186
+ // ------------------------------------------------------------------
132
187
// MOVEMENT FAMILY
133
188
//
134
189
// :MS#
140
195
//
141
196
// :MGdnnnn#
142
197
// Run a Guide pulse
143
- // This runs the motors for a short period of time.
198
+ // This runs the motors at increased speed for a short period of time.
144
199
// Where d is one of 'N', 'E', 'W', or 'S' and nnnn is the duration in ms.
145
200
// Returns: 1
146
201
//
157
212
// Returns: nothing
158
213
//
159
214
// ------------------------------------------------------------------
215
+ // SYNC FAMILY
216
+ //
217
+ // :CM#
218
+ // Synchronizes the mount to the current target RA and DEC values.
219
+ //
220
+ // ------------------------------------------------------------------
160
221
// HOME FAMILY
161
222
//
162
223
// :hP#
@@ -347,17 +408,35 @@ String MeadeCommandProcessor::handleMeadeGetInfo(String inCmd) {
347
408
case ' X' : return _mount->getStatusString () + " #" ;
348
409
349
410
case ' I' :
350
- String retVal = " " ;
351
- if (cmdTwo == ' S' ) {
352
- retVal = _mount->isSlewingRAorDEC () ? " 1" : " 0" ;
353
- }
354
- else if (cmdTwo == ' T' ) {
355
- retVal = _mount->isSlewingTRK () ? " 1" : " 0" ;
356
- }
357
- else if (cmdTwo == ' G' ) {
358
- retVal = _mount->isGuiding () ? " 1" : " 0" ;
411
+ {
412
+ String retVal = " " ;
413
+ if (cmdTwo == ' S' ) {
414
+ retVal = _mount->isSlewingRAorDEC () ? " 1" : " 0" ;
415
+ }
416
+ else if (cmdTwo == ' T' ) {
417
+ retVal = _mount->isSlewingTRK () ? " 1" : " 0" ;
418
+ }
419
+ else if (cmdTwo == ' G' ) {
420
+ retVal = _mount->isGuiding () ? " 1" : " 0" ;
421
+ }
422
+ return retVal + " #" ;
423
+ }
424
+ case ' t' : {
425
+ auto lat = DegreeTime (_mount->latitude ());
426
+ char achBuffer[20 ];
427
+ sprintf (achBuffer, " %c%02d*%02d#" , lat.getTotalDegrees () >= 0 ? ' +' : ' -' , int (fabs (lat.getDegrees ())), lat.getMinutes ());
428
+ return String (achBuffer);
429
+ }
430
+ case ' g' : {
431
+ float lon = _mount->longitude ();
432
+ if (lon < 0 ) {
433
+ lon += 360 ;
434
+ }
435
+ int lonMin = (lon - (int )lon) * 60 ;
436
+ char achBuffer[20 ];
437
+ sprintf (achBuffer, " %03d*%02d#" , (int )lon, lonMin);
438
+ return String (achBuffer);
359
439
}
360
- return retVal + " #" ;
361
440
}
362
441
363
442
return " 0#" ;
@@ -423,7 +502,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
423
502
424
503
DayTime lst (hLST, minLST, secLST);
425
504
#ifdef DEBUG_MODE
426
- logv (" MeadeSetInfo: Received LST: %d:%d:%d" , hLST,minLST,secLST);
505
+ logv (" MeadeSetInfo: Received LST: %d:%d:%d" , hLST, minLST, secLST);
427
506
#endif
428
507
_mount->setLST (lst);
429
508
}
@@ -445,26 +524,41 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd) {
445
524
return " 1" ;
446
525
}
447
526
else if ((inCmd[0 ] == ' Y' ) && inCmd.length () == 19 ) {
448
- // Sync RA, DEC - current position is teh given coordinate
527
+ // Sync RA, DEC - current position is the given coordinate
449
528
// 0123456789012345678
450
529
// :SY+84*03:02.18:34:12
451
530
int sgn = inCmd[1 ] == ' +' ? 1 : -1 ;
452
531
if ((inCmd[4 ] == ' *' ) && (inCmd[7 ] == ' :' ) && (inCmd[10 ] == ' .' ) && (inCmd[13 ] == ' :' ) && (inCmd[16 ] == ' :' )) {
453
532
int deg = inCmd.substring (2 , 4 ).toInt ();
454
- _mount->syncPosition (inCmd.substring (11 , 13 ).toInt (), inCmd.substring (14 , 16 ).toInt (), inCmd.substring (17 , 19 ).toInt (),sgn * deg + (NORTHERN_HEMISPHERE ? -90 : 90 ), inCmd.substring (5 , 7 ).toInt (), inCmd.substring (8 , 10 ).toInt ());
533
+ _mount->syncPosition (inCmd.substring (11 , 13 ).toInt (), inCmd.substring (14 , 16 ).toInt (), inCmd.substring (17 , 19 ).toInt (), sgn * deg + (NORTHERN_HEMISPHERE ? -90 : 90 ), inCmd.substring (5 , 7 ).toInt (), inCmd.substring (8 , 10 ).toInt ());
455
534
return " 1" ;
456
535
}
457
- else {
458
- return " 0" ;
459
- }
536
+ return " 0" ;
460
537
}
461
- else if ((inCmd[0 ] == ' t' )) // longitude : :St+30*29#
538
+ else if ((inCmd[0 ] == ' t' )) // latitude : :St+30*29#
462
539
{
463
- return " 1" ;
540
+ float sgn = inCmd[1 ] == ' +' ? 1 .0f : -1 .0f ;
541
+ if (inCmd[4 ] == ' *' ) {
542
+ int deg = inCmd.substring (2 , 4 ).toInt ();
543
+ int minute = inCmd.substring (5 , 7 ).toInt ();
544
+ _mount->setLatitude (sgn * (1 .0f * deg + (minute / 60 .0f )));
545
+ return " 1" ;
546
+ }
547
+ return " 0" ;
464
548
}
465
- else if (inCmd[0 ] == ' g' ) // latitude :Sg097*34#
549
+ else if (inCmd[0 ] == ' g' ) // longitude :Sg097*34#
466
550
{
467
- return " 1" ;
551
+ if (inCmd[4 ] == ' *' ) {
552
+ int deg = inCmd.substring (1 , 4 ).toInt ();
553
+ int minute = inCmd.substring (5 , 7 ).toInt ();
554
+ float lon = 1 .0f * deg + (1 .0f * minute / 60 .0f );
555
+ if (lon > 180 ) {
556
+ lon -= 360 ;
557
+ }
558
+ _mount->setLongitude (lon);
559
+ return " 1" ;
560
+ }
561
+ return " 0" ;
468
562
}
469
563
else if (inCmd[0 ] == ' G' ) // utc offset :SG+05#
470
564
{
@@ -660,25 +754,25 @@ String MeadeCommandProcessor::handleMeadeQuit(String inCmd) {
660
754
661
755
switch (inCmd[0 ]) {
662
756
case ' a' :
663
- _mount->stopSlewing (ALL_DIRECTIONS);
757
+ _mount->stopSlewing (ALL_DIRECTIONS);
664
758
break ;
665
759
case ' e' :
666
- _mount->stopSlewing (EAST);
667
- break ;
668
- case ' w' :
669
- _mount->stopSlewing (WEST);
670
- break ;
671
- case ' n' :
672
- _mount->stopSlewing (NORTH);
673
- break ;
674
- case ' s' :
675
- _mount->stopSlewing (SOUTH);
676
- break ;
677
- case ' q' :
678
- inSerialControl = false ;
679
- _lcdMenu->setCursor (0 , 0 );
680
- _lcdMenu->updateDisplay ();
681
- break ;
760
+ _mount->stopSlewing (EAST);
761
+ break ;
762
+ case ' w' :
763
+ _mount->stopSlewing (WEST);
764
+ break ;
765
+ case ' n' :
766
+ _mount->stopSlewing (NORTH);
767
+ break ;
768
+ case ' s' :
769
+ _mount->stopSlewing (SOUTH);
770
+ break ;
771
+ case ' q' :
772
+ inSerialControl = false ;
773
+ _lcdMenu->setCursor (0 , 0 );
774
+ _lcdMenu->updateDisplay ();
775
+ break ;
682
776
}
683
777
684
778
return " " ;
@@ -694,8 +788,8 @@ String MeadeCommandProcessor::handleMeadeSetSlewRate(String inCmd) {
694
788
case ' C' : // Center - 2nd Slowest
695
789
case ' G' : // Guide - Slowest
696
790
default :
697
- return " " ;
698
791
}
792
+ return " " ;
699
793
}
700
794
701
795
String MeadeCommandProcessor::processCommand (String inCmd) {
0 commit comments