@@ -36,113 +36,113 @@ LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
36
36
#define RA_Menu 0
37
37
#define DEC_Menu 1
38
38
#define HA_Menu 2
39
- #define Polaris_Menu 3
40
39
#define Heat_Menu 4
41
40
#define Calibration_Menu 5
42
41
#define Control_Menu 6
43
42
#define Home_Menu 7
44
43
#define POI_Menu 8
44
+ #define Status_Menu 9
45
45
46
46
// Stepper control for RA and DEV.
47
47
// TRK is used for live tracking and runs in parallel with RA.
48
48
// GUIDE is used for Stellarium control
49
49
AccelStepper stepperRA (FULLSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
50
50
AccelStepper stepperDEC (HALFSTEP, motorPin11, motorPin13, motorPin12, motorPin14);
51
- AccelStepper stepperTRK (HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4); // yes, this is the same motor as stepperRA, dont ask why
52
- AccelStepper stepperGUIDE (HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
53
51
54
- int lcd_key = 0 ; // The current key state
55
- int adc_key_in = 0 ; // The analog value of the keys
52
+ // Use another AccelStepper to run the RA motor as well. This instance tracks earths rotation.
53
+ AccelStepper stepperTRK (HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
54
+
55
+ // Use another AccelStepper to run the RA motor as well for use with Stellarium... hmmmm....
56
+ AccelStepper stepperGUIDE (HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
56
57
57
58
String inString = " " ;
58
59
59
- bool inStartup = true ; // Start with a guided startup
60
+ bool inStartup = true ; // Start with a guided startup
60
61
62
+ // Serial control variables
61
63
bool inSerialControl = false ; // When the serial port is in control
62
64
bool serialIsSlewing = false ; // When the serial port is slewing the tracker
65
+ bool quitSerialOnNextButtonRelease = false ; // Used to detect SELECT button to quit Serial mode.
66
+ String logString;
67
+ boolean isPulseGuiding = true ;
63
68
69
+ // Display related variables
70
+ int displayLoopsToSkip = 400 ; // Update the LCD every 400 iterations (perf issue)
71
+ int displaySkipsLeft = 0 ; // How many loop cycles left before updating the display
72
+ float totalDECMove = 0 ; // The number of DEC steps we asked for
73
+ float totalRAMove = 0 ;
74
+ int leftArrow = 3 ; // LCD special chars
75
+ int rightArrow = 4 ; // LCD special chars
64
76
65
- int calDelay = 150 ; // The current delay when changing calibration value. The longer a button is depressed, the samller this gets.
66
-
67
- bool waitForButtonRelease = false ; // When a button is pressed should we wait for its release before another loop?
77
+ // Calibration variables
78
+ float inputcal; // calibration variable set form as integer. Added to speed after dividing by 10000
79
+ float speedCalibration; // speed calibration factor
80
+ int calDelay = 150 ; // The current delay in ms when changing calibration value. The longer a button is depressed, the smaller this gets.
68
81
69
82
// Variables for use in the CONTROL menu
83
+ bool inControlMode = false ; // Is manual control enabled
70
84
int StateMaskDEC = 0x0011 ; // Is the DEC stepper running?
71
85
int StateMaskUp = 0x0001 ; // Is the DEC stepper moving upwards?
72
86
int StateMaskDown = 0x0010 ; // Is the DEC stepper moving downwards?
73
87
int StateMaskRA = 0x1100 ; // Is the RA stepper running?
74
88
int StateMaskLeft = 0x0100 ; // Is the RA stepper moving left (CW)?
75
89
int StateMaskRight = 0x1000 ; // Is the RA stepper moving right (CCW)?
76
-
77
90
int controlState = 0x0000 ; // The current state of the steppers (combination of above values)
78
- int controlDisplay = 0 ; // How many loop cycles left before updating the display
79
- bool inControlMode = false ; // Is manual control enabled
80
91
92
+ // Main loop variables
93
+ int lcd_key = 0 ; // The current key state
94
+ int adc_key_in = 0 ; // The analog value of the keys
95
+ bool waitForButtonRelease = false ; // When a button is pressed should we wait for its release before another loop?
81
96
int lastKey = btnNONE; // The key state when we last came through the loop
82
97
83
- float totalDECMove = 0 ; // The number of DEC steps we asked for
84
- float totalRAMove = 0 ;
98
+ // Global variables
85
99
bool isUnreachable = false ;
86
100
87
- // String inCmd;
88
- // String inputString = "";
89
- // String commandString = "";
90
- // boolean isConnected = false;
91
-
92
- String logString;
93
- // boolean stringComplete = false;
94
- // unsigned long timeWait;
95
- boolean isPulseGuiding = true ;
96
-
97
101
unsigned long Zeit;
98
- float stepsPerHour;
99
102
103
+ // Stepper motor variables
104
+ float stepsPerHour; // How many steps does the RA stepper need to make to move 15 degrees (1 hour of earths rotation)
105
+ float trackingSpeed; // At what speed does the RA stepper need to run to match earths rotation (steps/sec)
106
+ int tracking = 1 ; // Are we tracking earths rotation?
107
+
108
+ // PC Control variables.
100
109
boolean pcControl = false ;
101
- int currentSecs;
102
- int currentMins;
103
- float inputcal;
104
- float speedcalibration;
110
+
105
111
int direction_old = 1 ;
106
112
int direction_new;
107
113
108
- int hPolarisPosition;
109
- int mPolarisPosition ;
110
-
111
- int tracking = 1 ;
112
- float trackingspeed;
113
114
114
- // RA stuff
115
+ // RA variables
115
116
float moveRA;
116
117
int RAselect;
117
118
118
- // DEC stuff
119
+ // DEC variables
119
120
int degreeDEC;
120
121
int minDEC;
121
122
int secDEC;
122
123
float moveDEC;
123
124
int DECselect;
124
125
int printdegDEC;
125
126
126
- // Hour stuff
127
+ // HA variables
127
128
int HAselect;
129
+ unsigned long lastHAset = 0 ;
128
130
129
- // HEAT menu settings
131
+ // HEAT menu variables
130
132
int heatselect; // Which stepper are we changing?
131
133
int RAheat = 0 ; // Are we heating the RA stepper?
132
134
int DECheat = 0 ; // Are we heating the DEC stepper?
133
135
134
- // Stellarium
136
+ // Stellarium variables
135
137
char current_RA[10 ];
136
138
char current_DEC[12 ];
137
139
int HAh_save;
138
140
int HAm_save;
139
141
float slew_RA;
140
142
float slew_DEC;
141
143
142
- // LCD special chars
143
- int leftArrow = 3 ;
144
- int rightArrow = 4 ;
145
144
145
+ // LCD Character bitmaps
146
146
byte DegreesBitmap[8 ] = {
147
147
B01100,
148
148
B10010,
0 commit comments