Skip to content

Commit f4d0147

Browse files
Menu improvements. Up/Down support in HA.
Added a custom character for menu highlighting. Selected menu item is now always center screen. HA adjustments supports Up and Down and correctly wraps around.
1 parent 5491783 commit f4d0147

File tree

5 files changed

+82
-30
lines changed

5 files changed

+82
-30
lines changed

Software/Arduino code/OpenAstroTracker/a_inits.ino

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ int HAm_save;
115115
float slew_RA;
116116
float slew_DEC;
117117

118+
int rightArrow = 4;
119+
int leftArrow = 3;
120+
118121
byte DEG[8] = {
119122
B01100,
120123
B10010,
@@ -148,6 +151,27 @@ byte sec[] = {
148151
B00000
149152
};
150153

154+
byte RightArr[] = {
155+
B00000,
156+
B01000,
157+
B01100,
158+
B01110,
159+
B01100,
160+
B01000,
161+
B00000,
162+
B00000
163+
};
164+
165+
byte LeftArr[] = {
166+
B00000,
167+
B00010,
168+
B00110,
169+
B01110,
170+
B00110,
171+
B00010,
172+
B00000,
173+
B00000
174+
};
151175

152176
//debugging
153177
String inBT;

Software/Arduino code/OpenAstroTracker/b_setup.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ void setup() {
99
lcd.createChar(0, DEG);
1010
lcd.createChar(1, min);
1111
lcd.createChar(2, sec);
12+
lcd.createChar(leftArrow, LeftArr);
13+
lcd.createChar(rightArrow, RightArr);
1214

1315
stepperRA.setMaxSpeed(RAspeed);
1416
stepperRA.setAcceleration(RAacceleration);

Software/Arduino code/OpenAstroTracker/c_buttons.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ void loop() {
3838
while (menu == 2) {
3939
if (HAselect == 0) hourHA += 1;
4040
if (HAselect == 1) minHA += 1;
41+
if (hourHA>24) hourHA-=24;
42+
if (minHA>60) minHA-=60;
4143

4244
EEPROM.update(1, hourHA);
4345
EEPROM.update(2, minHA);
@@ -69,8 +71,13 @@ void loop() {
6971

7072
break;
7173
}
72-
//while (menu == 2) {
73-
// break;
74+
while (menu == 2) {
75+
if (HAselect == 0) hourHA -= 1;
76+
if (HAselect == 1) minHA -= 1;
77+
if (hourHA<0) hourHA+=24;
78+
if (minHA<0) minHA+=60;
79+
break;
80+
}
7481

7582
/*while (menu == 4) { // only counting up recommended, breaks code otherwise
7683
if (HAselect == 0) hourHA -= 1;

Software/Arduino code/OpenAstroTracker/e_printout.ino

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ if (!pcControl) {
22
lcd.setCursor(0, 0);
33

44
if (north == true) {
5-
if (menu == 0) lcd.print(">RAs<DEC HA POL ");
6-
if (menu == 1) lcd.print(" RAs>DEC<HA POL ");
7-
if (menu == 2) lcd.print(" RAs DEC>HA<POL ");
8-
if (menu == 3) lcd.print(" RAs DEC HA>POL<");
9-
if (menu == 4) lcd.print(" DEC HA POL>HEAT");
10-
if (menu == 5) lcd.print("HA POL HEAT>CAL<");
5+
if (menu == 0) printMenu(" >RAs< DEC H");
6+
if (menu == 1) printMenu(" RAs >DEC< HA PO");
7+
if (menu == 2) printMenu(" DEC >HA < POL H");
8+
if (menu == 3) printMenu(" HA >POL< HEAT ");
9+
if (menu == 4) printMenu(" POL >HEAT< CAL ");
10+
if (menu == 5) printMenu("HEAT >CAL< ");
1111
}
1212
else {
13-
if (menu == 0) lcd.print(">RAs<DEC HA HEAT");
14-
if (menu == 1) lcd.print(" RAs>DEC<HA HEAT");
15-
if (menu == 2) lcd.print(" RAs DEC>HA<HEAT");
16-
//if (menu == 3) lcd.print(" RAs DEC HA>POL<");
17-
if (menu == 4) lcd.print(" DEC HA>HEAT<CAL");
18-
if (menu == 5) lcd.print("DEC HA HEAT>CAL<");
13+
if (menu == 0) printMenu(" >RAs< DEC H");
14+
if (menu == 1) printMenu(" RAs >DEC< HA HE");
15+
if (menu == 2) printMenu(" DEC >HA < HEAT ");
16+
17+
if (menu == 4) printMenu(" HA >HEAT< CAL ");
18+
if (menu == 5) printMenu("HEAT >CAL< ");
1919
}
2020

2121

@@ -29,7 +29,7 @@ if (!pcControl) {
2929
if (hourRAprint < 0) hourRAprint += 24;
3030
if (minRAprint < 0) minRAprint += 60;
3131
if (RAselect == 0) {
32-
lcd.print(">");
32+
lcd.write(rightArrow);
3333
lcd.print(int(hourRAprint));
3434
lcd.print("h ");
3535
lcd.print(int(minRAprint));
@@ -47,7 +47,7 @@ if (!pcControl) {
4747
lcd.print(" ");
4848
lcd.print(int(hourRAprint));
4949
lcd.print("h");
50-
lcd.print(">");
50+
lcd.write(rightArrow);
5151
lcd.print(int(minRAprint));
5252
lcd.print("m ");
5353
lcd.print(int(secRAprint));
@@ -62,7 +62,7 @@ if (!pcControl) {
6262
lcd.print(" ");
6363
lcd.print(int(minRAprint));
6464
lcd.print("m");
65-
lcd.print(">");
65+
lcd.write(rightArrow);
6666
lcd.print(int(secRAprint));
6767
lcd.print("s ");
6868
lcd.print(" ");
@@ -72,7 +72,7 @@ if (!pcControl) {
7272
//DEC menu printing =menu1 ------------------------------
7373
if (menu == 1) {
7474
if (DECselect == 0) {
75-
lcd.print(">");
75+
lcd.write(rightArrow);
7676
lcd.print(printdegDEC);
7777
lcd.write(byte(0));
7878
lcd.print(" ");
@@ -92,7 +92,7 @@ if (!pcControl) {
9292
lcd.print(" ");
9393
lcd.print(printdegDEC);
9494
lcd.write(byte(0));
95-
lcd.print(">");
95+
lcd.write(rightArrow);
9696
lcd.print(minDEC);
9797
lcd.write(byte(1));
9898
lcd.print(" ");
@@ -107,7 +107,7 @@ if (!pcControl) {
107107
lcd.print(" ");
108108
lcd.print(minDEC);
109109
lcd.write(byte(1));
110-
lcd.print(">");
110+
lcd.write(rightArrow);
111111
lcd.print(secDEC);
112112
lcd.write(byte(2));
113113
lcd.print(" ");
@@ -130,37 +130,39 @@ if (!pcControl) {
130130
//heating menu -----------------------
131131
if (menu == 4) {
132132
if (heatselect == 0 && RAheat == 0 && DECheat == 0) {
133-
lcd.print("RA>OFF< DEC: OFF ");
133+
printMenu("RA>OFF< DEC: OFF ");
134134
}
135135
if (heatselect == 0 && RAheat == 1 && DECheat == 0) {
136-
lcd.print("RA>ON < DEC: OFF ");
136+
printMenu("RA>ON < DEC: OFF ");
137137
}
138138
if (heatselect == 0 && RAheat == 0 && DECheat == 1) {
139-
lcd.print("RA>OFF< DEC: ON ");
139+
printMenu("RA>OFF< DEC: ON ");
140140
}
141141
if (heatselect == 0 && RAheat == 1 && DECheat == 1) {
142-
lcd.print("RA>ON < DEC: ON ");
142+
printMenu("RA>ON < DEC: ON ");
143143
}
144144
if (heatselect == 1 && RAheat == 0 && DECheat == 0) {
145-
lcd.print("RA:OFF DEC>OFF< ");
145+
printMenu("RA:OFF DEC>OFF< ");
146146
}
147147
if (heatselect == 1 && RAheat == 1 && DECheat == 0) {
148-
lcd.print("RA:ON DEC>OFF< ");
148+
printMenu("RA:ON DEC>OFF< ");
149149
}
150150
if (heatselect == 1 && RAheat == 0 && DECheat == 1) {
151-
lcd.print("RA:OFF DEC>ON< ");
151+
printMenu("RA:OFF DEC>ON< ");
152152
}
153153
if (heatselect == 1 && RAheat == 1 && DECheat == 1) {
154-
lcd.print("RA:ON DEC>ON< ");
154+
printMenu("RA:ON DEC>ON< ");
155155
}
156156
}
157+
157158
//HA menu printing =menu2 -----------------------------
158159
if (menu == 2) {
159160
if (HAselect == 0) {
160161
//lcd.print("Input HA:");
161-
lcd.print(">");
162+
lcd.write(rightArrow);
162163
lcd.print(hourHAzeit);
163164
lcd.print("h");
165+
lcd.print(" ");
164166
lcd.print(minHAzeit);
165167
lcd.print("m");
166168
//lcd.print(trackingspeed, 5);
@@ -169,9 +171,10 @@ if (!pcControl) {
169171
}
170172
if (HAselect == 1) {
171173
//lcd.print("Input HA ");
174+
lcd.print(" ");
172175
lcd.print(hourHAzeit);
173176
lcd.print("h");
174-
lcd.print(">");
177+
lcd.write(rightArrow);
175178
lcd.print(minHAzeit);
176179
lcd.print("m");
177180
lcd.print(" ");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
void printMenu(String line)
2+
{
3+
for (int i=0;i<line.length();i++)
4+
{
5+
if (line[i]=='>'){
6+
lcd.write(rightArrow);
7+
}
8+
else if (line[i]=='<'){
9+
lcd.write(leftArrow);
10+
}
11+
else
12+
{
13+
lcd.print(line[i]);
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)