Skip to content

Commit 0d5e309

Browse files
Merge branch 'develop' into oae-fw
# Conflicts: # Changelog.md # ConfigurationValidation.hpp # boards/ESP32_ESP32DEV/pins_OAE_V1.hpp # src/SSD1306_128x64_Display.hpp # src/b_setup.hpp
2 parents 4705edd + 833bd88 commit 0d5e309

10 files changed

Lines changed: 648 additions & 474 deletions

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
**V1.13.17 - Updates**
55
- Store AZ/ALT steps per degree and allow them to be set from Meade
6+
- Added more output to the InfoDisplay during boot and fixed a bug in console mode.
7+
- Fixed a bug that was causing the firmware to hang after a slew, if a :Q# command was issued (thanks to user c3n for tracking it down, pun intended).
68

79
**V1.13.16 - Updates**
810
- Throttled InfoDisplay updates. Turned off on two axis slew, limited to 5Hz on one-axis slew.

ConfigurationValidation.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@
8989
#error AZ driver address for DRIVER_TYPE_TMC2209_UART not specified.
9090
#endif
9191
#endif
92-
#elif defined(BOARD_OAE_V1)
93-
// Valid
94-
92+
#elif defined(OAE)
93+
// Valid OAE configuration
9594
#else
9695
#error Configuration does not support AZ. Use at own risk.
9796
#endif
@@ -112,7 +111,7 @@
112111
#endif
113112
#endif
114113

115-
#elif defined(BOARD_OAE_V1)
114+
#elif defined(OAE)
116115
// Valid
117116

118117
#else

boards/ESP32_ESP32DEV/pins_OAE_V1.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
#pragma once
66

7-
/**
8-
* @brief a pins configuration file for an ESP32-based OAT.
9-
*/
10-
11-
#pragma once
12-
137
// DRIVER_TYPE_TMC2209_UART requires 4 digital pins in Arduino pin numbering
148
#ifndef RA_STEP_PIN
159
#define RA_STEP_PIN 14 // STEP
@@ -131,4 +125,5 @@
131125
#endif
132126
#ifndef DEC_PULLEY_TEETH
133127
#define DEC_PULLEY_TEETH 1
134-
#endif
128+
#endif
129+
#endif

platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ src_build_flags =
5252
-Wno-unused-parameter
5353
; -Wold-style-cast
5454
-Wlogical-op
55-
-Wuseless-cast
5655
; Wdouble-promotion can't be enabled until GCC bug 55578 is fixed, since floats are
5756
; implicitly converted to doubles when passed to a variadic function (i.e. a printf-like).
5857
; Else we could disable Wdouble-promotion only for our logv function inside of the LOG macro
@@ -83,6 +82,9 @@ upload_protocol = wiring
8382
build_flags =
8483
${env.build_flags}
8584
-D BOARD=BOARD_AVR_RAMPS
85+
src_build_flags =
86+
${env.src_build_flags}
87+
-Wuseless-cast
8688
debug_tool = avr-stub
8789
debug_build_flags =
8890
${env.debug_build_flags}

src/InfoDisplayRender.hpp

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,115 @@
11
#pragma once
22
#include <Arduino.h>
3-
4-
class Mount;
3+
#include "OLEDDisplay.h"
4+
#include "fonts128x64.h"
5+
#include "../Configuration.hpp"
56

67
// Base class to implement a
78
class InfoDisplayRender
89
{
10+
const static int MAX_CONSOLE_LINES = 16; // Maximum number of lines of text to buffer in console mode
11+
const static int DISPLAY_CONSOLE_LINES = 6; // Number of lines to display in console mode
12+
13+
protected:
14+
OLEDDisplay *_display;
15+
long _lastNumCmds;
16+
bool _consoleMode;
17+
String _textList[MAX_CONSOLE_LINES];
18+
int _curLine;
19+
920
public:
10-
InfoDisplayRender() {};
21+
InfoDisplayRender()
22+
{
23+
_consoleMode = true;
24+
_curLine = 0;
25+
for (int i = 0; i < MAX_CONSOLE_LINES; i++)
26+
{
27+
_textList[i] = "";
28+
}
29+
};
30+
31+
virtual void init()
32+
{
33+
_display->init();
34+
_display->clear();
35+
_display->displayOn();
36+
};
37+
38+
OLEDDisplay *getDisplayDevice()
39+
{
40+
return _display;
41+
};
42+
43+
virtual void renderScreen(void *context) = 0;
44+
45+
// Build the display from the mount
46+
virtual void render(void (*drawContentFunction)(void *))
47+
{
48+
_display->clear();
49+
if (drawContentFunction)
50+
{
51+
drawContentFunction(this);
52+
}
53+
54+
if (_consoleMode)
55+
{
56+
// Console lines
57+
int y = 21;
58+
_display->setFont(Bitmap3x5);
59+
// Start 6 lines back from current line and display next 6 lines
60+
int indexStart = max(0, _curLine - DISPLAY_CONSOLE_LINES);
61+
int indexEnd = min(indexStart + DISPLAY_CONSOLE_LINES, MAX_CONSOLE_LINES);
62+
for (int i = indexStart; i < indexEnd; i++)
63+
{
64+
if (_textList[i].length() != 0)
65+
{
66+
String text = _textList[i];
67+
text.toUpperCase();
68+
_display->drawString(0, y, text);
69+
}
70+
y += 7;
71+
}
72+
}
73+
else
74+
{
75+
}
76+
77+
_display->display();
78+
};
79+
80+
virtual void setConsoleMode(bool active)
81+
{
82+
_consoleMode = active;
83+
};
84+
85+
virtual int addConsoleText(const String &text, bool tinyFont = true)
86+
{
87+
int returnIndex = 0;
88+
if (_curLine > MAX_CONSOLE_LINES - 1)
89+
{
90+
for (int i = 0; i < MAX_CONSOLE_LINES - 1; i++)
91+
{
92+
_textList[i] = _textList[i + 1];
93+
}
94+
_curLine = MAX_CONSOLE_LINES - 1;
95+
_textList[_curLine] = text;
96+
returnIndex = _curLine;
97+
}
98+
else
99+
{
100+
returnIndex = _curLine;
101+
_textList[_curLine++] = text;
102+
}
103+
render(nullptr);
104+
return returnIndex;
105+
};
11106

12-
virtual void init() {};
13-
virtual void render(Mount *mount) {};
14-
virtual void setConsoleMode(bool active) {};
15-
virtual int addConsoleText(String text, bool tinyFont = true);
16-
virtual void updateConsoleText(int line, String newText);
107+
virtual void updateConsoleText(int line, String text)
108+
{
109+
if (line >= 0 && line < MAX_CONSOLE_LINES)
110+
{
111+
_textList[line] = text;
112+
}
113+
render(nullptr);
114+
};
17115
};

src/Mount.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2971,6 +2971,16 @@ void Mount::interruptLoop()
29712971
_stepperRA->run();
29722972
}
29732973
}
2974+
else if (!(_mountStatus & STATUS_TRACKING) && (_stepperTRK->isRunning()))
2975+
{
2976+
// If we are not tracking, but the tracking stepper is running, we need to let it move.
2977+
// This can happen when we need to compensate for a slew (during which the tracker is
2978+
// stopped). After the slew, the tracker is advanced by the distance it would have
2979+
// travelled during the slew if it had been tracking.
2980+
// That compensation uses goto mode (using runToNewPosition()), so we need to use run(),
2981+
// since runSpeed() only advances the stepper when it is in constant speed mode.
2982+
_stepperTRK->run();
2983+
}
29742984

29752985
if (_mountStatus & STATUS_FINDING_HOME)
29762986
{
@@ -3322,6 +3332,7 @@ void Mount::setupInfoDisplay()
33223332
infoDisplay = new SDD1306OLED128x64(INFO_DISPLAY_I2C_ADDRESS, INFO_DISPLAY_I2C_SDA_PIN, INFO_DISPLAY_I2C_SCL_PIN);
33233333
LOG(DEBUG_ANY, "[SYSTEM]: SSD1306 OLED created... initializing");
33243334
infoDisplay->init();
3335+
infoDisplay->setConsoleMode(true);
33253336
LOG(DEBUG_DISPLAY, "[DISPLAY]: Created and initialized SSD1306 OLED class...");
33263337
#endif
33273338
}
@@ -3348,7 +3359,7 @@ void Mount::updateInfoDisplay()
33483359
if (now - _lastInfoUpdate > (1000 / refreshRateHz))
33493360
{
33503361
LOG(DEBUG_DISPLAY, "[DISPLAY]: Render state to OLED ...");
3351-
infoDisplay->render(this);
3362+
infoDisplay->renderScreen((void *) this);
33523363
LOG(DEBUG_DISPLAY, "[DISPLAY]: Rendered state to OLED ...");
33533364
_lastInfoUpdate = now;
33543365
}

0 commit comments

Comments
 (0)