Skip to content

Commit 33f2743

Browse files
V1.8.16 - Updates
- Throttled the INFO display update frequency (it was updating every cycle before). - Added temperature display when using the Digital Level module - Made the axis swap for the DIgital Level on by default since most people will use the STL in the repo for the holder.
1 parent 3d6b456 commit 33f2743

File tree

5 files changed

+102
-67
lines changed

5 files changed

+102
-67
lines changed

Software/Arduino code/OpenAstroTracker/Configuration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
=======================================================================================================================================
1919
*/
2020

21-
String version = "V1.8.15";
21+
String version = "V1.8.16";
2222

2323
///////////////////////////////////////////////////////////////////////////
2424
// Also use Configuration_adv for further adjustments!

Software/Arduino code/OpenAstroTracker/Configuration_adv.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@
6565
//
6666
// GUIDE SETTINGS
6767
// This is the multiplier of the normal trackingspeed that a pulse will have
68-
// NEMA steppers only! Doesnt affect 28BY
69-
// standard value: RA 2.0; DEC 1.0
68+
// NEMA steppers only! Doesnt affect 28BY (which is hardcoded to 2x and 0)
69+
// Note that the East trackingspeed is calculated as the multiplier-1.0
70+
// Standard value: RA 2.0; DEC 1.0
7071
#define RA_PULSE_MULTIPLIER 1.5
7172
#define DEC_PULSE_MULTIPLIER 1.0
7273
//
@@ -149,7 +150,7 @@
149150
#define GYRO_LEVEL 0
150151

151152
// Set this to 1 if your gyro is mounted such that roll and pitch are in the wrong direction
152-
#define GYRO_AXIS_SWAP 0
153+
#define GYRO_AXIS_SWAP 1
153154

154155

155156

Software/Arduino code/OpenAstroTracker/Gyro.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,18 @@ static angle_t Gyro::getCurrentAngles()
7474
return result;
7575
}
7676

77+
static float Gyro::getCurrentTemperature()
78+
{
79+
// Read the temperature data
80+
float result = 0.0;
81+
int16_t tempValue;
82+
Wire.beginTransmission(MPU);
83+
Wire.write(0x41); // Start with register 0x41 (TEMP_OUT_H)
84+
Wire.endTransmission(false);
85+
Wire.requestFrom(MPU, 2, true); // Read 2 registers total, the temperature value is stored in 2 registers
86+
tempValue = Wire.read() << 8 | Wire.read(); // Raw Temperature value
87+
// Calculating the actual temperature value
88+
result = float(tempValue) / 340 + 36.53;
89+
return result;
90+
}
7791
#endif

Software/Arduino code/OpenAstroTracker/Gyro.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class Gyro
1111
static void startup();
1212
static void shutdown();
1313
static angle_t getCurrentAngles();
14-
14+
static float getCurrentTemperature();
15+
1516
private:
1617
static int16_t AcX, AcY, AcZ;
1718
static int16_t AcXOffset, AcYOffset, AcZOffset;

Software/Arduino code/OpenAstroTracker/c78_menuINFO.hpp

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44

55
#if SUPPORT_INFO_DISPLAY == 1
66
byte infoIndex = 0;
7-
byte maxInfoIndex = 6;
7+
byte maxInfoIndex = 7;
88
byte subIndex = 0;
9+
unsigned long lastInfoUpdate = 0;
910

1011
bool processStatusKeys() {
1112
byte key;
1213
bool waitForRelease = false;
1314
if (lcdButtons.keyChanged(&key)) {
1415
waitForRelease = true;
16+
lastInfoUpdate = 0; // Force immediate display
1517
switch (key) {
1618
case btnDOWN: {
1719
infoIndex = adjustWrap(infoIndex, 1, 0, maxInfoIndex);
@@ -40,77 +42,94 @@ bool processStatusKeys() {
4042
}
4143

4244
void printStatusSubmenu() {
43-
char scratchBuffer[20];
44-
switch (infoIndex) {
45-
case 0: {
46-
if (subIndex == 0) {
47-
lcdMenu.printMenu("RA Stpr: " + String(mount.getCurrentStepperPosition(WEST)));
45+
if (millis() - lastInfoUpdate > DISPLAY_UPDATE_TIME)
46+
{
47+
char scratchBuffer[20];
48+
switch (infoIndex) {
49+
case 0: {
50+
if (subIndex == 0) {
51+
lcdMenu.printMenu("RA Stpr: " + String(mount.getCurrentStepperPosition(WEST)));
52+
}
53+
else if (subIndex == 1) {
54+
lcdMenu.printMenu("RTrg: " + mount.RAString(LCD_STRING | TARGET_STRING));
55+
}
56+
else {
57+
lcdMenu.printMenu("RCur: " + mount.RAString(LCD_STRING | CURRENT_STRING));
58+
}
4859
}
49-
else if (subIndex == 1) {
50-
lcdMenu.printMenu("RTrg: " + mount.RAString(LCD_STRING | TARGET_STRING));
51-
}
52-
else {
53-
lcdMenu.printMenu("RCur: " + mount.RAString(LCD_STRING | CURRENT_STRING));
54-
}
55-
}
56-
break;
57-
58-
case 1: {
59-
if (subIndex == 0) {
60-
lcdMenu.printMenu("DEC Stpr:" + String(mount.getCurrentStepperPosition(NORTH)));
60+
break;
61+
62+
case 1: {
63+
if (subIndex == 0) {
64+
lcdMenu.printMenu("DEC Stpr:" + String(mount.getCurrentStepperPosition(NORTH)));
65+
}
66+
else if (subIndex == 1) {
67+
lcdMenu.printMenu("DTrg: " + mount.DECString(LCD_STRING | TARGET_STRING));
68+
}
69+
else {
70+
lcdMenu.printMenu("DCur: " + mount.DECString(LCD_STRING | CURRENT_STRING));
71+
}
6172
}
62-
else if (subIndex == 1) {
63-
lcdMenu.printMenu("DTrg: " + mount.DECString(LCD_STRING | TARGET_STRING));
73+
break;
74+
75+
case 2: {
76+
if (subIndex == 0) {
77+
lcdMenu.printMenu("TRK Stepr:" + String(mount.getCurrentStepperPosition(TRACKING)));
78+
}
79+
else {
80+
sprintf(scratchBuffer, "TRK Spd:");
81+
dtostrf(mount.getSpeed(TRACKING), 8, 6, &scratchBuffer[8]);
82+
lcdMenu.printMenu(scratchBuffer);
83+
}
6484
}
65-
else {
66-
lcdMenu.printMenu("DCur: " + mount.DECString(LCD_STRING | CURRENT_STRING));
85+
break;
86+
87+
case 3: {
88+
float lat = fabs(mount.latitude());
89+
float lng = fabs(mount.longitude());
90+
const char dirLat = (mount.latitude() < 0) ? 'S' : 'N';
91+
const char dirLong = (mount.longitude() < 0) ? 'W' :'E';
92+
sprintf(scratchBuffer, "Loc %s%c %s%c", String(lat,1).c_str(), dirLat, String(lng,1).c_str(), dirLong);
93+
lcdMenu.printMenu(scratchBuffer);
6794
}
68-
}
69-
break;
70-
71-
case 2: {
72-
if (subIndex == 0) {
73-
lcdMenu.printMenu("TRK Stepr:" + String(mount.getCurrentStepperPosition(TRACKING)));
95+
break;
96+
97+
case 4: {
98+
#if GYRO_LEVEL == 1
99+
int celsius = (int)round(Gyro::getCurrentTemperature());
100+
int fahrenheit = (int)round(32.0 + 9.0 * Gyro::getCurrentTemperature() / 5.0);
101+
102+
sprintf(scratchBuffer, "Temp: %d@C %d@F", celsius, fahrenheit);
103+
lcdMenu.printMenu(scratchBuffer);
104+
#else
105+
infoIndex++;
106+
#endif
74107
}
75-
else {
76-
sprintf(scratchBuffer, "TRK Spd:");
77-
dtostrf(mount.getSpeed(TRACKING), 8, 6, &scratchBuffer[8]);
108+
break;
109+
110+
case 5: {
111+
sprintf(scratchBuffer, "MemAvail: %d", freeMemory());
78112
lcdMenu.printMenu(scratchBuffer);
79113
}
80-
}
81-
break;
82-
83-
case 3: {
84-
float lat = fabs(mount.latitude());
85-
float lng = fabs(mount.longitude());
86-
const char dirLat = (mount.latitude() < 0) ? 'S' : 'N';
87-
const char dirLong = (mount.longitude() < 0) ? 'W' :'E';
88-
sprintf(scratchBuffer, "Loc %s%c %s%c", String(lat,1).c_str(), dirLat, String(lng,1).c_str(), dirLong);
89-
lcdMenu.printMenu(scratchBuffer);
90-
}
91-
break;
114+
break;
92115

93-
case 4: {
94-
sprintf(scratchBuffer, "MemAvail: %d", freeMemory());
95-
lcdMenu.printMenu(scratchBuffer);
96-
}
97-
break;
98-
99-
case 5: {
100-
long now = millis();
101-
long msPerDay = 60L * 60 * 24 * 1000;
102-
int days = (int)(now / msPerDay);
103-
now -= days * msPerDay;
104-
DayTime elapsed(now);
105-
sprintf(scratchBuffer, "Up: %dd %02d:%02d:%02d", days, elapsed.getHours(), elapsed.getMinutes(), elapsed.getSeconds());
106-
lcdMenu.printMenu(scratchBuffer);
107-
}
108-
break;
116+
case 6: {
117+
long now = millis();
118+
long msPerDay = 60L * 60 * 24 * 1000;
119+
int days = (int)(now / msPerDay);
120+
now -= days * msPerDay;
121+
DayTime elapsed(now);
122+
sprintf(scratchBuffer, "Up: %dd %02d:%02d:%02d", days, elapsed.getHours(), elapsed.getMinutes(), elapsed.getSeconds());
123+
lcdMenu.printMenu(scratchBuffer);
124+
}
125+
break;
109126

110-
case 6: {
111-
lcdMenu.printMenu("Firmw.: " + version);
127+
case 7: {
128+
lcdMenu.printMenu("Firmw.: " + version);
129+
}
130+
break;
112131
}
113-
break;
132+
lastInfoUpdate = millis();
114133
}
115134
}
116135

0 commit comments

Comments
 (0)