Skip to content

Commit b5e5557

Browse files
V1.6.24 - Updates
- Added Home and Park as additions to the Points of Interest menu. - Renamed POI to GO menu. - Merged GO (old POT) menu with HOME menu. - If you disable support for the Points Of Interest you still get a GO menu with Home and Park. - Added ability to disable CTRL menu. - Added ability to disable INFO menu.
1 parent cbe3cfd commit b5e5557

File tree

12 files changed

+133
-51
lines changed

12 files changed

+133
-51
lines changed

Software/Arduino code/OpenAstroTracker/Globals.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,24 @@ extern bool inSerialControl;
3838
//
3939
////////////////////////////////////////////////////////////////
4040

41-
// Uncomment this to support the heating menu
41+
// Uncomment this to enable the heating menu
4242
// NOTE: Heating is currently not supported!
4343
// #define SUPPORT_HEATING
4444

4545
// Uncomment to support Guided Startup
4646
#define SUPPORT_GUIDED_STARTUP
4747

48-
// Uncomment to support POI menu. Since memory is running low, this can be disabled in lieu of serial support.
48+
// Uncomment to support full GO (was POI) menu.
49+
// If this is commented out you still have a GO menu that has Home and Park.
4950
#define SUPPORT_POINTS_OF_INTEREST
5051

51-
// Uncomment to support Serial MEADE support
52-
// #define SUPPORT_SERIAL_CONTROL
52+
// Uncomment to support CTRL menu, allowing you to manually slew the mount with the buttons.
53+
#define SUPPORT_MANUAL_CONTROL
54+
55+
// Uncomment to support INFO menu that displays various pieces of information about the mount.
56+
#define SUPPORT_INFO_DISPLAY
5357

58+
// Uncomment to support Serial Meade LX200 protocol support
59+
// #define SUPPORT_SERIAL_CONTROL
5460

5561
#endif

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ void Mount::startSlewingToTarget() {
278278
//
279279
// park
280280
//
281+
// Targets the mount to move to the home position and
282+
// turns off all motors once it gets there.
281283
/////////////////////////////////
282284
void Mount::park()
283285
{
@@ -288,6 +290,25 @@ void Mount::park()
288290
_mountStatus |= STATUS_PARKING;
289291
}
290292

293+
/////////////////////////////////
294+
//
295+
// goHome
296+
//
297+
// Synchronously moves mount to home position and
298+
// sets Tracking mode according to argument
299+
/////////////////////////////////
300+
void Mount::goHome(bool tracking)
301+
{
302+
stopSlewing(TRACKING);
303+
setTargetToHome();
304+
startSlewingToTarget();
305+
waitUntilStopped(ALL_DIRECTIONS);
306+
setHome();
307+
if (tracking) {
308+
startSlewing(TRACKING);
309+
}
310+
}
311+
291312
/////////////////////////////////
292313
//
293314
// mountStatus
@@ -422,7 +443,7 @@ bool Mount::isParking() {
422443
//
423444
// startSlewing
424445
//
425-
// Starts manual slewing in one of eight directions or
446+
// Starts manual slewing in one of eight directions or
426447
// tracking, but only if not currently parking!
427448
/////////////////////////////////
428449
void Mount::startSlewing(int direction) {
@@ -465,6 +486,7 @@ void Mount::stopSlewing(int direction) {
465486
if (direction & TRACKING) {
466487
// Turn off tracking
467488
_mountStatus &= ~STATUS_TRACKING;
489+
468490
_stepperTRK->stop();
469491
}
470492

@@ -533,11 +555,12 @@ void Mount::loop() {
533555
bool decStillRunning = false;
534556

535557
unsigned long now = millis();
536-
if (now - _lastMountPrint > 2500) {
537-
//Serial.println(mountStatusString());
558+
#ifdef DEBUG_MODE
559+
if (now - _lastMountPrint > 1500) {
560+
Serial.println(mountStatusString());
538561
_lastMountPrint = now;
539562
}
540-
563+
#endif
541564
if (_mountStatus & STATUS_TRACKING) {
542565
_stepperTRK->runSpeed();
543566
}

Software/Arduino code/OpenAstroTracker/Mount.hpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ class Mount {
9393
// Same as Arduino delay() but keeps the tracker going.
9494
void delay(int ms);
9595

96-
// What is the state of the mount
97-
byte mountStatus();
98-
#ifdef DEBUG_MODE
99-
String mountStatusString();
100-
#endif
101-
10296
// Gets the position in one of eight directions or tracking
10397
long getCurrentStepperPosition(int direction);
10498

@@ -108,11 +102,15 @@ class Mount {
108102
// Set RA and DEC to the home position
109103
void setTargetToHome();
110104

105+
// Synchronously slews the mount to the home position and sets tracking to argument.
106+
void goHome(bool tracking);
107+
111108
// Set the current stepper positions to be home.
112109
void setHome();
113110

114111
// Asynchronously parks the mount. Moves to the home position and stops all motors.
115112
void park();
113+
116114

117115
// Return a string of DEC in the given format. For LCDSTRING, active determines where the cursor is
118116
String DECString(byte type, byte active = 0);
@@ -133,6 +131,15 @@ class Mount {
133131
// Returns NOT_SLEWING, SLEWING_DEC, SLEWING_RA, or SLEWING_BOTH. SLEWING_TRACKING is an overlaid bit.
134132
byte slewStatus();
135133

134+
// What is the state of the mount.
135+
// Returns some combination of these flags: STATUS_PARKED, STATUS_SLEWING, STATUS_SLEWING_TO_TARGET, STATUS_SLEWING_FREE, STATUS_TRACKING, STATUS_PARKING
136+
byte mountStatus();
137+
138+
#ifdef DEBUG_MODE
139+
String mountStatusString();
140+
#endif
141+
142+
136143
private:
137144
LcdMenu* _lcdMenu;
138145
int _stepsPerRADegree;

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.23";
19+
String version = "V1.6.24";
2020

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

Software/Arduino code/OpenAstroTracker/Utility.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,3 @@ float clamp(float current, float minVal, float maxVal)
3838
if (current < minVal) current = minVal;
3939
return current;
4040
}
41-
/*
42-
int read_LCD_buttons() {
43-
adc_key_in = analogRead(0);
44-
if (adc_key_in > 1000) return btnNONE;
45-
if (adc_key_in < 50) return btnRIGHT;
46-
if (adc_key_in < 240) return btnUP;
47-
if (adc_key_in < 400) return btnDOWN;
48-
if (adc_key_in < 600) return btnLEFT;
49-
if (adc_key_in < 920) return btnSELECT;
50-
}
51-
*/

Software/Arduino code/OpenAstroTracker/b_setup.ino

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,28 @@ void setup() {
5959
// Create the LCD top-level menu items
6060
lcdMenu.addItem("RA", RA_Menu);
6161
lcdMenu.addItem("DEC", DEC_Menu);
62+
6263
#ifdef SUPPORT_POINTS_OF_INTEREST
63-
lcdMenu.addItem("POI", POI_Menu);
64+
lcdMenu.addItem("GO", POI_Menu);
65+
#else
66+
lcdMenu.addItem("GO", Home_Menu);
6467
#endif
65-
lcdMenu.addItem("HOME", Home_Menu);
68+
6669
lcdMenu.addItem("HA", HA_Menu);
70+
6771
#ifdef SUPPORT_HEATING
6872
lcdMenu.addItem("HEA", Heat_Menu);
6973
#endif
74+
75+
#ifdef SUPPORT_MANUAL_CONTROL
7076
lcdMenu.addItem("CTRL", Control_Menu);
77+
#endif
78+
7179
lcdMenu.addItem("CAL", Calibration_Menu);
80+
81+
#ifdef SUPPORT_INFO_DISPLAY
7282
lcdMenu.addItem("INFO", Status_Menu);
83+
#endif
7384

7485
while (millis() - now < 750) {
7586
mount.loop();

Software/Arduino code/OpenAstroTracker/c722_menuPOI.ino

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,51 @@ struct PointOfInterest {
1212
PointOfInterest pointOfInterest[] = {
1313
// Name (15chars) RA (hms) DEC (dms)
1414
// 012345678901234
15-
{ ">Polaris ", 2, 57, 56, 89, 21, 2 },
16-
{ ">Big Dipper ", 12, 16, 26, 56, 55, 7 },
17-
{ ">M31 Andromeda ", 0, 43, 52, 41, 22, 53 },
15+
{ ">Polaris" , 2, 57, 56, 89, 21, 2 },
16+
{ ">Big Dipper" , 12, 16, 26, 56, 55, 7 },
17+
{ ">M31 Andromeda" , 0, 43, 52, 41, 22, 53 },
1818
{ ">M81 Bodes Galxy", 9, 57, 13, 68, 58, 1 },
19+
20+
// Add new items above here, not below.
21+
{ ">Home" , 0, 0, 0, 90, 0, 0 },
22+
{ ">Park" , 0, 0, 0, 90, 0, 0 },
23+
// And definitely don't add here.
1924
};
2025

2126
int currentPOI = 0;
22-
int lastPOI = sizeof(pointOfInterest) / sizeof(pointOfInterest[0]) - 1;
27+
int parkPOI = sizeof(pointOfInterest) / sizeof(pointOfInterest[0]) - 1;
28+
byte homePOI = sizeof(pointOfInterest) / sizeof(pointOfInterest[0]) - 2;
2329

2430
bool processPOIKeys() {
2531
byte key;
2632
if (lcdButtons.keyChanged(key)) {
2733
switch (key) {
2834
case btnSELECT: {
2935
mount.stopSlewing(ALL_DIRECTIONS);
30-
PointOfInterest* poi = &pointOfInterest[currentPOI];
31-
mount.targetRA().set(poi->hourRA, poi->minRA, poi->secRA);
32-
mount.targetRA().addTime(mount.getHACorrection());
33-
mount.targetRA().subtractTime(mount.HA());
34-
mount.targetDEC().set(poi->degreeDEC - (NORTHERN_HEMISPHERE ? 90 : -90), poi->minDEC, poi->secDEC); // internal DEC degree is 0 at celestial poles
35-
mount.startSlewingToTarget();
36+
if (currentPOI == homePOI) {
37+
mount.goHome(true);
38+
} else if (currentPOI == parkPOI) {
39+
mount.park();
40+
}
41+
else {
42+
PointOfInterest* poi = &pointOfInterest[currentPOI];
43+
mount.targetRA().set(poi->hourRA, poi->minRA, poi->secRA);
44+
mount.targetRA().addTime(mount.getHACorrection());
45+
mount.targetRA().subtractTime(mount.HA());
46+
mount.targetDEC().set(poi->degreeDEC - (NORTHERN_HEMISPHERE ? 90 : -90), poi->minDEC, poi->secDEC); // internal DEC degree is 0 at celestial poles
47+
mount.startSlewingToTarget();
48+
}
3649
}
3750
break;
3851

3952
case btnLEFT:
4053
case btnDOWN: {
41-
currentPOI = adjustWrap(currentPOI, 1, 0, lastPOI);
54+
currentPOI = adjustWrap(currentPOI, 1, 0, parkPOI);
4255
}
4356
break;
4457

4558
case btnUP: {
46-
currentPOI = adjustWrap(currentPOI, -1, 0, lastPOI);
59+
currentPOI = adjustWrap(currentPOI, -1, 0, parkPOI);
4760
}
4861
break;
4962

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
byte subGoIndex = 0;
2+
13
bool processHomeKeys() {
24
byte key;
35
if (lcdButtons.keyChanged(key)) {
46
switch (key) {
57
case btnSELECT: {
6-
mount.stopSlewing(TRACKING);
7-
mount.setTargetToHome();
8-
mount.startSlewingToTarget();
9-
mount.waitUntilStopped(ALL_DIRECTIONS);
10-
mount.setHome();
11-
mount.startSlewing(TRACKING);
8+
if (subGoIndex == 0) {
9+
mount.goHome(true); // start tracking after home
10+
} else {
11+
mount.park();
12+
}
13+
}
14+
break;
15+
16+
case btnUP:
17+
case btnDOWN:
18+
case btnLEFT: {
19+
subGoIndex = 1 - subGoIndex;
1220
}
1321
break;
1422

@@ -18,10 +26,17 @@ bool processHomeKeys() {
1826
break;
1927
}
2028
}
21-
29+
2230
return true;
2331
}
2432

2533
void printHomeSubmenu() {
26-
lcdMenu.printMenu(">Go Home");
34+
char scratchBuffer[16];
35+
if (mount.isParked() && (subGoIndex == 1)) {
36+
lcdMenu.printMenu("Parked...");
37+
} else {
38+
strcpy(scratchBuffer, " Home Park");
39+
scratchBuffer[subGoIndex * 6] = '>';
40+
lcdMenu.printMenu(scratchBuffer);
41+
}
2742
}

Software/Arduino code/OpenAstroTracker/c75_menuCTRL.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#ifdef SUPPORT_MANUAL_CONTROL
12
bool confirmZeroPoint = false;
23
bool setZeroPoint = true;
34

@@ -116,3 +117,4 @@ void printControlSubmenu() {
116117
mount.displayStepperPositionThrottled();
117118
}
118119
}
120+
#endif

Software/Arduino code/OpenAstroTracker/c78_menuINFO.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#ifdef SUPPORT_INFO_DISPLAY
12
byte infoIndex = 0;
23
byte maxInfoIndex = 4;
34
byte subIndex = 0;
@@ -81,3 +82,5 @@ void printStatusSubmenu() {
8182
break;
8283
}
8384
}
85+
86+
#endif

Software/Arduino code/OpenAstroTracker/c_buttons.ino

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ void loop() {
8080
case POI_Menu:
8181
waitForButtonRelease = processPOIKeys();
8282
break;
83-
#endif
83+
#else
8484
case Home_Menu:
8585
waitForButtonRelease = processHomeKeys();
8686
break;
87+
#endif
88+
8789
case HA_Menu:
8890
waitForButtonRelease = processHAKeys();
8991
break;
@@ -95,12 +97,18 @@ void loop() {
9597
case Calibration_Menu:
9698
waitForButtonRelease = processCalibrationKeys();
9799
break;
100+
101+
#ifdef SUPPORT_MANUAL_CONTROL
98102
case Control_Menu:
99103
waitForButtonRelease = processControlKeys();
100104
break;
105+
#endif
106+
107+
#ifdef SUPPORT_INFO_DISPLAY
101108
case Status_Menu:
102109
waitForButtonRelease = processStatusKeys();
103110
break;
111+
#endif
104112
}
105113
}
106114

@@ -134,15 +142,21 @@ void loop() {
134142
case DEC_Menu: printDECSubmenu(); break;
135143
#ifdef SUPPORT_POINTS_OF_INTEREST
136144
case POI_Menu: printPOISubmenu(); break;
145+
#else
146+
case Home_Menu: printHomeSubmenu(); break;
137147
#endif
138148
case HA_Menu: printHASubmenu(); break;
139-
case Home_Menu: printHomeSubmenu(); break;
140149
#ifdef SUPPORT_HEATING
141150
case Heat_Menu: printHeatSubmenu(); break;
142151
#endif
152+
#ifdef SUPPORT_MANUAL_CONTROL
143153
case Control_Menu: printControlSubmenu(); break;
154+
#endif
144155
case Calibration_Menu: printCalibrationSubmenu(); break;
156+
157+
#ifdef SUPPORT_INFO_DISPLAY
145158
case Status_Menu: printStatusSubmenu(); break;
159+
#endif
146160
}
147161
}
148162
}

Software/Arduino code/OpenAstroTracker/f_serial.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ void handleMeadeMovement(String inCmd) {
287287
void handleMeadeHome(String inCmd) {
288288
if (inCmd[0] == 'P') { // Park
289289
mount.park();
290-
291290
}
292291
else if (inCmd[0] == 'U') { // Unpark
293292
mount.startSlewing(TRACKING);

0 commit comments

Comments
 (0)