Skip to content

Commit 16f7cec

Browse files
authored
Merge pull request #2 from ClutchplateDude/master
Merge ClutchPlate serial changes to ASCOM Branch
2 parents 0a2f4c8 + 5179fbf commit 16f7cec

File tree

9 files changed

+1086
-754
lines changed

9 files changed

+1086
-754
lines changed

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/*
22
=======================================================================================================================================
33
4-
Version 1.4.4
4+
Version 1.5.10
55
66
1. Connect your Arduino, under tools choose "Arduino Uno", set the right Port and set "Arduino ISP" as the Programmer.
77
2. Hit upload (Ctrl-U)
88
99
You might need to download the "AccelStepper" library by Mike McCauley
1010
11-
Authors: /u/intercipere
11+
Authors: /u/intercipere
1212
/u/clutchplate
1313
/u/EorEquis
14-
14+
1515
=======================================================================================================================================
1616
*/
17-
String version = "V1.4.5";
17+
String version = "V1.5.10";
1818

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

@@ -32,14 +32,14 @@ int RAacceleration = 600; // these cheap steppers unprecice
3232
int DECspeed = 800;
3333
int DECacceleration = 400;
3434

35-
// Define some stepper limits to prevent physical damage to the tracker. This assumes that the home
35+
// Define some stepper limits to prevent physical damage to the tracker. This assumes that the home
3636
// point (zero point) has been correctly set to be pointing at the celestial pole.
3737
float RAStepperLimit = 15500; // Going much more than this each direction will make the ring fall off the bearings.
3838

39-
// These are for 47N, so they will need adjustment if you're a lot away from that.
40-
// You can use the CTRL menu to find the limits and place them here. I moved it
41-
// down until my lens was horizontal. Note the DEC number. Then move it up until
42-
// the lens is horizontal and note that number. Put those here. Always watch your
39+
// These are for 47N, so they will need adjustment if you're a lot away from that.
40+
// You can use the CTRL menu to find the limits and place them here. I moved it
41+
// down until my lens was horizontal. Note the DEC number. Then move it up until
42+
// the lens is horizontal and note that number. Put those here. Always watch your
4343
// tracker and hit RESET if it approaches a dangerous area.
4444
float DECStepperDownLimit = 10000; // Going much more than this will make the lens collide with the ring
4545
float DECStepperUpLimit = -22000; // Going much more than this is going below the horizon.

Software/Arduino code/OpenAstroTracker/a_inits.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,25 @@ LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
4343
#define Home_Menu 7
4444
#define POI_Menu 8
4545

46-
// Stepper control for RA and DEV.
46+
// Stepper control for RA and DEV.
4747
// TRK is used for live tracking and runs in parallel with RA.
4848
// GUIDE is used for Stellarium control
4949
AccelStepper stepperRA(FULLSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
5050
AccelStepper stepperDEC(HALFSTEP, motorPin11, motorPin13, motorPin12, motorPin14);
5151
AccelStepper stepperTRK(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4); //yes, this is the same motor as stepperRA, dont ask why
5252
AccelStepper stepperGUIDE(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
5353

54-
int lcd_key = 0; // The current key state
54+
int lcd_key = 0; // The current key state
5555
int adc_key_in = 0; // The analog value of the keys
5656

5757
String inString = "";
5858

5959
bool inStartup = true; // Start with a guided startup
6060

61+
bool inSerialControl = false; // When the serial port is in control
62+
bool serialIsSlewing = false; // When the serial port is slewing the tracker
63+
64+
6165
int calDelay = 150; // The current delay when changing calibration value. The longer a button is depressed, the samller this gets.
6266

6367
bool waitForButtonRelease = false; // When a button is pressed should we wait for its release before another loop?
@@ -128,8 +132,8 @@ int RAheat = 0; // Are we heating the RA stepper?
128132
int DECheat = 0; // Are we heating the DEC stepper?
129133

130134
//Stellarium
131-
char current_RA[9];
132-
char current_DEC[10];
135+
char current_RA[10];
136+
char current_DEC[12];
133137
int HAh_save;
134138
int HAm_save;
135139
float slew_RA;

Software/Arduino code/OpenAstroTracker/b0_functions.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ int read_LCD_buttons() {
33
adc_key_in = analogRead(0);
44
if (adc_key_in > 1000) return btnNONE;
55
if (adc_key_in < 50) return btnRIGHT;
6-
if (adc_key_in < 250) return btnUP;
7-
if (adc_key_in < 450) return btnDOWN;
6+
if (adc_key_in < 240) return btnUP;
7+
if (adc_key_in < 400) return btnDOWN;
88
if (adc_key_in < 600) return btnLEFT;
99
if (adc_key_in < 920) return btnSELECT;
1010
}

Software/Arduino code/OpenAstroTracker/b1_menu.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,16 @@ class LcdMenu {
9494
_activeId = id;
9595
}
9696

97-
// Pass throu utility function
97+
// Pass thru utility function
9898
void setCursor(int col, int row) {
9999
_lcd->setCursor(col, row);
100100
}
101101

102+
// Pass thru utility function
103+
void clear() {
104+
_lcd->clear();
105+
}
106+
102107
// Go to the next menu item from currently active one
103108
void setNextActive() {
104109
// If the last item is active, go to the first.

Software/Arduino code/OpenAstroTracker/c6_moveTo.ino

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ void moveSteppersToTarget() {
7979
}
8080
display--;
8181
}
82+
83+
// Update resting position
84+
String disp = "D:" + String(stepperDEC.currentPosition()) + " R:" + String( stepperRA.currentPosition());
85+
lcdMenu.printMenu(disp);
8286
}
8387

8488
void startMoveSteppersToTargetAsync() {
@@ -118,6 +122,12 @@ void moveSteppersToTargetAsync() {
118122
}
119123
controlDisplay --;
120124
}
125+
else if (controlDisplay != 499) {
126+
// Make sure we do one last update when the steppers have stopped.
127+
String disp = "D:" + String(stepperDEC.currentPosition()) + " R:" + String( stepperRA.currentPosition());
128+
lcdMenu.printMenu(disp);
129+
controlDisplay = 499;
130+
}
121131
}
122132

123133
void ShowStatusMessage(String message) {
Lines changed: 78 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
void BTin();
2+
13
void loop() {
24
#ifdef LCD_BUTTON_TEST
35

@@ -18,99 +20,104 @@ void loop() {
1820
case btnUP: state += "Up"; break;
1921
case btnDOWN: state += "Down"; break;
2022
}
23+
2124
lcdMenu.printMenu(state);
2225

2326
return;
24-
25-
#endif
2627

28+
#endif
2729

30+
lcdMenu.setCursor(0, 1);
2831

2932
lcd_key = read_LCD_buttons();
3033

3134
trackingspeed = ((((335.1417 / 288.0) * RevSteps) / 3590)) - 1 + float(speedcalibration);
3235
stepperTRK.setSpeed(trackingspeed);
3336

34-
waitForButtonRelease = true;
35-
lcd.setCursor(0, 1);
36-
37-
// Handle the keys
38-
if (inStartup) {
39-
processStartupKeys(lcd_key);
37+
if (inSerialControl ) {
38+
serialLoop();
4039
}
4140
else {
42-
switch (lcdMenu.getActive()) {
43-
case RA_Menu:
44-
handleDECandRACalculations();
45-
processRAKeys(lcd_key);
46-
break;
47-
case DEC_Menu:
48-
handleDECandRACalculations();
49-
processDECKeys(lcd_key);
50-
break;
51-
case POI_Menu:
52-
processPOIKeys(lcd_key);
53-
break;
54-
case Home_Menu:
55-
processHomeKeys(lcd_key);
56-
break;
57-
case HA_Menu:
58-
processHAKeys(lcd_key);
59-
break;
60-
case Polaris_Menu:
61-
processPolarisKeys(lcd_key);
62-
break;
63-
case Heat_Menu:
64-
processHeatKeys(lcd_key);
65-
break;
66-
case Control_Menu:
67-
processControlKeys(lcd_key);
68-
break;
69-
case Calibration_Menu:
70-
processCalibrationKeys(lcd_key);
71-
break;
41+
waitForButtonRelease = true;
42+
43+
// Handle the keys
44+
if (inStartup) {
45+
processStartupKeys(lcd_key);
46+
}
47+
else {
48+
switch (lcdMenu.getActive()) {
49+
case RA_Menu:
50+
handleDECandRACalculations();
51+
processRAKeys(lcd_key);
52+
break;
53+
case DEC_Menu:
54+
handleDECandRACalculations();
55+
processDECKeys(lcd_key);
56+
break;
57+
case POI_Menu:
58+
processPOIKeys(lcd_key);
59+
break;
60+
case Home_Menu:
61+
processHomeKeys(lcd_key);
62+
break;
63+
case HA_Menu:
64+
processHAKeys(lcd_key);
65+
break;
66+
case Polaris_Menu:
67+
processPolarisKeys(lcd_key);
68+
break;
69+
case Heat_Menu:
70+
processHeatKeys(lcd_key);
71+
break;
72+
case Control_Menu:
73+
processControlKeys(lcd_key);
74+
break;
75+
case Calibration_Menu:
76+
processCalibrationKeys(lcd_key);
77+
break;
78+
}
7279
}
73-
}
7480

75-
if (waitForButtonRelease && (lcd_key != btnNONE)) {
76-
while (read_LCD_buttons() != btnNONE) {
77-
// Make sure tracker can still run while fiddling with menus....
78-
runTracker();
81+
if (waitForButtonRelease && (lcd_key != btnNONE)) {
82+
while (read_LCD_buttons() != btnNONE) {
83+
// Make sure tracker can still run while fiddling with menus....
84+
runTracker();
85+
}
7986
}
80-
}
8187

82-
runTracker();
83-
doCalculations();
88+
runTracker();
89+
doCalculations();
8490

85-
if (!pcControl) {
91+
if (!pcControl) {
8692

87-
lcd.setCursor(0, 0);
93+
lcd.setCursor(0, 1);
8894

89-
if (inStartup) {
90-
prinStartupMenu();
91-
}
92-
else {
93-
switch (lcdMenu.getActive()) {
94-
case RA_Menu: printRASubmenu(); break;
95-
case DEC_Menu: printDECSubmenu(); break;
96-
case POI_Menu: printPOISubmenu(); break;
97-
case HA_Menu: printHASubmenu(); break;
98-
case Home_Menu: printHomeSubmenu(); break;
99-
case Polaris_Menu: printPolarisSubmenu(); break;
100-
case Heat_Menu: printHeatSubmenu(); break;
101-
case Control_Menu: printControlSubmenu(); break;
102-
case Calibration_Menu: printCalibrationSubmenu(); break;
95+
if (inStartup) {
96+
prinStartupMenu();
97+
}
98+
else {
99+
switch (lcdMenu.getActive()) {
100+
case RA_Menu: printRASubmenu(); break;
101+
case DEC_Menu: printDECSubmenu(); break;
102+
case POI_Menu: printPOISubmenu(); break;
103+
case HA_Menu: printHASubmenu(); break;
104+
case Home_Menu: printHomeSubmenu(); break;
105+
case Polaris_Menu: printPolarisSubmenu(); break;
106+
case Heat_Menu: printHeatSubmenu(); break;
107+
case Control_Menu: printControlSubmenu(); break;
108+
case Calibration_Menu: printCalibrationSubmenu(); break;
109+
}
103110
}
111+
112+
//tracking menu ----------------------
113+
/*if (lcdMenu.getActive() == TRK_Menu) {
114+
lcd.print("Tracking ON OFF");
115+
lcd.print(" ");
116+
}*/
117+
} else {
118+
moveSteppersToTargetAsync();
104119
}
105120

106-
//tracking menu ----------------------
107-
/*if (lcdMenu.getActive() == TRK_Menu) {
108-
lcd.print("Tracking ON OFF");
109-
lcd.print(" ");
110-
}*/
111-
} else {
112-
moveSteppersToTargetAsync();
121+
BTin();
113122
}
114-
115-
BTin();
116123
}

0 commit comments

Comments
 (0)