Skip to content

Commit 9615a4b

Browse files
V1.6.14 - Updates
- Added Polar Alignment function to CAL menu - Added confirmation message that HA was saved. - Added confirmation message that Speed factor was saved.
1 parent 848b101 commit 9615a4b

File tree

3 files changed

+108
-31
lines changed

3 files changed

+108
-31
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.6.13
4+
Version 1.6.14
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.6.13";
17+
String version = "V1.6.14";
1818

1919
// See NORTHERN_HEMISPHERE in Globals.h if you not in the northern hemisphere
2020

Software/Arduino code/OpenAstroTracker/c72_menuHA.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ bool processHAKeys() {
3333
case btnRIGHT: {
3434
EEPROM.update(1, mount.HA().getHours());
3535
EEPROM.update(2, mount.HA().getMinutes());
36+
lcdMenu.printMenu("Stored.");
37+
mount.delay(500);
3638

3739
if (startupState == StartupWaitForHACompletion) {
3840
startupState = StartupHAConfirmed;
Lines changed: 104 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,123 @@
1+
#define HIGHLIGHT_POLAR 1
2+
#define HIGHLIGHT_SPEED 2
3+
#define POLAR_CALIBRATION 3
4+
#define SPEED_CALIBRATION 4
5+
6+
byte calState = HIGHLIGHT_POLAR;
7+
18
bool processCalibrationKeys() {
29
byte key;
310
bool waitForRelease = false;
11+
bool checkForKeyChange = true;
412

5-
if (lcdButtons.currentState() == btnUP) {
6-
inputcal += 1; //0.0001;
7-
mount.setSpeedCalibration(speed + inputcal / 10000);
8-
mount.delay(calDelay);
9-
calDelay = max(5, 0.96 * calDelay);
10-
}
11-
else if (lcdButtons.currentState() == btnDOWN) {
12-
inputcal -= 1 ; //0.0001;
13-
mount.setSpeedCalibration(speed + inputcal / 10000);
14-
mount.delay(calDelay);
15-
calDelay = max(5, 0.96 * calDelay);
13+
if (calState == SPEED_CALIBRATION)
14+
{
15+
if (lcdButtons.currentState() == btnUP) {
16+
inputcal += 1; //0.0001;
17+
mount.setSpeedCalibration(speed + inputcal / 10000);
18+
mount.delay(calDelay);
19+
calDelay = max(5, 0.96 * calDelay);
20+
checkForKeyChange = false;
21+
}
22+
else if (lcdButtons.currentState() == btnDOWN) {
23+
inputcal -= 1 ; //0.0001;
24+
mount.setSpeedCalibration(speed + inputcal / 10000);
25+
mount.delay(calDelay);
26+
calDelay = max(5, 0.96 * calDelay);
27+
checkForKeyChange = false;
28+
}
29+
else {
30+
calDelay = 150;
31+
}
1632
}
17-
else {
18-
calDelay = 150;
19-
if (lcdButtons.keyChanged(key)) {
20-
waitForRelease = true;
21-
switch (key) {
22-
case btnSELECT: {
33+
34+
if (checkForKeyChange && lcdButtons.keyChanged(key)) {
35+
waitForRelease = true;
36+
37+
switch (calState) {
38+
case POLAR_CALIBRATION: {
39+
if (key == btnSELECT) {
40+
mount.setTargetToHome();
41+
mount.startSlewingToTarget();
42+
lcdMenu.setNextActive();
43+
calState = HIGHLIGHT_POLAR;
44+
}
45+
if (key == btnRIGHT) {
46+
lcdMenu.setNextActive();
47+
calState = HIGHLIGHT_POLAR;
48+
}
49+
}
50+
break;
51+
case SPEED_CALIBRATION: {
52+
// UP and DOWN are handled above
53+
if (key == btnSELECT) {
2354
EEPROM.update(0, inputcal);
2455
mount.setSpeedCalibration(speed + inputcal / 10000);
56+
lcdMenu.printMenu("Stored.");
57+
mount.delay(500);
58+
calState = HIGHLIGHT_SPEED;
2559
}
26-
break;
27-
28-
case btnRIGHT: {
60+
else if (key == btnRIGHT) {
2961
lcdMenu.setNextActive();
62+
calState = HIGHLIGHT_POLAR;
3063
}
31-
break;
64+
}
65+
break;
3266

33-
case btnNONE: {
34-
}
35-
break;
36-
}
67+
case HIGHLIGHT_POLAR:
68+
if (key == btnDOWN) calState = HIGHLIGHT_SPEED;
69+
else if (key == btnSELECT) {
70+
calState = POLAR_CALIBRATION;
71+
72+
// Move the RA to that of Polaris. Moving to this RA aligns the DEC axis such that
73+
// it swings along the line between Polaris and the Celestial Pole.
74+
mount.targetRA() = DayTime(2, 57, 56); // This is Polaris RA.
75+
// Account for the current settings.
76+
mount.targetRA().addTime(mount.getHACorrection());
77+
mount.targetRA().subtractTime(mount.HA());
78+
79+
// Now set DEC to move the same distance past Polaris as it is from the Celestial Pole. That equates to 88deg 42' 6".
80+
mount.targetDEC() = DegreeTime(88 - (NORTHERN_HEMISPHERE ? 90 : -90), 42, 6);
81+
mount.startSlewingToTarget();
82+
}
83+
else if (key == btnRIGHT) {
84+
lcdMenu.setNextActive();
85+
calState = HIGHLIGHT_POLAR;
86+
}
87+
break;
88+
89+
case HIGHLIGHT_SPEED:
90+
if (key == btnDOWN) calState = HIGHLIGHT_POLAR;
91+
else if (key == btnSELECT) calState = SPEED_CALIBRATION;
92+
else if (key == btnRIGHT) {
93+
lcdMenu.setNextActive();
94+
calState = HIGHLIGHT_POLAR;
95+
}
96+
break;
3797
}
3898
}
39-
99+
40100
return waitForRelease;
41101
}
42102

43103
void printCalibrationSubmenu() {
44104
char scratchBuffer[20];
45-
sprintf(scratchBuffer, "SpdFctr: ");
46-
dtostrf(mount.getSpeedCalibration(), 6, 4, &scratchBuffer[9]);
47-
lcdMenu.printMenu(scratchBuffer);
105+
switch (calState) {
106+
case HIGHLIGHT_POLAR :
107+
lcdMenu.printMenu(">Polar alignment");
108+
break;
109+
case HIGHLIGHT_SPEED:
110+
lcdMenu.printMenu(">Speed calibratn");
111+
break;
112+
case POLAR_CALIBRATION :
113+
if (!mount.isSlewingRAorDEC()) {
114+
lcdMenu.printMenu("Centr on Polaris");
115+
}
116+
break;
117+
case SPEED_CALIBRATION :
118+
sprintf(scratchBuffer, "SpdFctr: ");
119+
dtostrf(mount.getSpeedCalibration(), 6, 4, &scratchBuffer[9]);
120+
lcdMenu.printMenu(scratchBuffer);
121+
break;
122+
}
48123
}

0 commit comments

Comments
 (0)