fix(observer): recover T-Beam Supreme display startup

This commit is contained in:
agessaman
2026-08-10 12:50:11 -07:00
parent b744b42aab
commit 1f79e91c7f
5 changed files with 41 additions and 10 deletions
+7 -3
View File
@@ -6,6 +6,7 @@
#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(board, display);
static bool display_ready = false;
#endif
#ifdef ETHERNET_ENABLED
@@ -52,7 +53,8 @@ void setup() {
#endif
#ifdef DISPLAY_CLASS
if (display.begin()) {
display_ready = display.begin();
if (display_ready) {
display.startFrame();
display.setCursor(0, 0);
display.print("Please wait...");
@@ -112,7 +114,9 @@ void setup() {
the_mesh.begin(fs);
#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
if (display_ready) {
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
}
#endif
#ifdef ETHERNET_ENABLED
@@ -193,7 +197,7 @@ void loop() {
the_mesh.loop();
sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
if (display_ready) ui_task.loop();
#endif
rtc_clock.tick();
+7 -3
View File
@@ -11,6 +11,7 @@
#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
static bool display_ready = false;
#endif
StdRNG fast_rng;
@@ -37,7 +38,8 @@ void setup() {
#endif
#ifdef DISPLAY_CLASS
if (display.begin()) {
display_ready = display.begin();
if (display_ready) {
display.startFrame();
display.setCursor(0, 0);
display.print("Please wait...");
@@ -88,7 +90,9 @@ void setup() {
the_mesh.begin(fs);
#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
if (display_ready) {
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
}
#endif
#ifdef ETHERNET_ENABLED
@@ -151,7 +155,7 @@ void loop() {
the_mesh.loop();
sensors.loop();
#ifdef DISPLAY_CLASS
ui_task.loop();
if (display_ready) ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EXTERNAL_WATCHDOG
+20 -2
View File
@@ -24,18 +24,36 @@ bool SH1106Display::begin()
{
// Wire must already be initialised by board.begin() before this is called.
// Boards with non-standard SH1106 addresses should define DISPLAY_ADDRESS
// in their variant/platformio configuration.
return i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true);
// in their variant/platformio configuration. Some board revisions may have
// different solder-bridge address configurations, so variants can also
// provide DISPLAY_ADDRESS_ALT as a fallback.
_initialized = false;
if (i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true)) {
_initialized = true;
}
#ifdef DISPLAY_ADDRESS_ALT
if (!_initialized && DISPLAY_ADDRESS_ALT != DISPLAY_ADDRESS &&
i2c_probe(Wire, DISPLAY_ADDRESS_ALT) &&
display.begin(DISPLAY_ADDRESS_ALT, true)) {
_initialized = true;
}
#endif
return _initialized;
}
void SH1106Display::turnOn()
{
if (!_initialized) return;
display.oled_command(SH110X_DISPLAYON);
_isOn = true;
}
void SH1106Display::turnOff()
{
if (!_initialized) {
_isOn = false;
return;
}
display.oled_command(SH110X_DISPLAYOFF);
_isOn = false;
}
+6 -2
View File
@@ -17,16 +17,20 @@
class SH1106Display : public DisplayDriver
{
Adafruit_SH1106G display;
bool _initialized;
bool _isOn;
uint8_t _color;
bool i2c_probe(TwoWire &wire, uint8_t addr);
public:
SH1106Display() : DisplayDriver(128, 64), display(128, 64, &Wire, PIN_OLED_RESET) { _isOn = false; }
SH1106Display() : DisplayDriver(128, 64), display(128, 64, &Wire, PIN_OLED_RESET) {
_initialized = false;
_isOn = false;
}
bool begin();
bool isOn() override { return _isOn; }
bool isOn() override { return _initialized && _isOn; }
void turnOn() override;
void turnOff() override;
void clear() override;
@@ -20,6 +20,7 @@ build_flags =
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D DISPLAY_CLASS=SH1106Display
-D DISPLAY_ADDRESS=0x3D
-D DISPLAY_ADDRESS_ALT=0x3C
-D LORA_TX_POWER=22
-D P_LORA_TX_LED=6
-D PIN_BOARD_SDA=17