Skip to content

Commit a43eaa6

Browse files
Added support for SH1106
OLED_DISPLAY_SH1106
1 parent f24dfe9 commit a43eaa6

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/config.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@
114114
#define ESP_DHT_PIN 2
115115
#endif
116116

117-
//Pins where the screen is connected
117+
//Pins where the screen is connected
118118
#ifdef ESP_OLED_FEATURE
119-
#define OLED_PIN_A 4
120-
#define OLED_PIN_B 15
119+
#define OLED_DISPLAY_SH1106 // OLED Display Type: SSD1306(OLED_DISPLAY_SSD1306) / SH1106(OLED_DISPLAY_SH1106), comment this line out to disable oled
120+
#define OLED_PIN_A 5 //5 //SDA; // i2c SDA Pin
121+
#define OLED_PIN_B 4 //4 //SCL; // i2c SCL Pin
121122
#define OLED_ADDR 0x3c
122123
#define HELTEC_EMBEDDED_PIN 16 //0 to disable
123124
#define OLED_FLIP_VERTICALY 1 //0 to disable

src/esp_oled.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@
2020
#include "config.h"
2121
#ifdef ESP_OLED_FEATURE
2222
#include "esp_oled.h"
23-
#include "SSD1306.h"
2423
#include "Wire.h"
25-
SSD1306 esp_display(OLED_ADDR, OLED_PIN_A, OLED_PIN_B);
24+
25+
26+
// Initialize the OLED display using I2C
27+
#ifdef OLED_DISPLAY_SSD1306
28+
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
29+
#elif defined OLED_DISPLAY_SH1106
30+
#include "SH1106.h" // alias for `#include "SH1106Wire.h"`
31+
#endif
32+
33+
34+
#ifdef OLED_DISPLAY_SSD1306
35+
SSD1306 esp_display(0x3c, OLED_PIN_A, OLED_PIN_B);
36+
#elif defined OLED_DISPLAY_SH1106
37+
SH1106 esp_display(0x3c, OLED_PIN_A, OLED_PIN_B);
38+
#endif
39+
40+
2641
#define ESP3D_Logo_width 62
2742
#define ESP3D_Logo_height 45
2843
const char ESP3D_Logo[] PROGMEM = {

0 commit comments

Comments
 (0)