Skip to content

Commit 50d7eda

Browse files
V1.4.4 Update
- Added POI (points if interest) menu. Edit C722_menuPOI.ino to add more, - Factored out a status message function.
1 parent ec9d6e4 commit 50d7eda

File tree

8 files changed

+108
-8
lines changed

8 files changed

+108
-8
lines changed

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
=======================================================================================================================================
33
4-
Version 1.4.2
4+
Version 1.4.4
55
66
1. Connect your Arduino, under tools choose "Arduino Uno", set the right Port and set "Arduino ISP" as the Programmer.
77
2. Hit upload (Ctrl-U)
@@ -14,7 +14,7 @@
1414
1515
=======================================================================================================================================
1616
*/
17-
String version = "V1.4.3";
17+
String version = "V1.4.4";
1818

1919
boolean north = true; // change this to 'false' if youre in the southern hemisphere
2020

Software/Arduino code/OpenAstroTracker/a_inits.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
4141
#define Calibration_Menu 5
4242
#define Control_Menu 6
4343
#define Home_Menu 7
44+
#define POI_Menu 8
4445

4546
// Stepper control for RA and DEV.
4647
// TRK is used for live tracking and runs in parallel with RA.

Software/Arduino code/OpenAstroTracker/b_setup.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void setup() {
5353
// Create the menu items
5454
lcdMenu.addItem("RAs", RA_Menu);
5555
lcdMenu.addItem("DEC", DEC_Menu);
56+
lcdMenu.addItem("POI", POI_Menu);
5657
lcdMenu.addItem("HOME", Home_Menu);
5758
lcdMenu.addItem("HA", HA_Menu);
5859
if (north) {

Software/Arduino code/OpenAstroTracker/c6_moveTo.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,12 @@ void moveSteppersToTargetAsync() {
119119
controlDisplay --;
120120
}
121121
}
122+
123+
void ShowStatusMessage(String message) {
124+
lcdMenu.setCursor(0, 1);
125+
lcdMenu.printMenu(message);
126+
long now = millis();
127+
while (millis() - now < 750) {
128+
runTracker();
129+
}
130+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
struct PointOfInterest {
2+
char* pDisplay;
3+
int hourRA;
4+
int minRA;
5+
int secRA;
6+
int degreeDEC;
7+
int minDEC;
8+
int secDEC;
9+
};
10+
11+
PointOfInterest pointOfInterest[] = {
12+
// Name (15chars) RA (hms) DEC (dms)
13+
// 012345678901234
14+
{ ">Big Dipper ", 12, 16, 26, 56, 55, 7 },
15+
{ ">M31 Andromeda ", 0, 43, 52, 41, 22, 53 },
16+
{ ">M81 Bodes Galxy", 9, 57, 13, 68, 58, 1 },
17+
};
18+
19+
int currentPOI = 0;
20+
int lastPOI = sizeof(pointOfInterest) / sizeof(pointOfInterest[0]) - 1;
21+
int statePOI = 0;
22+
bool poiMoving = false;
23+
24+
void processPOIKeys(int key) {
25+
switch (key) {
26+
case btnSELECT: {
27+
if (lastKey != btnSELECT) {
28+
stopSteppers();
29+
PointOfInterest* poi = &pointOfInterest[currentPOI];
30+
RATime.set(poi->hourRA, poi->minRA, poi->secRA);
31+
degreeDEC = poi->degreeDEC - (north ? 90 : -90); // iternal DEC degree is 0 at celestial poles
32+
minDEC = poi->minDEC;
33+
secDEC = poi->secDEC;
34+
35+
// Calculate the target stepper positions
36+
handleDECandRACalculations();
37+
38+
Serial.println(degreeDEC);
39+
40+
if (isUnreachable) {
41+
ShowStatusMessage("Unreachable...");
42+
}
43+
else {
44+
// Calculate total steps needed
45+
startMoveSteppersToTargetAsync();
46+
if (!stepperRA.isRunning() && !stepperDEC.isRunning()) {
47+
ShowStatusMessage("Already there..");
48+
} else {
49+
poiMoving = true;
50+
}
51+
}
52+
}
53+
}
54+
break;
55+
56+
case btnLEFT:
57+
case btnDOWN: {
58+
currentPOI = adjustWrap(currentPOI, 1, 0, lastPOI);
59+
}
60+
break;
61+
62+
case btnUP: {
63+
currentPOI = adjustWrap(currentPOI, -1, 0, lastPOI);
64+
}
65+
break;
66+
67+
case btnRIGHT: {
68+
stopSteppers();
69+
poiMoving = false;
70+
lcdMenu.setNextActive();
71+
}
72+
break;
73+
}
74+
75+
lastKey = key;
76+
if (poiMoving) {
77+
moveSteppersToTargetAsync();
78+
if (!stepperRA.isRunning() && !stepperDEC.isRunning()) {
79+
poiMoving = false;
80+
}
81+
}
82+
}
83+
84+
void printPOISubmenu() {
85+
if (poiMoving) {
86+
}
87+
else {
88+
lcdMenu.printMenu(pointOfInterest[currentPOI].pDisplay);
89+
}
90+
}

Software/Arduino code/OpenAstroTracker/c725_menuHOME.ino

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ void processHomeKeys(int key) {
22
switch (key) {
33
case btnSELECT: {
44
if ((stepperRA.currentPosition() == 0) && (stepperDEC.currentPosition() == 0)) {
5-
lcdMenu.setCursor(0, 1);
6-
lcdMenu.printMenu("Already Home...");
7-
long now = millis();
8-
while (millis() - now < 750) {
9-
runTracker();
10-
}
5+
ShowStatusMessage("Already Home...");
116
}
127

138
stepperRA.moveTo(0);

Software/Arduino code/OpenAstroTracker/c_buttons.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ void loop() {
2222
handleDECandRACalculations();
2323
processDECKeys(lcd_key);
2424
break;
25+
case POI_Menu:
26+
processPOIKeys(lcd_key);
27+
break;
2528
case Home_Menu:
2629
processHomeKeys(lcd_key);
2730
break;

Software/Arduino code/OpenAstroTracker/e_printout.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
switch (lcdMenu.getActive()) {
88
case RA_Menu: printRASubmenu(); break;
99
case DEC_Menu: printDECSubmenu(); break;
10+
case POI_Menu: printPOISubmenu(); break;
1011
case HA_Menu: printHASubmenu(); break;
1112
case Home_Menu: printHomeSubmenu(); break;
1213
case Polaris_Menu: printPolarisSubmenu(); break;

0 commit comments

Comments
 (0)