Skip to content

Commit 8beeb54

Browse files
V1.6.32 - Updates
- Added support for Drift Alignment in the CAL menu. - Changed default client to not include INFO menu (memory pressure - can be enabled is GUIDED_STARTUP is disabled).
1 parent 4e8e6f5 commit 8beeb54

File tree

5 files changed

+148
-16
lines changed

5 files changed

+148
-16
lines changed

Software/Arduino code/OpenAstroTracker/Globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern bool inSerialControl;
5757
#define SUPPORT_MANUAL_CONTROL
5858

5959
// Uncomment to support INFO menu that displays various pieces of information about the mount.
60-
#define SUPPORT_INFO_DISPLAY
60+
// #define SUPPORT_INFO_DISPLAY
6161

6262
// Uncomment to support Serial Meade LX200 protocol support
6363
// #define SUPPORT_SERIAL_CONTROL

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ void Mount::configureRAStepper(byte stepMode, byte pin1, byte pin2, byte pin3, b
7575
_stepperRA = new AccelStepper(stepMode, pin1, pin2, pin3, pin4);
7676
_stepperRA->setMaxSpeed(maxSpeed);
7777
_stepperRA->setAcceleration(maxAcceleration);
78-
// _maxRASpeed = maxSpeed;
79-
// _maxRAAcceleration = maxAcceleration;
78+
_maxRASpeed = maxSpeed;
79+
_maxRAAcceleration = maxAcceleration;
8080

8181
// Use another AccelStepper to run the RA motor as well. This instance tracks earths rotation.
8282
_stepperTRK = new AccelStepper(HALFSTEP, pin1, pin2, pin3, pin4);
@@ -356,6 +356,52 @@ void Mount::guidePulse(byte direction, int duration) {
356356
_guideEndTime = millis() + duration;
357357
}
358358

359+
/////////////////////////////////
360+
//
361+
// runDriftAlignmentPhase
362+
//
363+
// Runs one of the phases of the Drift alignment
364+
// This runs the RA motor 400 steps (about 5.3 arcminutes) in the given duration
365+
// This function should be callsed 3 times:
366+
// The first time with EAST, second with WEST and then with 0.
367+
/////////////////////////////////
368+
void Mount::runDriftAlignmentPhase(int direction, int durationSecs) {
369+
// Calculate the speed at which it takes the given duration to cover 400 steps.
370+
float speed = 400.0 / durationSecs;
371+
switch (direction) {
372+
case EAST:
373+
// Move 400 steps east at the calculated speed, synchronously
374+
_stepperRA->setAcceleration(1500);
375+
_stepperRA->setMaxSpeed(speed);
376+
_stepperRA->move(400);
377+
_stepperRA->runToPosition();
378+
379+
// Overcome the gearing gap
380+
_stepperRA->setMaxSpeed(300);
381+
_stepperRA->move(-20);
382+
_stepperRA->runToPosition();
383+
break;
384+
385+
case WEST:
386+
// Move 400 steps west at the calculated speed, synchronously
387+
_stepperRA->setMaxSpeed(speed);
388+
_stepperRA->move(-400);
389+
_stepperRA->runToPosition();
390+
break;
391+
392+
case 0 :
393+
// Fix the gearing to go back the other way
394+
_stepperRA->setMaxSpeed(300);
395+
_stepperRA->move(20);
396+
_stepperRA->runToPosition();
397+
398+
// Re-configure the stepper to the correct parameters.
399+
_stepperRA->setAcceleration(_maxRAAcceleration);
400+
_stepperRA->setMaxSpeed(_maxRASpeed);
401+
break;
402+
}
403+
}
404+
359405
/////////////////////////////////
360406
//
361407
// park

Software/Arduino code/OpenAstroTracker/Mount.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ class Mount {
129129

130130
void displayStepperPositionThrottled();
131131

132+
void runDriftAlignmentPhase(int direction, int durationSecs);
133+
132134
private:
133135
void calculateRAandDECSteppers(float& targetRA, float& targetDEC);
134136
void displayStepperPosition();
@@ -150,9 +152,9 @@ class Mount {
150152
LcdMenu* _lcdMenu;
151153
int _stepsPerRADegree;
152154
int _stepsPerDECDegree;
153-
//int _maxRASpeed;
155+
int _maxRASpeed;
154156
int _maxDECSpeed;
155-
//int _maxRAAcceleration;
157+
int _maxRAAcceleration;
156158
int _maxDECAcceleration;
157159

158160
long _lastHASet;

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

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

Software/Arduino code/OpenAstroTracker/c76_menuCAL.ino

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
#ifndef HEADLESS_CLIENT
22

3+
// HIGHLIGHT states allow you to pick one of the three sub functions.
34
#define HIGHLIGHT_POLAR 1
45
#define HIGHLIGHT_SPEED 2
5-
#define POLAR_CALIBRATION_WAIT 3
6-
#define POLAR_CALIBRATION_GO 4
7-
#define POLAR_CALIBRATION_WAIT_HOME 5
8-
#define SPEED_CALIBRATION 6
9-
6+
#define HIGHLIGHT_DRIFT 3
7+
8+
// Polar calibration goes through these three states:
9+
// 4 - moving to RA of Polaris and then waiting on confirmation that Polaris is centered
10+
// 5 - moving to DEC beyond Polaris and waiting on confirmation that Polaris is centered
11+
// 6 - moving back to home position
12+
#define POLAR_CALIBRATION_WAIT 4
13+
#define POLAR_CALIBRATION_GO 5
14+
#define POLAR_CALIBRATION_WAIT_HOME 6
15+
16+
// Speed calibration only has one state, allowing you to adjust the speed with UP and DOWN
17+
#define SPEED_CALIBRATION 7
18+
19+
// Drift calibration goes through 4 states
20+
// 8 - Display four durations and wait for the user to select one
21+
// 9 - Start the calibration run after user presses SELECT. This state waits 1.5s, takes duration time
22+
// to slew east in half the time selected, then waits 1.5s and slews west in the same duration, and waits 1.5s.
23+
#define DRIFT_CALIBRATION_GET_DURATION 8
24+
#define DRIFT_CALIBRATION_RUNNING 9
25+
26+
// Start off with Polar Alignment higlighted.
1027
byte calState = HIGHLIGHT_POLAR;
1128

29+
// The index of durations that the user has selected.
30+
byte driftSubIndex = 1;
31+
32+
// The requested total duration of the drift alignment run.
33+
byte driftDuration = 0;
34+
1235
bool processCalibrationKeys() {
1336
byte key;
1437
bool waitForRelease = false;
@@ -43,10 +66,33 @@ bool processCalibrationKeys() {
4366
lcdMenu.updateDisplay();
4467
calState = HIGHLIGHT_POLAR;
4568
}
69+
} else if (calState == DRIFT_CALIBRATION_RUNNING) {
70+
lcdMenu.setCursor(0, 1);
71+
lcdMenu.printMenu("Pause 1.5s ...");
72+
mount.stopSlewing(TRACKING);
73+
mount.delay(1500);
74+
75+
lcdMenu.setCursor(0, 1);
76+
lcdMenu.printMenu("Eastward pass...");
77+
mount.runDriftAlignmentPhase(EAST, driftDuration);
78+
79+
lcdMenu.setCursor(0, 1);
80+
lcdMenu.printMenu("Pause 1.5s ...");
81+
mount.delay(1500);
82+
83+
lcdMenu.setCursor(0, 1);
84+
lcdMenu.printMenu("Westward pass...");
85+
mount.runDriftAlignmentPhase(WEST, driftDuration);
86+
87+
lcdMenu.setCursor(0, 1);
88+
lcdMenu.printMenu("Done. Pause 1.5s");
89+
mount.delay(1500);
90+
mount.runDriftAlignmentPhase(0, 0);
91+
92+
mount.startSlewing(TRACKING);
93+
calState = HIGHLIGHT_DRIFT;
4694
}
4795

48-
49-
5096
if (checkForKeyChange && lcdButtons.keyChanged(key)) {
5197
waitForRelease = true;
5298

@@ -87,13 +133,13 @@ bool processCalibrationKeys() {
87133

88134
case HIGHLIGHT_POLAR:
89135
if (key == btnDOWN) calState = HIGHLIGHT_SPEED;
90-
else if (key == btnUP) calState = HIGHLIGHT_SPEED;
136+
else if (key == btnUP) calState = HIGHLIGHT_DRIFT;
91137
else if (key == btnSELECT) {
92138
calState = POLAR_CALIBRATION_WAIT;
93139

94140
// Move the RA to that of Polaris. Moving to this RA aligns the DEC axis such that
95141
// it swings along the line between Polaris and the Celestial Pole.
96-
mount.targetRA() = DayTime(PolarisRAHour, PolarisRAMinute, PolarisRASecond);
142+
mount.targetRA() = DayTime(PolarisRAHour, PolarisRAMinute, PolarisRASecond);
97143
// Account for the current settings.
98144
mount.targetRA().addTime(mount.getHACorrection());
99145
mount.targetRA().subtractTime(mount.HA());
@@ -122,14 +168,45 @@ bool processCalibrationKeys() {
122168
break;
123169

124170
case HIGHLIGHT_SPEED:
125-
if (key == btnDOWN) calState = HIGHLIGHT_POLAR;
171+
if (key == btnDOWN) calState = HIGHLIGHT_DRIFT;
126172
if (key == btnUP) calState = HIGHLIGHT_POLAR;
127173
else if (key == btnSELECT) calState = SPEED_CALIBRATION;
128174
else if (key == btnRIGHT) {
129175
lcdMenu.setNextActive();
130176
calState = HIGHLIGHT_POLAR;
131177
}
132178
break;
179+
180+
case HIGHLIGHT_DRIFT:
181+
if (key == btnDOWN) calState = HIGHLIGHT_POLAR;
182+
if (key == btnUP) calState = HIGHLIGHT_SPEED;
183+
else if (key == btnSELECT) calState = DRIFT_CALIBRATION_GET_DURATION;
184+
else if (key == btnRIGHT) {
185+
lcdMenu.setNextActive();
186+
calState = HIGHLIGHT_POLAR;
187+
}
188+
break;
189+
190+
case DRIFT_CALIBRATION_GET_DURATION :
191+
if (key == btnDOWN || key == btnLEFT) {
192+
driftSubIndex = adjustWrap(driftSubIndex, 1, 0, 3);
193+
}
194+
if (key == btnUP) {
195+
driftSubIndex = adjustWrap(driftSubIndex, -1, 0, 3);
196+
}
197+
if (key == btnSELECT) {
198+
// Take off 6s padding time. 1.5s start pause, 1.5s pause in the middle and 1.5s end pause and general time slop.
199+
// These are the times for one way. So total time is 2 x duration + 4.5s
200+
int duration[] = { 27, 57, 87, 147};
201+
driftDuration = duration[driftSubIndex];
202+
calState = DRIFT_CALIBRATION_RUNNING;
203+
}
204+
else if (key == btnRIGHT) {
205+
// RIGHT cancels duration selection and returns to menu
206+
calState = HIGHLIGHT_DRIFT;
207+
driftSubIndex = 1;
208+
}
209+
break;
133210
}
134211
}
135212

@@ -161,6 +238,13 @@ void printCalibrationSubmenu() {
161238
dtostrf(mount.getSpeedCalibration(), 6, 4, &scratchBuffer[9]);
162239
lcdMenu.printMenu(scratchBuffer);
163240
break;
241+
case HIGHLIGHT_DRIFT:
242+
lcdMenu.printMenu(">Drift alignment");
243+
case DRIFT_CALIBRATION_GET_DURATION:
244+
sprintf(scratchBuffer, " 1m 2m 3m 5m");
245+
scratchBuffer[driftSubIndex * 4] = '>';
246+
lcdMenu.printMenu(scratchBuffer);
247+
break;
164248
}
165249
}
166250
#endif

0 commit comments

Comments
 (0)