Skip to content

Commit d9d3588

Browse files
V1.8.17 - Updates
- Added directional control support to Polar Alignment for Azimuth/Altitude motors if enabled. - Moved some defines around
1 parent 33f2743 commit d9d3588

File tree

5 files changed

+128
-45
lines changed

5 files changed

+128
-45
lines changed

Software/Arduino code/OpenAstroTracker/Configuration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
=======================================================================================================================================
1919
*/
2020

21-
String version = "V1.8.16";
21+
String version = "V1.8.17";
2222

2323
///////////////////////////////////////////////////////////////////////////
2424
// Also use Configuration_adv for further adjustments!

Software/Arduino code/OpenAstroTracker/Configuration_adv.hpp

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
#ifndef _GLOBALS_HPP_
2-
#define _GLOBALS_HPP_
1+
#pragma once
32

43
#include <Arduino.h>
54
#include <WString.h>
65

6+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7+
// Some definitions. ////
8+
// ////
9+
// DO NOT EDIT THESE ////
10+
////////////////////////////
11+
// Stepper motor types
12+
#define STEP_28BYJ48 0
13+
#define STEP_NEMA17 1
14+
15+
// Driver selection
16+
#define ULN2003_DRIVER 0
17+
#define GENERIC_DRIVER 1
18+
#define TMC2209_STANDALONE 2
19+
#define TMC2209_UART 3
20+
//// DO NOT EDIT ABOVE HERE //////////////////////////////////////////////////////////////////////////////////////////////////
21+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
22+
23+
724
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
825
// ////
926
// STEPPER SETTINGS ////
1027
// ////
1128
////////////////////////////
1229
//
1330
// STEPPER TYPE
14-
#define STEP_28BYJ48 0
15-
#define STEP_NEMA17 1
1631
#define RA_STEPPER_TYPE STEP_28BYJ48
1732
#define DEC_STEPPER_TYPE STEP_28BYJ48
1833
//
@@ -29,11 +44,6 @@
2944
// TMC2209 can
3045
////////////////////////////
3146
//
32-
// Driver selection
33-
#define ULN2003_DRIVER 0
34-
#define GENERIC_DRIVER 1
35-
#define TMC2209_STANDALONE 2
36-
#define TMC2209_UART 3
3747

3848
// GENERIC drivers include A4988 and any Bipolar STEP/DIR based drivers
3949
#define RA_DRIVER_TYPE ULN2003_DRIVER
@@ -58,9 +68,8 @@
5868
// ^^^ leave at 0 for now, doesnt work properly yet
5969
#define RA_AUDIO_FEEDBACK 0 // If one of these are set to 1, the respective driver will shut off the stealthchop mode, resulting in a audible whine
6070
#define DEC_AUDIO_FEEDBACK 0 // of the stepper coils. Use this to verify that UART is working properly.
61-
//
62-
//
63-
//
71+
72+
6473
////////////////////////////
6574
//
6675
// GUIDE SETTINGS
@@ -70,25 +79,23 @@
7079
// Standard value: RA 2.0; DEC 1.0
7180
#define RA_PULSE_MULTIPLIER 1.5
7281
#define DEC_PULSE_MULTIPLIER 1.0
73-
//
74-
//
82+
83+
7584
////////////////////////////
7685
//
7786
// INVERT AXIS
7887
// Set to 1 or 0 to invert motor directions
7988
#define INVERT_RA_DIR 0
8089
#define INVERT_DEC_DIR 0
81-
//
82-
//
90+
91+
8392
////////////////////////////
8493
//
8594
// HEMISPHERE
8695
// Set to 1 if you are in the northern hemisphere.
8796
#define NORTHERN_HEMISPHERE 1
88-
//
89-
//
90-
//
91-
//
97+
98+
9299
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
93100
// ////////
94101
// LCD SETTINGS ////////
@@ -98,16 +105,16 @@
98105
// UPDATE TIME
99106
// Time in ms between LCD screen updates during slewing operations
100107
#define DISPLAY_UPDATE_TIME 200
101-
//
102-
//
108+
109+
103110
////////////////////////////
104111
//
105112
// HEADLESS CLIENT
106113
// If you do not have a LCD shield on your Arduino Uno/Mega, set this to 1 on the line below. This is
107114
// useful if you are always going to run the mount from a laptop anyway.
108115
#define HEADLESS_CLIENT 0
109-
//
110-
//
116+
117+
111118
////////////////////////////
112119
//
113120
// LCD BUTTON TEST
@@ -125,26 +132,22 @@
125132
#define AZIMUTH_ALTITUDE_MOTORS 0
126133

127134
#define AZIMUTH_MAX_SPEED 500
128-
#define AZIMUTH_MAX_ACCEL 400
135+
#define AZIMUTH_MAX_ACCEL 200
129136
#define AZIMUTH_ARC_SECONDS_PER_STEP (3.99985f)
130137
#define AZIMUTH_STEPS_PER_ARC_MINUTE (60.0f/AZIMUTH_ARC_SECONDS_PER_STEP)
131138

132139
#define ALTITUDE_MAX_SPEED 500
133-
#define ALTITUDE_MAX_ACCEL 400
140+
#define ALTITUDE_MAX_ACCEL 200
134141
#define ALTITUDE_ARC_SECONDS_PER_STEP (0.61761f)
135142
#define ALTITUDE_STEPS_PER_ARC_MINUTE (60.0f/ALTITUDE_ARC_SECONDS_PER_STEP)
136143

137144

138-
139-
//
140145
// Set this to 1 if you are using a NEO6m GPS module for HA/LST and location automatic determination.
141146
// GPS uses Serial1 by default, which is pins 18/19 on Mega. Change in configuration_adv.hpp
142147
#define USE_GPS 0
143148
// If supported, download the library https://github.com/mikalhart/TinyGPSPlus/releases and extract it to C:\Users\*you*\Documents\Arduino\libraries
144149

145150

146-
147-
//
148151
// Set this to 1 if you are using a MPU6050 electronic level
149152
// Wire the board to 20/21 on Mega. Change in configuration_adv.hpp
150153
#define GYRO_LEVEL 0
@@ -231,12 +234,11 @@
231234

232235
#endif // End WIFI SETTINGS
233236

237+
234238
// This is set to 1 for boards that do not support interrupt timers
235239
#define RUN_STEPPERS_IN_MAIN_LOOP 0
236240

237241

238-
239-
240242
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
241243
// //////////
242244
// DEBUG OPTIONS //////////
@@ -254,13 +256,12 @@
254256
#define DEBUG_MEADE 0x40
255257
#define DEBUG_VERBOSE 0x80
256258
#define DEBUG_ANY 0xFF
257-
//
258-
//
259+
259260
////////////////////////////
260261
//
261262
// DEBUG OUTPUT
262263
//
263-
#define DEBUG_LEVEL (DEBUG_NONE)
264+
#define DEBUG_LEVEL (DEBUG_MOUNT|DEBUG_INFO)
264265
// #define DEBUG_LEVEL (DEBUG_SERIAL|DEBUG_WIFI|DEBUG_INFO|DEBUG_MOUNT|DEBUG_GENERAL)
265266
// #define DEBUG_LEVEL (DEBUG_ANY)
266267
// #define DEBUG_LEVEL (DEBUG_INFO|DEBUG_MOUNT|DEBUG_GENERAL)
@@ -282,10 +283,6 @@
282283

283284

284285

285-
286-
287-
288-
289286
////////////////////////////
290287
// ERRORS
291288

@@ -323,6 +320,3 @@ extern int RAPulleyTeeth;
323320
extern float RACircumference;
324321
extern float DECStepsPerRevolution;
325322
extern int DecPulleyTeeth;
326-
327-
328-
#endif // _GLOBALS_HPP

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,52 @@ void Mount::setSpeed(int which, float speed) {
11461146
else if (which == DEC_STEPS) {
11471147
_stepperDEC->setSpeed(speed);
11481148
}
1149+
#if AZIMUTH_ALTITUDE_MOTORS == 1
1150+
else if (which == AZIMUTH_STEPS) {
1151+
float curAzSpeed = _stepperAZ->speed();
1152+
1153+
// If we are changing directions or asking for a stop, do a stop
1154+
if ((signbit(speed) != signbit(curAzSpeed)) || (speed == 0))
1155+
{
1156+
_stepperAZ->stop();
1157+
while (_stepperAZ->isRunning()){
1158+
loop();
1159+
}
1160+
}
1161+
1162+
// Are we starting a move or changing speeds?
1163+
if (speed != 0) {
1164+
_stepperAZ->enableOutputs();
1165+
_stepperAZ->setSpeed(speed);
1166+
_stepperAZ->move(speed * 100000);
1167+
} // Are we stopping a move?
1168+
else if (speed == 0) {
1169+
_stepperAZ->disableOutputs();
1170+
}
1171+
}
1172+
else if (which == ALTITUDE_STEPS) {
1173+
float curAltSpeed = _stepperALT->speed();
1174+
1175+
// If we are changing directions or asking for a stop, do a stop
1176+
if ((signbit(speed) != signbit(curAltSpeed)) || (speed == 0))
1177+
{
1178+
_stepperALT->stop();
1179+
while (_stepperALT->isRunning()){
1180+
loop();
1181+
}
1182+
}
1183+
1184+
// Are we starting a move or changing speeds?
1185+
if (speed != 0) {
1186+
_stepperALT->enableOutputs();
1187+
_stepperALT->setSpeed(speed);
1188+
_stepperALT->move(speed * 100000);
1189+
} // Are we stopping a move?
1190+
else if (speed == 0) {
1191+
_stepperALT->disableOutputs();
1192+
}
1193+
}
1194+
#endif
11491195
}
11501196

11511197
/////////////////////////////////
@@ -1181,6 +1227,23 @@ void Mount::goHome()
11811227
#if AZIMUTH_ALTITUDE_MOTORS == 1
11821228
/////////////////////////////////
11831229
//
1230+
// isRunningAZ
1231+
//
1232+
/////////////////////////////////
1233+
bool Mount::isRunningAZ() const {
1234+
return _stepperAZ->isRunning();
1235+
}
1236+
1237+
/////////////////////////////////
1238+
//
1239+
// isRunningALT
1240+
//
1241+
/////////////////////////////////
1242+
bool Mount::isRunningALT() const {
1243+
return _stepperALT->isRunning();
1244+
}
1245+
/////////////////////////////////
1246+
//
11841247
// moveBy
11851248
//
11861249
/////////////////////////////////

Software/Arduino code/OpenAstroTracker/Mount.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ class Mount {
161161
bool isParking() const;
162162
bool isGuiding() const;
163163
bool isFindingHome() const;
164+
#if AZIMUTH_ALTITUDE_MOTORS == 1
165+
bool isRunningAZ() const;
166+
bool isRunningALT() const;
167+
#endif
164168

165169
// Starts manual slewing in one of eight directions or tracking
166170
void startSlewing(int direction);

Software/Arduino code/OpenAstroTracker/c76_menuCAL.hpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void gotoNextMenu()
118118
{
119119
lcdMenu.setNextActive();
120120

121-
#if AZIMUTH_ALTIUTUDE_MOTORS == 1
121+
#if AZIMUTH_ALTITUDE_MOTORS == 1
122122
mount.disableAzAltMotors();
123123
azAltMotorsStarted = false;
124124
#endif
@@ -201,7 +201,7 @@ bool processCalibrationKeys()
201201
bool waitForRelease = false;
202202
bool checkForKeyChange = true;
203203

204-
#if AZIMUTH_ALTIUTUDE_MOTORS == 1
204+
#if AZIMUTH_ALTITUDE_MOTORS == 1
205205
if (!azAltMotorsStarted)
206206
{
207207
mount.enableAzAltMotors();
@@ -292,6 +292,28 @@ bool processCalibrationKeys()
292292
calState = HIGHLIGHT_POLAR;
293293
}
294294
}
295+
else if (calState == POLAR_CALIBRATION_WAIT_CENTER_POLARIS){
296+
#if AZIMUTH_ALTITUDE_MOTORS == 1
297+
if (currentButtonState == btnUP)
298+
{
299+
if (!mount.isRunningALT()) {
300+
mount.setSpeed(ALTITUDE_STEPS, 500) ;
301+
}
302+
}
303+
else if (currentButtonState == btnDOWN)
304+
{
305+
if (!mount.isRunningALT()) {
306+
mount.setSpeed(ALTITUDE_STEPS, -500) ;
307+
}
308+
}
309+
else if (currentButtonState == btnNONE)
310+
{
311+
if (mount.isRunningALT()) {
312+
mount.setSpeed(ALTITUDE_STEPS, 0) ;
313+
}
314+
}
315+
#endif
316+
}
295317
else if (calState == DRIFT_CALIBRATION_RUNNING)
296318
{
297319
lcdMenu.setCursor(0, 1);

0 commit comments

Comments
 (0)