Skip to content

Commit 8f049b0

Browse files
V1.5.22 - Updates (Code size optimization)
- Made display updates while slewing time-based (instead of cycles). - Changed all ints to bytes that I could to save data storage. - Optimized a lot of string manipulation that was using String class to use sprintf() on a new scratch buffer instead. - Changed the menu system to use an array instead of a linked list to save memory. - Removed all vararg based calls (too much utility code). - Disabled tracking during homing slew. - Changed Meade :Q# command to simply stop motors (not tracking), but not exit Control mode. - Changed Meade :Qq# command to exit Control mode, but not stop motors.
1 parent fea0d2f commit 8f049b0

File tree

13 files changed

+177
-334
lines changed

13 files changed

+177
-334
lines changed

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
=======================================================================================================================================
1616
*/
17-
String version = "V1.5.21";
17+
String version = "V1.5.22";
1818

1919
boolean north = true; // change this to 'false' if youre in the southern hemisphere
2020

Software/Arduino code/OpenAstroTracker/a_inits.ino

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// If you really want to look through this code, i apologise for my terrible coding
22
//#include <SoftwareSerial.h>
3-
#include <stdarg.h>
43
#include <EEPROM.h>
54
#include <AccelStepper.h>
65
#include <LiquidCrystal.h>
7-
#include <SoftwareSerial.h>
6+
//#include <SoftwareSerial.h>
87

98
#define HALFSTEP 8
109
#define FULLSTEP 4
@@ -42,6 +41,12 @@
4241
#define POI_Menu 8
4342
#define Status_Menu 9
4443

44+
// How many menu items at most?
45+
#define MAXMENUITEMS 10
46+
47+
#define LESS_THAN 0x3C
48+
#define GREATER_THAN 0x3E
49+
4550
// Stepper control for RA and DEV.
4651
// TRK is used for live tracking and runs in parallel with RA.
4752
// GUIDE is used for Stellarium control
@@ -66,27 +71,25 @@ String logString;
6671
boolean isPulseGuiding = true;
6772

6873
// 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)
7176
float totalDECMove = 0; // The number of DEC steps we asked for
7277
float totalRAMove = 0;
73-
int leftArrow = 3; // LCD special chars
74-
int rightArrow = 4; // LCD special chars
7578

7679
// Calibration variables
7780
float inputcal; // calibration variable set form as integer. Added to speed after dividing by 10000
7881
float speedCalibration; // speed calibration factor
7982
int calDelay = 150; // The current delay in ms when changing calibration value. The longer a button is depressed, the smaller this gets.
8083

8184
// 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)
9093

9194
// Main loop variables
9295
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
9699

97100
// Global variables
98101
bool isUnreachable = false;
102+
char scratchBuffer[32];
99103

100104
unsigned long Zeit;
101105

@@ -133,8 +137,6 @@ int RAheat = 0; // Are we heating the RA stepper?
133137
int DECheat = 0; // Are we heating the DEC stepper?
134138

135139
// Stellarium variables
136-
char current_RA[16];
137-
char current_DEC[16];
138140
int HAh_save;
139141
int HAm_save;
140142
float slew_RA;

0 commit comments

Comments
 (0)