Skip to content

Commit 8cb4e21

Browse files
V1.7.25.A2 - Updates
- Made LCD ask for arcminutes. Plus-minus 60m at a time (130m is complete range) - Removed speed control for Az/Alt motors
1 parent e240f67 commit 8cb4e21

File tree

4 files changed

+421
-3
lines changed

4 files changed

+421
-3
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#ifndef _GLOBALS_HPP_
2+
#define _GLOBALS_HPP_
3+
4+
#include <Arduino.h>
5+
#include <WString.h>
6+
7+
// Set to 1 if you are in the northern hemisphere.
8+
#define NORTHERN_HEMISPHERE 1
9+
10+
// Time in ms between LCD screen updates during slewing operations
11+
#define DISPLAY_UPDATE_TIME 200
12+
13+
// Stepper selection ///////////
14+
#define RA_Stepper_TYPE 0 // 28BYJ-48 = 0 | NEMA = 1
15+
#define DEC_Stepper_TYPE 0 // 28BYJ-48 = 0 | NEMA = 1
16+
17+
// Are we supporting the Azimuth PA motor?
18+
#define AZIMUTH_MOTOR 1
19+
20+
// Make some variables in the sketch files available to the C++ code.
21+
extern bool inSerialControl;
22+
extern String version;
23+
extern byte PolarisRAHour;
24+
extern byte PolarisRAMinute;
25+
extern byte PolarisRASecond;
26+
extern float RAStepsPerRevolution;
27+
extern int RAPulleyTeeth;
28+
extern float RACircumference;
29+
extern float DECStepsPerRevolution;
30+
extern int DecPulleyTeeth;
31+
32+
// Debugging output control
33+
// Debug log output is tricky, since if we simply send it out via Serial and a client is connected via Serial (USB),
34+
// the debug spew will interfere the protocol and confuse the client. To still be able to get access to debug logs in
35+
// this scenario, you can collect the debug logs in a memory ring buffer instead of sending them to Serial by
36+
// enabling the setting below
37+
// Use the Meade extension command :XGO# to retrieve the logs
38+
#define BUFFER_LOGS 0
39+
40+
// The level of debugging spew is controlled by setting DEBUG_LEVEL to a combination of the bit flags below.
41+
// Each bit in the debug level specifies a kind of debug to enable.
42+
#define DEBUG_NONE 0x00
43+
#define DEBUG_INFO 0x01
44+
#define DEBUG_SERIAL 0x02
45+
#define DEBUG_WIFI 0x04
46+
#define DEBUG_MOUNT 0x08
47+
#define DEBUG_MOUNT_VERBOSE 0x10
48+
#define DEBUG_GENERAL 0x20
49+
#define DEBUG_MEADE 0x40
50+
#define DEBUG_VERBOSE 0x80
51+
#define DEBUG_ANY 0xFF
52+
53+
// Bit Name Output
54+
// 0 DEBUG_INFO General output, like startup variables and status
55+
// 1 DEBUG_SERIAL Serial commands and replies
56+
// 2 DEBUG_WIFI Wifi related output
57+
// 3 DEBUG_MOUNT Mount processing output
58+
// 4 DEBUG_MOUNT_VERBOSE Verbose mount processing (coordinates, etc)
59+
// 5 DEBUG_GENERAL Other misc. output
60+
// 6 DEBUG_MEADE Meade command handling output
61+
// 7 DEBUG_VERBOSE other verbose debug output
62+
// 7 DEBUG_ANY all debug output
63+
64+
// Set this to specify the amount of debug output OAT should generate.
65+
// #define DEBUG_LEVEL (DEBUG_SERIAL|DEBUG_WIFI|DEBUG_INFO|DEBUG_MOUNT|DEBUG_GENERAL)
66+
// #define DEBUG_LEVEL (DEBUG_ANY)
67+
// #define DEBUG_LEVEL (DEBUG_INFO|DEBUG_MOUNT|DEBUG_GENERAL)
68+
// #define DEBUG_LEVEL (DEBUG_WIFI|DEBUG_MEADE|DEBUG_INFO|DEBUG_GENERAL)
69+
// #define DEBUG_LEVEL (DEBUG_MEADE|DEBUG_INFO|DEBUG_GENERAL)
70+
#define DEBUG_LEVEL (DEBUG_NONE)
71+
72+
// Set this to 1 to run a key diagnostic. No tracker functions are on at all.
73+
#define LCD_BUTTON_TEST 0
74+
75+
// Set to 1 to reverse the direction of RA motor
76+
#define INVERT_RA_DIR 0
77+
78+
// Set to 1 to reverse the direction of DEC motor
79+
#define INVERT_DEC_DIR 0
80+
81+
// If you do not have a LCD shield on your Arduino Uno, set this to 1 on the line below. This is
82+
// useful if you are always going to run the mount from a laptop anyway.
83+
#define HEADLESS_CLIENT 0
84+
85+
// This is set to 1 for boards that do not support interrupt timers
86+
#define RUN_STEPPERS_IN_MAIN_LOOP 0
87+
88+
#if defined(ESP8266) || defined(ESP32)
89+
#define ESPBOARD
90+
#undef HEADLESS_CLIENT
91+
#define HEADLESS_CLIENT 1
92+
#define WIFI_ENABLED
93+
#define INFRA_SSID "YourSSID"
94+
#define INFRA_WPAKEY "YourWPAKey"
95+
#define OAT_WPAKEY "superSecret"
96+
#define HOSTNAME "OATerScope"
97+
// 0 - Infrastructure Only - Connecting to a Router
98+
// 1 - AP Mode Only - Acting as a Router
99+
// 2 - Attempt Infrastructure, Fail over to AP Mode.
100+
#define WIFI_MODE 2
101+
#if defined(ESP8266)
102+
#undef RUN_STEPPERS_IN_MAIN_LOOP
103+
#define RUN_STEPPERS_IN_MAIN_LOOP 1
104+
#endif
105+
#endif
106+
107+
108+
////////////////////////////////////////////////////////////////
109+
//
110+
// FEATURE SUPPORT SECTION
111+
//
112+
// Since the Arduino Uno has very little memory (32KB code, 2KB data) all features
113+
// stretch the Uno a little too far. So in order to save memory we allow you to enable
114+
// and disable features to help manage memory usage.
115+
// If you run the tracker with an Arduino Mega, you can set all the features to 1.
116+
//
117+
// If you would like to drive your OAT mount with only the LCD Shield, or are on a Uno,
118+
// you should set SUPPORT_SERIAL_CONTROL to 0
119+
//
120+
// If you feel comfortable with configuring the OAT at startup manually, you should set
121+
// SUPPORT_GUIDED_STARTUP to 0 (maybe after you've used it for a while you know what to do).
122+
//
123+
// The POI menu can take a little data memory and you may not need it. If not, you can set
124+
// SUPPORT_POINTS_OF_INTEREST to 0
125+
//
126+
////////////////////////////////////////////////////////////////
127+
128+
// Set this to 1 this to enable the heating menu
129+
// NOTE: Heating is currently not supported!
130+
#define SUPPORT_HEATING 0
131+
132+
#if HEADLESS_CLIENT == 0
133+
134+
// Set this to 1 to support Guided Startup
135+
#define SUPPORT_GUIDED_STARTUP 1
136+
137+
// Set this to 1 to support full GO (was POI) menu.
138+
// If this is set to 0 you still have a GO menu that has Home and Park.
139+
#define SUPPORT_POINTS_OF_INTEREST 1
140+
141+
// Set this to 1 to support CTRL menu, allowing you to manually slew the mount with the buttons.
142+
#define SUPPORT_MANUAL_CONTROL 1
143+
144+
// Set this to 1 to support CAL menu, allowing you to calibrate various things
145+
#define SUPPORT_CALIBRATION 1
146+
147+
// Set this to 1 to support INFO menu that displays various pieces of information about the mount.
148+
#define SUPPORT_INFO_DISPLAY 1
149+
150+
// Set this to 1 to support Serial Meade LX200 protocol support
151+
#define SUPPORT_SERIAL_CONTROL 1
152+
153+
#else
154+
// If we are making a headleass (no screen, no keyboard) client, always enable Serial.
155+
#define SUPPORT_SERIAL_CONTROL 1
156+
#endif // HEADLESS_CLIENT
157+
158+
#endif // _GLOBALS_HPP

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,18 @@ void Mount::configureDECStepper(byte stepMode, byte pin1, byte pin2, byte pin3,
329329
_stepperDEC->setAcceleration(maxAcceleration);
330330
_maxDECSpeed = maxSpeed;
331331
_maxDECAcceleration = maxAcceleration;
332+
333+
#if AZIMUTH_MOTOR
334+
_stepperAZ = new AccelStepper(FULLSTEP, 38, 42, 40, 44);
335+
_stepperAZ ->setSpeed(150);
336+
_stepperAZ ->setMaxSpeed(300);
337+
_stepperAZ->setAcceleration(400);
338+
_stepperALT = new AccelStepper(FULLSTEP, 46, 50, 48, 52);
339+
_stepperALT ->setSpeed(150);
340+
_stepperALT ->setMaxSpeed(300);
341+
_stepperALT->setAcceleration(400);
342+
#endif
343+
>>>>>>> 22be349... V1.7.25.A2 - Updates
332344
}
333345
#endif
334346

@@ -975,6 +987,29 @@ void Mount::goHome()
975987
_slewingToHome = true;
976988
}
977989

990+
/////////////////////////////////
991+
//
992+
// moveBy
993+
//
994+
/////////////////////////////////
995+
void Mount::moveBy(int direction, float arcMinutes)
996+
{
997+
#if AZIMUTH_MOTORS == 1
998+
if (direction == AZIMUTH_STEPS){
999+
const float azimuthArcSecondsPerStep = 3.939f;
1000+
const float azimuthStepsPerArcMinute = 60.0f / azimuthArcSecondsPerStep;
1001+
int stepsToMove = arcMinutes*azimuthStepsPerArcMinute ;
1002+
_stepperAZ->move(stepsToMove);
1003+
}
1004+
else if (direction == ALTITUDE_STEPS){
1005+
const float altitudeArcSecondsPerStep = 3.939f;
1006+
const float altitudeStepsPerArcMinute = 60.0f / altitudeArcSecondsPerStep;
1007+
int stepsToMove = arcMinutes * altitudeStepsPerArcMinute ;
1008+
_stepperALT->move(stepsToMove);
1009+
}
1010+
#endif
1011+
}
1012+
9781013
/////////////////////////////////
9791014
//
9801015
// mountStatus
@@ -1343,6 +1378,15 @@ void Mount::interruptLoop()
13431378
_stepperRA->run();
13441379
}
13451380
}
1381+
<<<<<<< HEAD
1382+
=======
1383+
1384+
#if AZIMUTH_MOTOR
1385+
_stepperAZ->run();
1386+
_stepperALT->run();
1387+
#endif
1388+
1389+
>>>>>>> 22be349... V1.7.25.A2 - Updates
13461390
}
13471391

13481392
/////////////////////////////////

Software/Arduino code/OpenAstroTracker/Mount.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ class Mount {
201201
// Set the speed of the given motor
202202
void setSpeed(int which, float speed);
203203

204+
// Support for moving the mount in azimuth and altitude (requires extra hardware)
205+
void moveBy(int direction, float arcMinutes);
206+
204207
// Set the number of steps to use for backlash correction
205208
void setBacklashCorrection(int steps);
206209

0 commit comments

Comments
 (0)