Skip to content

Commit 99cf850

Browse files
Merge pull request #113 from OpenAstroTech/roll-in-startup
V1.8.47 - Updates
2 parents 90a7fde + 83a4fbe commit 99cf850

File tree

4 files changed

+67
-15
lines changed

4 files changed

+67
-15
lines changed

Software/Arduino code/OpenAstroTracker/Configuration_pins.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
#error GPS module not currently configured/supported in ESP32
110110
#endif
111111

112-
#if USE_GYRO == 1
112+
#if USE_GYRO_LEVEL == 1
113113
#error Digital Level not currently configured/supported in ESP32
114114
#endif
115115
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define VERSION "V1.8.46"
1+
#define VERSION "V1.8.47"

Software/Arduino code/OpenAstroTracker/src/c65_startup.hpp

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#if USE_GPS == 1
55
#include "Sidereal.hpp"
66
#endif
7+
#if USE_GYRO_LEVEL == 1
8+
#include "Gyro.hpp"
9+
#endif
710

811
#if DISPLAY_TYPE > 0
912
#if SUPPORT_GUIDED_STARTUP == 1
@@ -14,12 +17,15 @@
1417
void setControlMode(bool); // In CTRL menu
1518

1619
#define StartupIsInHomePosition 1
17-
#define StartupSetHATime 4
18-
#define StartupWaitForHACompletion 6
19-
#define StartupHAConfirmed 7
20-
#define StartupWaitForPoleCompletion 9
21-
#define StartupPoleConfirmed 10
22-
#define StartupCompleted 20
20+
#define StartupSetRoll 2
21+
#define StartupWaitForRollCompletion 3
22+
#define StartupRollConfirmed 4
23+
#define StartupSetHATime 10
24+
#define StartupWaitForHACompletion 15
25+
#define StartupHAConfirmed 20
26+
#define StartupWaitForPoleCompletion 25
27+
#define StartupPoleConfirmed 30
28+
#define StartupCompleted 35
2329

2430
#define YES 1
2531
#define NO 2
@@ -54,7 +60,12 @@ bool processStartupKeys() {
5460
}
5561
else if (key == btnSELECT) {
5662
if (isInHomePosition == YES) {
57-
startupState = StartupSetHATime;
63+
#if USE_GYRO_LEVEL == 1
64+
startupState = StartupSetRoll;
65+
LOGV1(DEBUG_INFO, F("STARTUP: State is set roll!"));
66+
#else
67+
startupState = StartupSetHATime;
68+
#endif
5869
}
5970
else if (isInHomePosition == NO) {
6071
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART && USE_AUTOHOME == 1
@@ -92,6 +103,26 @@ bool processStartupKeys() {
92103
}
93104
break;
94105

106+
#if USE_GYRO_LEVEL == 1
107+
case StartupSetRoll : {
108+
inStartup = false;
109+
LOGV1(DEBUG_INFO, F("STARTUP: Switching to CAL menu!"));
110+
111+
lcdMenu.setCursor(0, 0);
112+
lcdMenu.printMenu("Level front");
113+
lcdMenu.setActive(Calibration_Menu);
114+
115+
startupState = StartupWaitForRollCompletion;
116+
}
117+
break;
118+
119+
case StartupRollConfirmed : {
120+
LOGV1(DEBUG_INFO, F("STARTUP: Roll confirmed!"));
121+
startupState = StartupSetHATime;
122+
}
123+
break;
124+
#endif
125+
95126
case StartupSetHATime: {
96127
inStartup = false;
97128
LOGV1(DEBUG_INFO, F("STARTUP: Switching to HA menu!"));

Software/Arduino code/OpenAstroTracker/src/c76_menuCAL.hpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,15 @@ bool processCalibrationKeys()
204204
#if USE_GYRO_LEVEL == 1
205205
if (!gyroStarted)
206206
{
207+
LOGV1(DEBUG_INFO, F("CAL: Starting Gyro!"));
207208
Gyro::startup();
208209
gyroStarted = true;
209210
}
211+
212+
if ((startupState == StartupWaitForRollCompletion) && (calState != ROLL_OFFSET_CALIBRATION)) {
213+
LOGV1(DEBUG_INFO, F("CAL: In Startup, so going to Roll confirm!"));
214+
calState = ROLL_OFFSET_CALIBRATION;
215+
}
210216
#endif
211217

212218
byte currentButtonState = lcdButtons.currentState();
@@ -484,18 +490,33 @@ bool processCalibrationKeys()
484490
{
485491
if (key == btnSELECT)
486492
{
487-
calState = ROLL_OFFSET_CONFIRM;
488-
lcdMenu.setCursor(0, 0);
489-
lcdMenu.printMenu(F("Set as level?"));
493+
if (startupState == StartupWaitForRollCompletion)
494+
{
495+
LOGV1(DEBUG_INFO, F("CAL: Confirmed roll. Going back to Startup, Roll confirmed!"));
496+
gotoNextMenu(); // Turns of Gyro
497+
inStartup = true;
498+
startupState = StartupRollConfirmed;
499+
calState = HIGHLIGHT_FIRST;
500+
}
501+
else
502+
{
503+
calState = ROLL_OFFSET_CONFIRM;
504+
lcdMenu.setCursor(0, 0);
505+
lcdMenu.printMenu(F("Set as level?"));
506+
}
490507
}
491508
else if (key == btnLEFT)
492509
{
493-
calState = HIGHLIGHT_ROLL_LEVEL;
510+
if (startupState != StartupWaitForRollCompletion) {
511+
calState = HIGHLIGHT_ROLL_LEVEL;
512+
}
494513
}
495514
else if (key == btnRIGHT)
496515
{
497-
gotoNextMenu();
498-
calState = HIGHLIGHT_ROLL_LEVEL;
516+
if (startupState != StartupWaitForRollCompletion) {
517+
gotoNextMenu();
518+
calState = HIGHLIGHT_ROLL_LEVEL;
519+
}
499520
}
500521
}
501522
break;

0 commit comments

Comments
 (0)