1
1
// If you really want to look through this code, i apologise for my terrible coding
2
2
// #include <SoftwareSerial.h>
3
- #include < stdarg.h>
4
3
#include < EEPROM.h>
5
4
#include < AccelStepper.h>
6
5
#include < LiquidCrystal.h>
7
- #include < SoftwareSerial.h>
6
+ // #include <SoftwareSerial.h>
8
7
9
8
#define HALFSTEP 8
10
9
#define FULLSTEP 4
42
41
#define POI_Menu 8
43
42
#define Status_Menu 9
44
43
44
+ // How many menu items at most?
45
+ #define MAXMENUITEMS 10
46
+
47
+ #define LESS_THAN 0x3C
48
+ #define GREATER_THAN 0x3E
49
+
45
50
// Stepper control for RA and DEV.
46
51
// TRK is used for live tracking and runs in parallel with RA.
47
52
// GUIDE is used for Stellarium control
@@ -66,27 +71,25 @@ String logString;
66
71
boolean isPulseGuiding = true ;
67
72
68
73
// Display related variables
69
- int displayLoopsToSkip = 400 ; // Update the LCD every 400 iterations (perf issue )
70
- int displaySkipsLeft = 0 ; // How many loop cycles left before updating the display
74
+ # define DISPLAY_UPDATE_TIME 150 // Every how many milliseconds to update the RA and DEC coordinates while (slewing )
75
+ long lastDisplayUpdate = 0 ; // The time when we last updated RA and DEC coordinates (while slewing)
71
76
float totalDECMove = 0 ; // The number of DEC steps we asked for
72
77
float totalRAMove = 0 ;
73
- int leftArrow = 3 ; // LCD special chars
74
- int rightArrow = 4 ; // LCD special chars
75
78
76
79
// Calibration variables
77
80
float inputcal; // calibration variable set form as integer. Added to speed after dividing by 10000
78
81
float speedCalibration; // speed calibration factor
79
82
int calDelay = 150 ; // The current delay in ms when changing calibration value. The longer a button is depressed, the smaller this gets.
80
83
81
84
// Variables for use in the CONTROL menu
82
- bool inControlMode = false ; // Is manual control enabled
83
- int StateMaskDEC = 0x0011 ; // Is the DEC stepper running?
84
- int StateMaskUp = 0x0001 ; // Is the DEC stepper moving upwards?
85
- int StateMaskDown = 0x0010 ; // Is the DEC stepper moving downwards?
86
- int StateMaskRA = 0x1100 ; // Is the RA stepper running?
87
- int StateMaskLeft = 0x0100 ; // Is the RA stepper moving left (CW)?
88
- int StateMaskRight = 0x1000 ; // Is the RA stepper moving right (CCW)?
89
- int controlState = 0x0000 ; // The current state of the steppers (combination of above values)
85
+ bool inControlMode = false ; // Is manual control enabled
86
+ byte StateMaskDEC = B0011 ; // Is the DEC stepper running?
87
+ byte StateMaskUp = B0001 ; // Is the DEC stepper moving upwards?
88
+ byte StateMaskDown = B0010 ; // Is the DEC stepper moving downwards?
89
+ byte StateMaskRA = B1100 ; // Is the RA stepper running?
90
+ byte StateMaskLeft = B0100 ; // Is the RA stepper moving left (CW)?
91
+ byte StateMaskRight = B1000 ; // Is the RA stepper moving right (CCW)?
92
+ byte controlState = B0000 ; // The current state of the steppers (combination of above values)
90
93
91
94
// Main loop variables
92
95
int lcd_key = 0 ; // The current key state
@@ -96,6 +99,7 @@ int lastKey = btnNONE; // The key state when we last came through the loop
96
99
97
100
// Global variables
98
101
bool isUnreachable = false ;
102
+ char scratchBuffer[32 ];
99
103
100
104
unsigned long Zeit;
101
105
@@ -133,8 +137,6 @@ int RAheat = 0; // Are we heating the RA stepper?
133
137
int DECheat = 0 ; // Are we heating the DEC stepper?
134
138
135
139
// Stellarium variables
136
- char current_RA[16 ];
137
- char current_DEC[16 ];
138
140
int HAh_save;
139
141
int HAm_save;
140
142
float slew_RA;
0 commit comments