Update display library to use Adafruit SSD1306 for improved compatibility
This commit is contained in:
@@ -7,7 +7,7 @@ monitor_speed = 115200
|
||||
|
||||
lib_deps =
|
||||
adafruit/Adafruit GFX Library
|
||||
adafruit/Adafruit SH110X
|
||||
adafruit/Adafruit SSD1306
|
||||
bblanchon/ArduinoJson
|
||||
|
||||
build_flags =
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
void Display::begin() {
|
||||
Wire.begin(PIN_SDA, PIN_SCL);
|
||||
_ok = _oled.begin(OLED_ADDR, true);
|
||||
_ok = _oled.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR, true, false);
|
||||
if (!_ok) return;
|
||||
bootAnimation();
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
class Display {
|
||||
public:
|
||||
void begin();
|
||||
Adafruit_SH1106G& oled() { return _oled; }
|
||||
Adafruit_SSD1306& oled() { return _oled; }
|
||||
|
||||
void showStatus(const String& line1, const String& line2);
|
||||
void bootAnimation();
|
||||
@@ -16,6 +16,6 @@ private:
|
||||
static constexpr int PIN_SDA = 21;
|
||||
static constexpr int PIN_SCL = 22;
|
||||
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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user