Skip to content

Commit 3d97b1e

Browse files
V1.8.36 - Updates
- Added GPS control to LX200 Meade protocol
1 parent aaec992 commit 3d97b1e

File tree

3 files changed

+56
-12
lines changed

3 files changed

+56
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define VERSION "V1.8.35"
1+
#define VERSION "V1.8.36"

Software/Arduino code/OpenAstroTracker/src/MeadeCommandProcessor.cpp

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include "WifiControl.hpp"
66
#include "Gyro.hpp"
77

8+
#if USE_GPS == 1
9+
bool gpsAqcuisitionComplete(); // defined in c72_menuHA_GPS.hpp
10+
#endif
811
/////////////////////////////////////////////////////////////////////////////////////////
912
//
1013
// Serial support
@@ -41,6 +44,21 @@
4144
// Returns: '|#' if slewing, ' #' if not
4245
//
4346
//------------------------------------------------------------------
47+
// GPS FAMILY
48+
//
49+
// :gT#
50+
// Attempts to set the mount time and location from the GPS for 2 minutes. This is essentially a
51+
// blocking call, no other activities take place (except tracking, but only if interrupt-driven).
52+
// Use :Gt# and :Gg# to retrieve Lat and Long,
53+
// Returns: 1 if the data was set, 0 if not (timedout)
54+
//
55+
// :gTnnn#
56+
// Attempts to set the mount time and location from the GPS with a custom timeout. This is also blocking
57+
// but by using a low timeout, you can avoid long pauses and let the user know that it's not ready yet.
58+
// Where nnn is an integer defining the number of milliseconds to wait for the GPS to get a bearing.
59+
// Returns: 1 if the data was set, 0 if not (timedout)
60+
//
61+
//------------------------------------------------------------------
4462
// GET FAMILY
4563
//
4664
// :GVP#
@@ -71,6 +89,17 @@
7189
// Returns: HH:MM:SS
7290
// Where HH is hour, MM is minutes, SS is seconds.
7391
//
92+
// :Gt#
93+
// Get Site Latitude
94+
// Returns: sDD*MM
95+
// Where s is + or - and DD is the latitude in degrees and MM the minutes.
96+
//
97+
// :Gg#
98+
// Get Site Longitude
99+
// Returns: DDD*MM
100+
// Where DDD is the longitude in degrees and MM the minutes. Negative (W) longitudes have had 360 added to them.
101+
//
102+
//
74103
// -- GET Extensions --
75104
// :GIS#
76105
// Get DEC or RA Slewing
@@ -106,17 +135,6 @@
106135
//
107136
// * Az and Alt are optional. The string may only be 3 characters long
108137
//
109-
//
110-
// : Gt#
111-
// Get Site Latitude
112-
// Returns: sDD*MM
113-
// Where s is + or - and DD is the latitude in degrees and MM the minutes.
114-
//
115-
// : Gg#
116-
// Get Site Latitude
117-
// Returns: DDD*MM
118-
// Where DDD is the longitude in degrees and MM the minutes. Negative (W) longitudes have had 360 added to them.
119-
//
120138
//------------------------------------------------------------------
121139
// SET FAMILY
122140
//
@@ -507,6 +525,30 @@ String MeadeCommandProcessor::handleMeadeGetInfo(String inCmd) {
507525
return "0#";
508526
}
509527

528+
/////////////////////////////
529+
// GPS CONTROL
530+
/////////////////////////////
531+
String MeadeCommandProcessor::handleMeadeGPSCommands(String inCmd) {
532+
#if USE_GPS == 1
533+
if (inCmd[0] == 'T') {
534+
unsigned long timeoutLen = 2UL * 60UL * 1000UL;
535+
if (inCmd.length() > 1) {
536+
timeoutLen = inCmd.substring(1).toInt();
537+
}
538+
// Wait at most 2 minutes
539+
unsigned long timeoutTime = millis() + timeoutLen;
540+
while (millis() < timeoutTime) {
541+
if (gpsAqcuisitionComplete()) {
542+
LOGV1(DEBUG_MEADE, F("MEADE: GPS startup, GPS acquired"));
543+
return "1";
544+
}
545+
}
546+
}
547+
#endif
548+
LOGV1(DEBUG_MEADE, F("MEADE: GPS startup, no GPS signal"));
549+
return "0";
550+
}
551+
510552
/////////////////////////////
511553
// SYNC CONTROL
512554
/////////////////////////////
@@ -941,6 +983,7 @@ String MeadeCommandProcessor::processCommand(String inCmd) {
941983
case 'S': return handleMeadeSetInfo(inCmd);
942984
case 'M': return handleMeadeMovement(inCmd);
943985
case 'G': return handleMeadeGetInfo(inCmd);
986+
case 'g': return handleMeadeGPSCommands(inCmd);
944987
case 'C': return handleMeadeSyncControl(inCmd);
945988
case 'h': return handleMeadeHome(inCmd);
946989
case 'I': return handleMeadeInit(inCmd);

Software/Arduino code/OpenAstroTracker/src/MeadeCommandProcessor.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class MeadeCommandProcessor
1515
String handleMeadeSetInfo(String inCmd);
1616
String handleMeadeMovement(String inCmd);
1717
String handleMeadeGetInfo(String inCmd);
18+
String handleMeadeGPSCommands(String inCmd);
1819
String handleMeadeSyncControl(String inCmd);
1920
String handleMeadeHome(String inCmd);
2021
String handleMeadeInit(String inCmd);

0 commit comments

Comments
 (0)