Skip to content

Commit 8a43b71

Browse files
committed
Fixed wrong method name in merge from @FWeinb, updated future release version, cleaned up demo
1 parent 2fcdddf commit 8a43b71

File tree

3 files changed

+12
-35
lines changed

3 files changed

+12
-35
lines changed

SSD1306Ui.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void SSD1306Ui::drawIndicator() {
228228
break;
229229
}
230230

231-
this->display->drawFastImage(x, y, 8, 8, image);
231+
this->display->drawXbm(x, y, 8, 8, image);
232232
}
233233
}
234234

@@ -245,5 +245,3 @@ int SSD1306Ui::getNextFrameNumber(){
245245
}
246246
return nextFrame;
247247
}
248-
249-

examples/SSD1306Demo/SSD1306Demo.ino

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,19 @@ See more at http://blog.squix.ch
2727
#include "SSD1306Ui.h"
2828
#include "images.h"
2929

30-
// if you are using a ESP8266 module with NodeMCU
31-
// pin labels, you can use this list to keep
32-
// your code and the lables in-sync
33-
#define NODEMCU_D0 16
34-
#define NODEMCU_D1 5
35-
#define NODEMCU_D2 4
36-
#define NODEMCU_D3 0
37-
#define NODEMCU_D4 2
38-
#define NODEMCU_D5 14
39-
#define NODEMCU_D6 12
40-
#define NODEMCU_D7 13
41-
#define NODEMCU_D8 15
42-
#define NODEMCU_D9 3
43-
#define NODEMCU_D10 1
44-
#define NODEMCU_D12 10
45-
46-
47-
4830
// Initialize the oled display for address 0x3c
4931
// sda-pin=14 and sdc-pin=12
50-
SSD1306 display(0x3c, NODEMCU_D6, NODEMCU_D5);
32+
SSD1306 display(0x3c, D3, D4);
5133
SSD1306Ui ui ( &display );
5234

5335
// this array keeps function pointers to all frames
5436
// frames are the single views that slide from right to left
55-
bool (*frames[])(SSD1306 *display, int x, int y) = { drawFrame1, drawFrame2, drawFrame3, drawFrame4 };
37+
bool (*frames[])(SSD1306 *display, SSD1306UiState* state, int x, int y) = { drawFrame1, drawFrame2, drawFrame3, drawFrame4 };
5638

5739
// how many frames are there?
5840
int frameCount = 4;
5941

60-
bool (*overlays[])(SSD1306 *display) = { msOverlay };
42+
bool (*overlays[])(SSD1306 *display, SSD1306UiState* state) = { msOverlay };
6143
int overlaysCount = 1;
6244

6345
void setup() {
@@ -106,14 +88,14 @@ void loop() {
10688
}
10789
}
10890

109-
bool msOverlay(SSD1306 *display) {
91+
bool msOverlay(SSD1306 *display, SSD1306UiState* state) {
11092
display->setTextAlignment(TEXT_ALIGN_RIGHT);
11193
display->setFont(ArialMT_Plain_10);
11294
display->drawString(128, 0, String(millis()));
11395
return true;
11496
}
11597

116-
bool drawFrame1(SSD1306 *display, int x, int y) {
98+
bool drawFrame1(SSD1306 *display, SSD1306UiState* state, int x, int y) {
11799
// draw an xbm image.
118100
// Please note that everything that should be transitioned
119101
// needs to be drawn relative to x and y
@@ -124,7 +106,7 @@ bool drawFrame1(SSD1306 *display, int x, int y) {
124106
return false;
125107
}
126108

127-
bool drawFrame2(SSD1306 *display, int x, int y) {
109+
bool drawFrame2(SSD1306 *display, SSD1306UiState* state, int x, int y) {
128110
// Demonstrates the 3 included default sizes. The fonts come from SSD1306Fonts.h file
129111
// Besides the default fonts there will be a program to convert TrueType fonts into this format
130112
display->setTextAlignment(TEXT_ALIGN_LEFT);
@@ -140,7 +122,7 @@ bool drawFrame2(SSD1306 *display, int x, int y) {
140122
return false;
141123
}
142124

143-
bool drawFrame3(SSD1306 *display, int x, int y) {
125+
bool drawFrame3(SSD1306 *display, SSD1306UiState* state, int x, int y) {
144126
// Text alignment demo
145127
display->setFont(ArialMT_Plain_10);
146128

@@ -158,7 +140,7 @@ bool drawFrame3(SSD1306 *display, int x, int y) {
158140
return false;
159141
}
160142

161-
bool drawFrame4(SSD1306 *display, int x, int y) {
143+
bool drawFrame4(SSD1306 *display, SSD1306UiState* state, int x, int y) {
162144
// Demo for drawStringMaxWidth:
163145
// with the third parameter you can define the width after which words will be wrapped.
164146
// Currently only spaces and "-" are allowed for wrapping
@@ -167,6 +149,3 @@ bool drawFrame4(SSD1306 *display, int x, int y) {
167149
display->drawStringMaxWidth(0 + x, 10 + y, 128, "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore.");
168150
return false;
169151
}
170-
171-
172-

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name=ESP8266 Oled Driver for SSD1306 display
2-
version=1.0.2
3-
author=Daniel Eichhorn
4-
maintainer=Daniel Eichhorn <squix78@gmail.com>
2+
version=2.0.0
3+
author=Daniel Eichhorn, Fabrice Weinberg
4+
maintainer=Daniel Eichhorn <squix78@gmail.com>
55
sentence=A display driver for SSD1306 oled displays connected to an ESP8266
66
paragraph=A display driver for SSD1306 oled displays connected to an ESP8266
77
category=Display

0 commit comments

Comments
 (0)