Skip to content

Commit 84cb2d2

Browse files
V1.6.25 - Updates
- Changed CTRL menu (and thus Guided startup Control) to move the steppers only while a button is depressed. This allows for much finer control and also is not as flaky as the other mode was. It also means movement in only one direction at a time is possible.
1 parent b5e5557 commit 84cb2d2

File tree

3 files changed

+75
-47
lines changed

3 files changed

+75
-47
lines changed

Software/Arduino code/OpenAstroTracker/DayTime.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "Utility.h"
22
#include "DayTime.hpp"
3+
4+
///////////////////////////////////
5+
// DayTime (and DegreeTime below)
6+
//
37
// A class to handle hours, minutes, seconds in a unified manner, allowing
48
// addition of hours, minutes, seconds, other times and conversion to string.
59

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
=======================================================================================================================================
33
4-
Version 1.6.22
4+
Version 1.6
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)
@@ -16,7 +16,7 @@
1616
*/
1717
#include "Globals.h"
1818

19-
String version = "V1.6.24";
19+
String version = "V1.6.25";
2020

2121
///////////////////////////////////////////////////////////////////////////
2222
// Please see the Globals.h file for configuration of the firmware.
@@ -56,13 +56,15 @@ int DECacceleration = 400;
5656

5757
// Define some stepper limits to prevent physical damage to the tracker. This assumes that the home
5858
// point (zero point) has been correctly set to be pointing at the celestial pole.
59+
// Note: these are currently not used
5960
float RAStepperLimit = 15500; // Going much more than this each direction will make the ring fall off the bearings.
6061

6162
// These are for 47N, so they will need adjustment if you're a lot away from that.
6263
// You can use the CTRL menu to find the limits and place them here. I moved it
6364
// down until my lens was horizontal. Note the DEC number. Then move it up until
6465
// the lens is horizontal and note that number. Put those here. Always watch your
6566
// tracker and hit RESET if it approaches a dangerous area.
67+
// Note: these are currently not used
6668
float DECStepperDownLimit = 10000; // Going much more than this will make the lens collide with the ring
6769
float DECStepperUpLimit = -22000; // Going much more than this is going below the horizon.
6870

Software/Arduino code/OpenAstroTracker/c75_menuCTRL.ino

Lines changed: 67 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,35 @@
22
bool confirmZeroPoint = false;
33
bool setZeroPoint = true;
44

5+
6+
#define LOOPS_TO_CONFIRM_KEY 10
7+
byte loopsWithKeyPressed = 0;
8+
byte keyPressed = btnNONE;
9+
10+
11+
bool processKeyStateChanges(int key, int dir)
12+
{
13+
bool ret = false;
14+
if (keyPressed != key) {
15+
loopsWithKeyPressed = 0;
16+
keyPressed = key;
17+
}
18+
else {
19+
if (loopsWithKeyPressed == LOOPS_TO_CONFIRM_KEY) {
20+
mount.stopSlewing(ALL_DIRECTIONS);
21+
mount.waitUntilStopped(ALL_DIRECTIONS);
22+
if (dir != 0) {
23+
mount.startSlewing(dir);
24+
}
25+
loopsWithKeyPressed++;
26+
ret = true;
27+
}
28+
else if (loopsWithKeyPressed < LOOPS_TO_CONFIRM_KEY) {
29+
loopsWithKeyPressed++;
30+
}
31+
}
32+
}
33+
534
bool processControlKeys() {
635
byte key;
736

@@ -35,8 +64,8 @@ bool processControlKeys() {
3564
startupState = StartupPoleConfirmed;
3665
inStartup = true;
3766
}
38-
else
39-
#endif
67+
else
68+
#endif
4069
{
4170
lcdMenu.setNextActive();
4271
}
@@ -50,56 +79,49 @@ bool processControlKeys() {
5079
return true;
5180
}
5281

53-
if (lcdButtons.keyChanged(key)) {
54-
switch (key) {
55-
case btnUP: {
56-
if (!mount.isSlewingDEC()) {
57-
mount.startSlewing(NORTH);
58-
} else {
59-
mount.stopSlewing(NORTH | SOUTH);
60-
}
61-
}
62-
break;
63-
64-
case btnDOWN: {
65-
if (!mount.isSlewingDEC()) {
66-
mount.startSlewing(SOUTH);
67-
} else {
68-
mount.stopSlewing(NORTH | SOUTH);
69-
}
70-
}
71-
break;
72-
73-
case btnLEFT: {
74-
if (!mount.isSlewingRA()) {
75-
mount.startSlewing(WEST);
76-
} else {
77-
mount.stopSlewing(EAST | WEST);
78-
}
79-
}
80-
break;
81-
82-
case btnRIGHT: {
83-
if (!mount.isSlewingRA()) {
84-
mount.startSlewing(EAST);
85-
} else {
86-
mount.stopSlewing(EAST | WEST);
87-
}
88-
}
89-
break;
82+
mount.loop();
83+
84+
key = lcdButtons.currentState();
85+
switch (key) {
86+
case btnUP: {
87+
processKeyStateChanges(btnUP, NORTH);
88+
}
89+
break;
90+
91+
case btnDOWN: {
92+
processKeyStateChanges(btnDOWN, SOUTH);
93+
}
94+
break;
95+
96+
case btnLEFT: {
97+
processKeyStateChanges(btnLEFT, WEST);
98+
}
99+
break;
90100

91-
case btnSELECT: {
92-
mount.stopSlewing(ALL_DIRECTIONS);
93-
mount.waitUntilStopped(ALL_DIRECTIONS);
101+
case btnRIGHT: {
102+
processKeyStateChanges(btnRIGHT, EAST);
103+
}
104+
break;
105+
106+
case btnSELECT: {
107+
if (processKeyStateChanges(btnSELECT, 0))
108+
{
94109
lcdMenu.setCursor(0, 0);
95110
lcdMenu.printMenu("Set home point?");
96111
confirmZeroPoint = true;
97112
}
98-
break;
99-
}
113+
}
114+
break;
115+
116+
case btnNONE: {
117+
processKeyStateChanges(btnNONE, 0);
118+
}
119+
break;
100120
}
101121

102-
return true;
122+
mount.loop();
123+
124+
return false;
103125
}
104126

105127

0 commit comments

Comments
 (0)