diff --git a/src/config.h b/src/config.h index af57dc4b..eb91f0c3 100644 --- a/src/config.h +++ b/src/config.h @@ -114,10 +114,11 @@ #define ESP_DHT_PIN 2 #endif -//Pins where the screen is connected +//Pins where the screen is connected #ifdef ESP_OLED_FEATURE -#define OLED_PIN_A 4 -#define OLED_PIN_B 15 +#define OLED_DISPLAY_SH1106 // OLED Display Type: SSD1306(OLED_DISPLAY_SSD1306) / SH1106(OLED_DISPLAY_SH1106), comment this line out to disable oled +#define OLED_PIN_A 5 //5 //SDA; // i2c SDA Pin +#define OLED_PIN_B 4 //4 //SCL; // i2c SCL Pin #define OLED_ADDR 0x3c #define HELTEC_EMBEDDED_PIN 16 //0 to disable #define OLED_FLIP_VERTICALY 1 //0 to disable diff --git a/src/esp_oled.cpp b/src/esp_oled.cpp index 59d21b58..c2783c8d 100644 --- a/src/esp_oled.cpp +++ b/src/esp_oled.cpp @@ -20,9 +20,24 @@ #include "config.h" #ifdef ESP_OLED_FEATURE #include "esp_oled.h" -#include "SSD1306.h" #include "Wire.h" -SSD1306 esp_display(OLED_ADDR, OLED_PIN_A, OLED_PIN_B); + + +// Initialize the OLED display using I2C +#ifdef OLED_DISPLAY_SSD1306 + #include "SSD1306.h" // alias for `#include "SSD1306Wire.h"` +#elif defined OLED_DISPLAY_SH1106 + #include "SH1106.h" // alias for `#include "SH1106Wire.h"` +#endif + + +#ifdef OLED_DISPLAY_SSD1306 + SSD1306 esp_display(0x3c, OLED_PIN_A, OLED_PIN_B); +#elif defined OLED_DISPLAY_SH1106 + SH1106 esp_display(0x3c, OLED_PIN_A, OLED_PIN_B); +#endif + + #define ESP3D_Logo_width 62 #define ESP3D_Logo_height 45 const char ESP3D_Logo[] PROGMEM = {