Update display library to use Adafruit SSD1306 for improved compatibility

This commit is contained in:
Joshua King
2026-02-09 12:50:09 -05:00
parent 558c209b6c
commit 26a839f6e0
3 changed files with 5 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ monitor_speed = 115200
lib_deps = lib_deps =
adafruit/Adafruit GFX Library adafruit/Adafruit GFX Library
adafruit/Adafruit SH110X adafruit/Adafruit SSD1306
bblanchon/ArduinoJson bblanchon/ArduinoJson
build_flags = build_flags =

View File

@@ -2,7 +2,7 @@
void Display::begin() { void Display::begin() {
Wire.begin(PIN_SDA, PIN_SCL); Wire.begin(PIN_SDA, PIN_SCL);
_ok = _oled.begin(OLED_ADDR, true); _ok = _oled.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR, true, false);
if (!_ok) return; if (!_ok) return;
bootAnimation(); bootAnimation();
} }

View File

@@ -2,12 +2,12 @@
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h> #include <Wire.h>
#include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h> #include <Adafruit_SSD1306.h>
class Display { class Display {
public: public:
void begin(); void begin();
Adafruit_SH1106G& oled() { return _oled; } Adafruit_SSD1306& oled() { return _oled; }
void showStatus(const String& line1, const String& line2); void showStatus(const String& line1, const String& line2);
void bootAnimation(); void bootAnimation();
@@ -16,6 +16,6 @@ private:
static constexpr int PIN_SDA = 21; static constexpr int PIN_SDA = 21;
static constexpr int PIN_SCL = 22; static constexpr int PIN_SCL = 22;
static constexpr uint8_t OLED_ADDR = 0x3C; // try 0x3D if blank static constexpr uint8_t OLED_ADDR = 0x3C; // try 0x3D if blank
Adafruit_SH1106G _oled = Adafruit_SH1106G(128, 64, &Wire, -1); Adafruit_SSD1306 _oled = Adafruit_SSD1306(128, 64, &Wire, -1);
bool _ok = false; bool _ok = false;
}; };