Skip to content

Commit 40f454a

Browse files
V1.6.33 - Updates
- Added :GX# command to serial that returns mount status in one string. - Removed some commented out code.
1 parent 54aecde commit 40f454a

File tree

5 files changed

+68
-8
lines changed

5 files changed

+68
-8
lines changed

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ char* formatStringsDEC[] = {
3737
"%c%02d*%02d'%02d#", // Meade
3838
"%c%02d %02d'%02d\"", // Print
3939
"%c%02d@%02d'%02d\"", // LCD display only
40+
"%c%02d%02d%02d", // Compact
4041
};
4142

4243
char* formatStringsRA[] = {
@@ -45,6 +46,7 @@ char* formatStringsRA[] = {
4546
"%02d:%02d:%02d#", // Meade
4647
"%02dh %02dm %02ds", // Print
4748
"%02dh%02dm%02ds", // LCD display only
49+
"%02d%02d%02d", // Compact
4850
};
4951

5052
const float siderealDegreesInHour = 14.95902778;
@@ -486,6 +488,57 @@ String Mount::mountStatusString() {
486488
}
487489
#endif
488490

491+
/////////////////////////////////
492+
//
493+
// getStatusString
494+
//
495+
/////////////////////////////////
496+
String Mount::getStatusString() {
497+
String status;
498+
if (_mountStatus == STATUS_PARKED) {
499+
status = "Parked,";
500+
}
501+
else if (_mountStatus & STATUS_PARKING) {
502+
status = "Parking,";
503+
}
504+
else if (isGuiding()) {
505+
status = "Guiding,";
506+
}
507+
else if (slewStatus() & SLEW_MASK_ANY) {
508+
if (_mountStatus & STATUS_SLEWING_TO_TARGET) {
509+
status = "SlewToTarget,";
510+
}
511+
else if (_mountStatus & STATUS_SLEWING_FREE) {
512+
status = "FreeSlew,";
513+
}
514+
else {
515+
status = "Idle,";
516+
}
517+
} else {
518+
status = "Idle,";
519+
}
520+
521+
String disp = "---,";
522+
if (_mountStatus & STATUS_SLEWING) {
523+
byte slew = slewStatus();
524+
if (slew & SLEWING_RA) disp[0] = _stepperRA->speed() < 0 ? 'R' : 'r';
525+
if (slew & SLEWING_DEC) disp[1] = _stepperDEC->speed() < 0 ? 'D' : 'd';
526+
if (slew & SLEWING_TRACKING) disp[2] = 'T';
527+
} else if (isSlewingTRK()) {
528+
disp[2] = 'T';
529+
}
530+
531+
status += disp;
532+
status += String(_stepperRA->currentPosition()) + ",";
533+
status += String(_stepperDEC->currentPosition()) + ",";
534+
status += String(_stepperTRK->currentPosition()) + ",";
535+
536+
status += RAString(COMPACT_STRING | CURRENT_STRING) + ",";
537+
status += DECString(COMPACT_STRING | CURRENT_STRING) + ",";
538+
539+
return status ;
540+
}
541+
489542
/////////////////////////////////
490543
//
491544
// slewingStatus
@@ -937,7 +990,7 @@ void Mount::displayStepperPosition() {
937990
else {
938991
#ifdef SUPPORT_SERIAL_CONTROL
939992
if (inSerialControl) {
940-
sprintf(scratchBuffer, " RA: %s", RAString(LCD_STRING | CURRENT_STRING).c_str());
993+
sprintf(scratchBuffer, " RA: %s", RAString(LCD_STRING | CURRENT_STRING).c_str());
941994
_lcdMenu->setCursor(0, 0);
942995
_lcdMenu->printMenu(scratchBuffer);
943996
sprintf(scratchBuffer, "DEC: %s", DECString(LCD_STRING | CURRENT_STRING).c_str());

Software/Arduino code/OpenAstroTracker/Mount.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define MEADE_STRING B0010
1919
#define PRINT_STRING B0011
2020
#define LCD_STRING B0100
21+
#define COMPACT_STRING B0101
2122
#define FORMAT_STRING_MASK B0111
2223

2324
#define TARGET_STRING B01000
@@ -124,6 +125,9 @@ class Mount {
124125
// Return a string of DEC in the given format. For LCDSTRING, active determines where the cursor is
125126
String RAString(byte type, byte active = 0);
126127

128+
// Returns a comma-delimited string with all the mounts' information
129+
String getStatusString();
130+
127131
// Get the current speed of the stepper. NORTH, WEST, TRACKING
128132
float getSpeed(int direction);
129133

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
#include "Globals.h"
1818

19-
String version = "V1.6.32";
19+
String version = "V1.6.33";
2020

2121
///////////////////////////////////////////////////////////////////////////
2222
// Please see the Globals.h file for configuration of the firmware.

Software/Arduino code/OpenAstroTracker/b_setup.ino

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
LcdMenu lcdMenu(16, 2, MAXMENUITEMS);
33
LcdButtons lcdButtons(0);
44

5-
// Create the variables to track RA time, RA display time and HA time
6-
//DayTime RATime;
7-
//DayTime RADisplayTime;
8-
//DayTime HATime;
9-
//DayTime HACorrection;
10-
115
Mount mount(RAStepsPerDegree, DECStepsPerDegree, &lcdMenu);
126

137
void setup() {

Software/Arduino code/OpenAstroTracker/f_serial.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
// Get Guiding
7373
// Returns: 1 if currently guiding. 0 if not.
7474
//
75+
// :GX#
76+
// Get Mount Status
77+
// Returns: string reflecting the mounts' status
78+
//
7579
//------------------------------------------------------------------
7680
// SET FAMILY
7781
//
@@ -200,6 +204,11 @@ void handleMeadeGetInfo(String inCmd) {
200204
}
201205
break;
202206

207+
case 'X': {
208+
Serial.print(mount.getStatusString()+"#");
209+
}
210+
break;
211+
203212
case 'I': {
204213
if (cmdTwo == 'S') {
205214
Serial.print(mount.isSlewingRAorDEC() ? "1" : "0");

0 commit comments

Comments
 (0)