diff --git a/src/app.cpp b/src/app.cpp index 7ad48f26..83be5a36 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -74,7 +74,7 @@ void app::setup() { mApi.setup(this, mSys, mWeb.getWebSrvPtr(), mConfig); // Plugins - #if defined(ENA_NOKIA) || defined(ENA_SSD1306) + #if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106) mMonoDisplay.setup(mSys, &mTimestamp); everySec(std::bind(&MonoDisplayType::tickerSecond, &mMonoDisplay)); #endif diff --git a/src/app.h b/src/app.h index 8663c2a9..5a4bb494 100644 --- a/src/app.h +++ b/src/app.h @@ -46,7 +46,7 @@ typedef PubMqtt PubMqttType; typedef PubSerial PubSerialType; // PLUGINS -#if defined(ENA_NOKIA) || defined(ENA_SSD1306) +#if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106) #include "plugins/MonochromeDisplay/MonochromeDisplay.h" typedef MonochromeDisplay MonoDisplayType; #endif @@ -180,7 +180,7 @@ class app : public IApp, public ah::Scheduler { #if !defined(AP_ONLY) mMqtt.payloadEventListener(cmd); #endif - #if defined(ENA_NOKIA) || defined(ENA_SSD1306) + #if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106) mMonoDisplay.payloadEventListener(cmd); #endif } @@ -244,7 +244,7 @@ class app : public IApp, public ah::Scheduler { uint32_t mSunrise, mSunset; // plugins - #if defined(ENA_NOKIA) || defined(ENA_SSD1306) + #if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106) MonoDisplayType mMonoDisplay; #endif }; diff --git a/src/platformio.ini b/src/platformio.ini index ba6c8be0..d64a8c93 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -125,6 +125,24 @@ lib_deps = https://github.com/ThingPulse/esp8266-oled-ssd1306.git https://github.com/JChristensen/Timezone +[env:esp8266-sh1106] +platform = espressif8266 +board = esp12e +board_build.f_cpu = 80000000L +build_flags = -D RELEASE -DENA_SH1106 +monitor_filters = + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line + ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory +lib_deps = + https://github.com/yubox-node-org/ESPAsyncWebServer + nrf24/RF24 + paulstoffregen/Time + https://github.com/bertmelis/espMqttClient#v1.3.3 + bblanchon/ArduinoJson + https://github.com/ThingPulse/esp8266-oled-ssd1306.git + https://github.com/JChristensen/Timezone + [env:esp32-wroom32-release] platform = espressif32 board = lolin_d32 @@ -181,3 +199,21 @@ lib_deps = bblanchon/ArduinoJson https://github.com/ThingPulse/esp8266-oled-ssd1306.git https://github.com/JChristensen/Timezone + +[env:esp32-wroom32-sh1106] +platform = espressif32 +board = lolin_d32 +build_flags = -D RELEASE -std=gnu++14 -DENA_SH1106 +build_unflags = -std=gnu++11 +monitor_filters = + ;default ; Remove typical terminal control codes from input + time ; Add timestamp with milliseconds for each new line + ;log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory +lib_deps = + https://github.com/yubox-node-org/ESPAsyncWebServer + nrf24/RF24 + paulstoffregen/Time + https://github.com/bertmelis/espMqttClient#v1.3.3 + bblanchon/ArduinoJson + https://github.com/ThingPulse/esp8266-oled-ssd1306.git + https://github.com/JChristensen/Timezone \ No newline at end of file diff --git a/src/plugins/MonochromeDisplay/MonochromeDisplay.h b/src/plugins/MonochromeDisplay/MonochromeDisplay.h index 83236992..3bfe9458 100644 --- a/src/plugins/MonochromeDisplay/MonochromeDisplay.h +++ b/src/plugins/MonochromeDisplay/MonochromeDisplay.h @@ -1,15 +1,19 @@ #ifndef __MONOCHROME_DISPLAY__ #define __MONOCHROME_DISPLAY__ -#if defined(ENA_NOKIA) || defined(ENA_SSD1306) +#if defined(ENA_NOKIA) || defined(ENA_SSD1306) || defined(ENA_SH1106) #ifdef ENA_NOKIA #include #define DISP_PROGMEM U8X8_PROGMEM -#else // ENA_SSD1306 +#else // ENA_SSD1306 || ENA_SH1106 /* esp8266 : SCL = 5, SDA = 4 */ /* ewsp32 : SCL = 22, SDA = 21 */ #include - #include + #ifdef ENA_SSD1306 + #include + # else //ENA_SH1106 + #include + #endif #define DISP_PROGMEM PROGMEM #endif @@ -34,7 +38,7 @@ class MonochromeDisplay { mNewPayload = false; mExtra = 0; } - #else // ENA_SSD1306 + #else // ENA_SSD1306 || ENA_SH1106 MonochromeDisplay() : mDisplay(0x3c, SDA, SCL), mCE(CEST, CET) { mNewPayload = false; mExtra = 0; @@ -215,7 +219,7 @@ class MonochromeDisplay { mDisplay.sendBuffer(); } while( mDisplay.nextPage() ); mExtra++; - #else // ENA_SSD1306 + #else // ENA_SSD1306 || ENA_SH1106 if(mUp) { mRx += 2; if(mRx >= 20) @@ -289,7 +293,11 @@ class MonochromeDisplay { #if defined(ENA_NOKIA) U8G2_PCD8544_84X48_1_4W_HW_SPI mDisplay; #else // ENA_SSD1306 - SSD1306Wire mDisplay; + #ifdef ENA_SSD1306 + SSD1306Wire mDisplay; + # else //ENA_SH1106 + SH1106Wire mDisplay; + #endif int mRx; char mUp; #endif