From f92ee8e7626976c7b5fcb9d801ead5c288b30326 Mon Sep 17 00:00:00 2001 From: Bobby Walker Date: Sat, 21 Dec 2019 18:49:25 -0600 Subject: [PATCH 1/4] Break out SDA and SCL pins into defines. --- usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino index 915289523..6493cb589 100644 --- a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino +++ b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino @@ -1,12 +1,18 @@ #include // from https://github.com/olikraus/u8g2/ +//The SCL and SDA pins are defined here. +//Lolin32 boards use SCL=4 SDA=5 +#define U8X8_PIN_SCL 5 +#define U8X8_PIN_SDA 4 + + // If display does not work or looks corrupted check the // constructor reference: // https://github.com/olikraus/u8g2/wiki/u8x8setupcpp // or check the gallery: // https://github.com/olikraus/u8g2/wiki/gallery -U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, 5, - 4); // Pins are Reset, SCL, SDA +U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, + U8X8_PIN_SDA); // Pins are Reset, SCL, SDA // gets called once at boot. Do all initialization that doesn't depend on // network here From 3dcda0873554914d241701d4c22d8869b9ebcdec Mon Sep 17 00:00:00 2001 From: Bobby Walker Date: Sat, 21 Dec 2019 18:50:33 -0600 Subject: [PATCH 2/4] Corrected ip and ssid to be knownIp and knownSsid --- usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino index 6493cb589..c70e1df0a 100644 --- a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino +++ b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino @@ -80,9 +80,9 @@ void userLoop() { // First row with Wifi name u8x8.setCursor(1, 0); - u8x8.print(ssid.substring(0, u8x8.getCols() > 1 ? u8x8.getCols() - 2 : 0)); + u8x8.print(knownSsid.substring(0, u8x8.getCols() > 1 ? u8x8.getCols() - 2 : 0)); // Print `~` char to indicate that SSID is longer, than owr dicplay - if (ssid.length() > u8x8.getCols()) + if (knownSsid.length() > u8x8.getCols()) u8x8.print("~"); // Second row with IP or Psssword @@ -91,7 +91,7 @@ void userLoop() { if (apActive && bri == 0) u8x8.print(apPass); else - u8x8.print(ip); + u8x8.print(knownIp); // Third row with mode name u8x8.setCursor(2, 2); From 6b8e9a63f3bd6602d39f2f087ba7feea3c7f51b8 Mon Sep 17 00:00:00 2001 From: Bobby Walker Date: Sat, 21 Dec 2019 18:53:37 -0600 Subject: [PATCH 3/4] define to make knownSsid compatible with esp32 --- usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino index c70e1df0a..5fca51cf4 100644 --- a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino +++ b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino @@ -69,7 +69,11 @@ void userLoop() { needRedraw = false; // Update last known values. + #ifdef(ESP8266) knownSsid = apActive ? WiFi.softAPSSID() : WiFi.SSID(); + #else + knownSsid = WiFi.SSID(); + #endif knownIp = apActive ? IPAddress(4, 3, 2, 1) : WiFi.localIP(); knownBrightness = bri; knownMode = strip.getMode(); From 5f235c121d19a55296d66f16495a23e962aa6780 Mon Sep 17 00:00:00 2001 From: Bobby Walker Date: Sat, 21 Dec 2019 18:59:12 -0600 Subject: [PATCH 4/4] correction form ifdef to if defined --- usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino index 5fca51cf4..c73170645 100644 --- a/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino +++ b/usermods/ssd1306_i2c_oled_u8g2/wled06_usermod.ino @@ -69,7 +69,7 @@ void userLoop() { needRedraw = false; // Update last known values. - #ifdef(ESP8266) + #if defined(ESP8266) knownSsid = apActive ? WiFi.softAPSSID() : WiFi.SSID(); #else knownSsid = WiFi.SSID();