From 8a43b7182c3b8a977a09745e27466ba1501adc0f Mon Sep 17 00:00:00 2001 From: Daniel Eichhorn <dani.eichhorn@squix.ch> Date: Tue, 22 Dec 2015 08:50:00 +0100 Subject: [PATCH] Fixed wrong method name in merge from @FWeinb, updated future release version, cleaned up demo --- SSD1306Ui.cpp | 4 +-- examples/SSD1306Demo/SSD1306Demo.ino | 37 ++++++---------------------- library.properties | 6 ++--- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/SSD1306Ui.cpp b/SSD1306Ui.cpp index 198e3d2..c822905 100644 --- a/SSD1306Ui.cpp +++ b/SSD1306Ui.cpp @@ -228,7 +228,7 @@ void SSD1306Ui::drawIndicator() { break; } - this->display->drawFastImage(x, y, 8, 8, image); + this->display->drawXbm(x, y, 8, 8, image); } } @@ -245,5 +245,3 @@ int SSD1306Ui::getNextFrameNumber(){ } return nextFrame; } - - diff --git a/examples/SSD1306Demo/SSD1306Demo.ino b/examples/SSD1306Demo/SSD1306Demo.ino index e6ebbe0..8b78e57 100644 --- a/examples/SSD1306Demo/SSD1306Demo.ino +++ b/examples/SSD1306Demo/SSD1306Demo.ino @@ -27,37 +27,19 @@ See more at http://blog.squix.ch #include "SSD1306Ui.h" #include "images.h" -// if you are using a ESP8266 module with NodeMCU -// pin labels, you can use this list to keep -// your code and the lables in-sync -#define NODEMCU_D0 16 -#define NODEMCU_D1 5 -#define NODEMCU_D2 4 -#define NODEMCU_D3 0 -#define NODEMCU_D4 2 -#define NODEMCU_D5 14 -#define NODEMCU_D6 12 -#define NODEMCU_D7 13 -#define NODEMCU_D8 15 -#define NODEMCU_D9 3 -#define NODEMCU_D10 1 -#define NODEMCU_D12 10 - - - // Initialize the oled display for address 0x3c // sda-pin=14 and sdc-pin=12 -SSD1306 display(0x3c, NODEMCU_D6, NODEMCU_D5); +SSD1306 display(0x3c, D3, D4); SSD1306Ui ui ( &display ); // this array keeps function pointers to all frames // frames are the single views that slide from right to left -bool (*frames[])(SSD1306 *display, int x, int y) = { drawFrame1, drawFrame2, drawFrame3, drawFrame4 }; +bool (*frames[])(SSD1306 *display, SSD1306UiState* state, int x, int y) = { drawFrame1, drawFrame2, drawFrame3, drawFrame4 }; // how many frames are there? int frameCount = 4; -bool (*overlays[])(SSD1306 *display) = { msOverlay }; +bool (*overlays[])(SSD1306 *display, SSD1306UiState* state) = { msOverlay }; int overlaysCount = 1; void setup() { @@ -106,14 +88,14 @@ void loop() { } } -bool msOverlay(SSD1306 *display) { +bool msOverlay(SSD1306 *display, SSD1306UiState* state) { display->setTextAlignment(TEXT_ALIGN_RIGHT); display->setFont(ArialMT_Plain_10); display->drawString(128, 0, String(millis())); return true; } -bool drawFrame1(SSD1306 *display, int x, int y) { +bool drawFrame1(SSD1306 *display, SSD1306UiState* state, int x, int y) { // draw an xbm image. // Please note that everything that should be transitioned // needs to be drawn relative to x and y @@ -124,7 +106,7 @@ bool drawFrame1(SSD1306 *display, int x, int y) { return false; } -bool drawFrame2(SSD1306 *display, int x, int y) { +bool drawFrame2(SSD1306 *display, SSD1306UiState* state, int x, int y) { // Demonstrates the 3 included default sizes. The fonts come from SSD1306Fonts.h file // Besides the default fonts there will be a program to convert TrueType fonts into this format display->setTextAlignment(TEXT_ALIGN_LEFT); @@ -140,7 +122,7 @@ bool drawFrame2(SSD1306 *display, int x, int y) { return false; } -bool drawFrame3(SSD1306 *display, int x, int y) { +bool drawFrame3(SSD1306 *display, SSD1306UiState* state, int x, int y) { // Text alignment demo display->setFont(ArialMT_Plain_10); @@ -158,7 +140,7 @@ bool drawFrame3(SSD1306 *display, int x, int y) { return false; } -bool drawFrame4(SSD1306 *display, int x, int y) { +bool drawFrame4(SSD1306 *display, SSD1306UiState* state, int x, int y) { // Demo for drawStringMaxWidth: // with the third parameter you can define the width after which words will be wrapped. // Currently only spaces and "-" are allowed for wrapping @@ -167,6 +149,3 @@ bool drawFrame4(SSD1306 *display, int x, int y) { display->drawStringMaxWidth(0 + x, 10 + y, 128, "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore."); return false; } - - - diff --git a/library.properties b/library.properties index 6ffce01..e07b964 100644 --- a/library.properties +++ b/library.properties @@ -1,7 +1,7 @@ name=ESP8266 Oled Driver for SSD1306 display -version=1.0.2 -author=Daniel Eichhorn -maintainer=Daniel Eichhorn <squix78@gmail.com> +version=2.0.0 +author=Daniel Eichhorn, Fabrice Weinberg +maintainer=Daniel Eichhorn <squix78@gmail.com> sentence=A display driver for SSD1306 oled displays connected to an ESP8266 paragraph=A display driver for SSD1306 oled displays connected to an ESP8266 category=Display -- GitLab