Skip to content

Commit 20ad97f

Browse files
author
Luc
authored
Merge pull request #257 from AustinSaintAubin/2.0
Added support for SH1106
2 parents 3e38795 + cae4576 commit 20ad97f

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Thumbs.db
2+
.DS_Store
23
*.orig
34
embedded/node_modules
45
embedded/dist

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_SSD1306 // OLED Display Type: SSD1306(OLED_DISPLAY_SSD1306) / SH1106(OLED_DISPLAY_SH1106), comment this line out to disable oled
120+
#define OLED_PIN_SDA 4 //5 //SDA; // i2c SDA Pin
121+
#define OLED_PIN_SCL 15 //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(OLED_ADDR, OLED_PIN_SDA, OLED_PIN_SCL);
36+
#elif defined OLED_DISPLAY_SH1106
37+
SH1106 esp_display(OLED_ADDR, OLED_PIN_SDA, OLED_PIN_SCL);
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)