OLED[0] - OLED[3]


OLED displays with SSD1306 and SH1106 controllers, 128x64 and 128x32, are supported. Advantages: Easily obtainable, inexpensive, simple to connect, 3.3V power supply. SCL and SDA pins must be set in the Setup/Peripheral menu. When using multiple displays, the SCL pins are shared. For four displays, the Lite firmware is required as it has enough free RAM for stable operation.

OLED[0](CLR)
Clears the display.
OLED[0](I)
Inverts the image.
OLED[0](N)
Normal image.
OLED[0](R)
Reset.
OLED(R)
Resets all displays.

TEXT

OLED[0](CLR,TXTL,1)small
Clears the display and writes "small" in small font, left-aligned.

STR[0]=string| NUM[1]=12.77
OLED[0](CLR,TXTL,1)STR[0]
Clears the display and writes the content of STR[0] in small font, left-aligned.
OLED[0](CLR,TXTL,1)NUM1[1]
Clears the display and writes the value of NUM[1] rounded to one decimal place in small font, left-aligned.

OLED[0](CLR,TXTR,2)MediuM
Clears the display and writes "MediuM" in medium font, right-aligned.

OLED[0](CLR,TXTC,3)LARGE
Clears the display and writes "LARGE" in large font, center-aligned.

OLED[0](TXTC,2)Next Line
Writes "Next Line" in medium font, center-aligned horizontally on the next line.

OLED[0](CLR,TXTC,2,10)margin-top:10px
Clears the display and writes "margin-top:10px" in medium font, center-aligned horizontally, 10 pixels below the top of the display.

OLED[0](TXTC,2,A3)margin-top:3px
Writes "margin-top:3px" in medium font, center-aligned horizontally, 3 pixels below the previous line.

OLED[0](CLR,TXTL,1,0,15)margin-left:15px
Clears the display and writes "margin-left:15px" in small font, left-aligned with a 15-pixel margin.

OLED[0](TXTR,1,A5,15)margin-right:15px
Writes "margin-right:15px" in small font, right-aligned with a 15-pixel margin, 5 pixels below the previous line.


SHAPES

OLED[0](CLR,LINE,0,0,127,63)
Draws a line between coordinates x1, y1 and x2, y2.

OLED[0](CLR,RECT,15,10,100,40)
Draws a rectangle. Top-left corner x, y, width, height.

OLED[0](CLR,RECTF,15,10,100,40)
Draws a filled rectangle. Top-left corner x, y, width, height.

OLED[0](CLR,TRIA,64,0,0,63,127,63)
Draws a triangle between coordinates x1, y1, x2, y2, x3, y3.

OLED[0](CLR,TRIAF,64,0,0,63,127,63)
Draws a filled triangle between coordinates x1, y1, x2, y2, x3, y3.

OLED[0](CLR,CIRC,63,31,31)
Draws a circle. Origo x, y, radius size.

OLED[0](CLR,CIRCF,63,31,31)
Draws a filled circle. Origo x, y, radius size.

OLED[0](CLR,CIRCQ,63,31,31,3)
Draws quarter circles. Origo x, y, radius size, quads (0-15):
00100001
01001000


IMAGE

OLED[0](CLR,PIC,0,0,128,64)garfield.mono
Displays an image from storage. The file can also be STR[x] with a .mono extension.
Top-left corner x, y, size width, height. The width and height values must match the actual image size!

Creating an image offline
I couldn't find a program that generates a .mono file with a few clicks, so I made one. This is in the mono folder as create.cmd. First, find an image whose aspect ratio is similar to that of the used display. Copy the image to be converted (image.jpg/png/bmp) into the mono folder and start create.cmd. Button 1 adjusts the resolution. Button 2 sets the image extension. Button 3 sets the resizing mode. The cut-out can only be used near the target resolution and uses the center of the image as long as it fits on the display. Button 4 sets the black-and-white conversion mode. Button 5 creates the mono file. The monochrome image (mono.bmp) and resized image (boot32.bmp/boot64.bmp) can be viewed in the folder. Rename the finished monochrome resolution-correct bmp file to boot32.bmp/boot64.bmp and convert it to a boot32.mono/boot64.mono file with button 8. If the image is named boot32.mono (128x32) or boot64.mono (128x64), it will be displayed during boot. Upload the finished mono file to the module's storage. Rename it to be used with the OLED[0] command.
Thanks to the ImageMagick team.

Creating an image online
First, create the desired image resolution (max 128x64) using an online image editor.
Convert the finished image to .mono format using one of the following links based on the file extension.
https://www.imageconvert.org/jpg-to-mono
https://www.imageconvert.org/png-to-mono
https://www.imageconvert.org/bmp-to-mono
Download the finished file, upload it to the ESP module, and it can be used with the OLED[0] command.

QR CODE

This only works if QR is checked in the Setup/Peripherals menu next to the display.
OLED[0](CLR,QR,R,0,0)www.esp8266.org
Displays a QR code starting from coordinates x (0-79), y (0-15). The phone recognizes and displays/executes its content.
Details:https://github.com/zxing/zxing/wiki/Barcode-Contents

OLED[0](CLR,QR,W)
This code connects the phone to the WiFi network.

PROGRESS BAR

OLED[0](CLR,PBAR,0,20,127,20)10
Displays a progress bar.
Top-left corner x, y, size width, height, followed by value (0-100).

NUM[0]VL=10|
NUM[0]VH=50|
NUM[0]=40

OLED[0](CLR,PBAR,0,0,127,20)NUM[0]
Shows the value of NUM[0].
OLED[0](CLR,PBAR,0,0,127,20)NUM[0]%
Shows the value of NUM[0] as a percentage between min and max.



Examples

Clock, date.
CMD[10]:STR[0]=%Y. %MS %D.;STR[1]=%WL;STR[2]=%0h:%0m:%0s|
CMD[11]:OLED[0](CLR,TXTC,3)STR[2];OLED[0](TXTC,2,A0)STR[1];OLED[0](TXTC,2,A2)STR[0]|
TIMES:CMD[10];CMD[11]


Clock, date in hungarian language.
Language
STR[10]=Vasárnap|
STR[11]=Hétfö|
STR[12]=Kedd|
STR[13]=Szerda|
STR[14]=Csütörtök|
STR[15]=Péntek|
STR[16]=Szombat|
STR[20]=Január|
STR[21]=Február|
STR[22]=Március|
STR[23]=Április|
STR[24]=Május|
STR[25]=Június|
STR[26]=Július|
STR[27]=Augusztus|
STR[28]=Szeptember|
STR[29]=Október|
STR[30]=November|
STR[31]=December|

Start
CMD[40]:NUM[8]=%M;NUM[8]+19;STR[0]=NUM(8);STR[0]> %D.|
CMD[41]:NUM[9]=%W;NUM[9]+9;STR[1]=NUM(9)|
CMD[42]:STR[2]=%0h:%0m:%0s|
CMD[43]:OLED[0](CLR,TXTC,3)STR[2];OLED[0](TXTC,2,A0)STR[1];OLED[0](TXTC,2,A2)STR[0]|
TIMES:CMD[40];CMD[41];CMD[42];CMD[43]