Page 1 of 1

add new SSD1306 OLED Display Size

Posted: 08 Oct 2017, 22:35
by derpunkt
Hi,

i just added an OLED Display via I2C to my ESP-01S (1MB flash).
My problem actually is, that i only have the choice of size 64x48 or 128x64.

My small display is of size 128x32 (a tiny little 4 liner).

Did someone already change/modify the plugin for die SSD1306 OLED Plugin so that there is a possibility to change the size to 128x32?

I looked at the source code of the plugin - but at this point my programming skills seems to end.
Or has anyone a hint what i should have to change to get this display size working?

thank you all for your answers!

Michael

Re: add new SSD1306 OLED Display Size

Posted: 08 Oct 2017, 22:47
by vader
I have this display in use. I kicked some stuff like the top line, the indicator and limited to 2 lines. Works good for me now. :mrgreen:

Re: add new SSD1306 OLED Display Size

Posted: 08 Oct 2017, 23:06
by derpunkt
did you change the _P023_OLED.ino?

Or where have you made your changes?
Can you list your changes here or send me your _P023_OLED.ino via email? :)

Re: add new SSD1306 OLED Display Size

Posted: 09 Oct 2017, 09:41
by vader
No, I changed only the _P036_FrameOLED.ino. The result looks now like this...

Re: add new SSD1306 OLED Display Size

Posted: 09 Oct 2017, 11:54
by TD-er
The "problem" with these small displays is they are using only every other line.
For example only the odd or even line numbers (did not check yet which are being used)

So it may help if you change the used font.
I was already looking into that myself, so likely they will be added for 2.1, when also my pull request for the new version of the library is being merged.

Re: add new SSD1306 OLED Display Size

Posted: 09 Oct 2017, 20:56
by derpunkt
vader wrote: 09 Oct 2017, 09:41 No, I changed only the _P036_FrameOLED.ino. The result looks now like this...
would you post your Version of _P036_FrameOLED.ino or the changes you made?
With this Information i could experiment a little bit if i could be able to change it too or if i could change the normal _P023_OLED.ino...

Thx in advance
Michael

Re: add new SSD1306 OLED Display Size

Posted: 15 Oct 2017, 22:05
by derpunkt
so - after searching a few days and spending some time with Platformio i found the solution for the Problem with the 128x32 OLED Displays.
It is correct that the 128x32 displays shows only every other line.

My first idea was to change the whole font data and insert some blank lines in the font arrays.

That "solution" made me almost crazy - and after a while i discarded this idea because for me that made no sense.

After a while of googling i found the solution:

In the init section only two values have to be changed - then the 128x32 OLED works fine.

These values are:

For 128x64:

Plugin_023_sendcommand(0xA8); //SSD1306_SETMULTIPLEX
Plugin_023_sendcommand(0x3F); //0x1F if 128x32, 0x3F if others (e.g. 128x64)
.
.
.
Plugin_023_sendcommand(0xDA); //COMPINS
Plugin_023_sendcommand(0x12); //0x02 if 128x32, 0x12 if others (e.g. 128x64)


For 128x32:

Plugin_023_sendcommand(0xA8); //SSD1306_SETMULTIPLEX
Plugin_023_sendcommand(0x1F); //0x1F if 128x32, 0x3F if others (e.g. 128x64)
.
.
.
Plugin_023_sendcommand(0xDA); //COMPINS
Plugin_023_sendcommand(0x02); //0x02 if 128x32, 0x12 if others (e.g. 128x64)

so i spend a little bit more of time to integrate this into _P023_OLED.ino so users can select this 128x32 display in Configuration frontend:
Auswahl_003.png
Auswahl_003.png (31.07 KiB) Viewed 22685 times
additionally i made another change:
The font in this plugin is with fixed width - so characters like "l" or "i" take a lot of space that they normally don't need.

I implemented an additional feature so that users now can select if they want to have all characters with the same size or if the plugin should optimize width:
Auswahl_004.png
Auswahl_004.png (29.78 KiB) Viewed 22685 times
....and so it looks in my example: :-)
20171015_215639.jpg
20171015_215639.jpg (217.3 KiB) Viewed 22685 times
Now i am looking what i have to do to commit these changes so they can get into the master branch or the next release so every user can use these new features.


Greets
Michael

edit: typo

Re: add new SSD1306 OLED Display Size

Posted: 15 Oct 2017, 22:55
by derpunkt
so i created a new pull request for this change:

https://github.com/letscontrolit/ESPEasy/pull/545

Re: add new SSD1306 OLED Display Size

Posted: 16 Oct 2017, 16:32
by grovkillen
Great job! Thanks!

Re: add new SSD1306 OLED Display Size

Posted: 07 Feb 2018, 22:45
by QcVictor
Thanks for the plugin, why in the latest firmware update the plugin updated look like not merged <2018010.

Re: add new SSD1306 OLED Display Size

Posted: 07 Feb 2018, 23:45
by TD-er
QcVictor wrote: 07 Feb 2018, 22:45 Thanks for the plugin, why in the latest firmware update the plugin updated look like not merged <2018010.
What version of the firmware did you test?
The pull request was merged into the Mega branch, not the v2.0

And there are two plugins for these displays. The OLED (where this topic is about) and the Framed OLED, which was updated in the last build.

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 00:43
by QcVictor
With the latest 20180206 and yes this one the P023_OLED.ino

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 08:39
by TD-er
Then I guess I don't understand your question.

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 10:49
by derpunkt
i didn't understand your question.

I looked at the actual branch - and there the latest version of P023_OLD.ino is integrated.
The last - and latest - update of this plugin was merged with pull request #545.

...so i don't understand what you mean with "in the latest firmware update the plugin updated look like not merged <2018010"...sorry...

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 15:11
by QcVictor
When I update the firmware in ota with the latest release from here https://github.com/letscontrolit/ESPEasy/releases the plugin as not been updated, the source show the older one

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 16:14
by derpunkt
ok, now i understand.

You must download the mega-Release.
This is one entry below...

Release mega-20180206

Re: add new SSD1306 OLED Display Size

Posted: 08 Feb 2018, 19:58
by QcVictor
derpunkt wrote: 08 Feb 2018, 16:14 ok, now i understand.

You must download the mega-Release.
This is one entry below...

Release mega-20180206
Thank you so much derpunkt, I never see difference between mega and v2.xxx, but now ..... make sens :lol:

Re: add new SSD1306 OLED Display Size

Posted: 09 Feb 2018, 22:58
by mattlward
Will this change get pushed to the 1306framed display?

Re: add new SSD1306 OLED Display Size

Posted: 09 Feb 2018, 23:13
by TD-er
mattlward wrote: 09 Feb 2018, 22:58 Will this change get pushed to the 1306framed display?
Not this change, but there will be support for other display sizes in the OLED framed plugin.
About a week ago, I updated a lot in the code for the framed plugin and one of the things was in preparation of other display sizes.

No estimate yet on when it will happen, but for sure that it will happen :)

Re: add new SSD1306 OLED Display Size

Posted: 25 Feb 2018, 20:35
by 7keys
will it be possible to add other fonts?

(I used "mqtt import" but after waking up (sleep mode) but he did not download data...)

Re: add new SSD1306 OLED Display Size

Posted: 26 Feb 2018, 21:41
by TD-er
You can add fonts yourself, uing the online font generator: http://oleddisplay.squix.ch/#/home
You have to replace some font names in the code and the font file and then recompile.

Re: add new SSD1306 OLED Display Size

Posted: 26 Feb 2018, 22:18
by grovkillen
I've used agency as a font for the wiki templates with logo. Might consider specifying the official font?

https://www.letscontrolit.com/wiki/inde ... late_Files

Just a suggestion :ugeek:

Re: add new SSD1306 OLED Display Size

Posted: 26 Feb 2018, 22:41
by TD-er
Not sure if that font will look nice when rendered on a low res display without anti aliasing pixels.

Will have to try and render letters like "a", "m", "n", "r" and "p"
The upper case letters should not be a problem I guess.

But if there's a better looking font, which also includes the euro sign and all the other supported characters, I am all open for suggestions.
N.B. the current included font does not support the euro sign.

You have to use the v3 font generator.

Re: add new SSD1306 OLED Display Size

Posted: 27 Feb 2018, 22:37
by 7keys
TD-er wrote: 26 Feb 2018, 21:41 You can add fonts yourself, uing the online font generator: http://oleddisplay.squix.ch/#/home
You have to replace some font names in the code and the font file and then recompile.
so.. there is no chance to use it https://github.com/olikraus/u8glib/wiki/fontsize

Re: add new SSD1306 OLED Display Size

Posted: 27 Feb 2018, 22:42
by grovkillen
I think it would cost too much in memory size.

Re: add new SSD1306 OLED Display Size

Posted: 27 Feb 2018, 23:05
by 7keys
grovkillen wrote: 27 Feb 2018, 22:42 I think it would cost too much in memory size.
I added only two on the previous photo (nodemcu + lua)
a nice feature would be the option to add a font (two different ...) - no need for compilation :) It's stupid:)
Maybe the possibility of resizing ? 2x 3x ? for each row..

Re: add new SSD1306 OLED Display Size

Posted: 01 Mar 2018, 21:20
by TD-er
7keys wrote: 27 Feb 2018, 22:37
TD-er wrote: 26 Feb 2018, 21:41 You can add fonts yourself, uing the online font generator: http://oleddisplay.squix.ch/#/home
You have to replace some font names in the code and the font file and then recompile.
so.. there is no chance to use it https://github.com/olikraus/u8glib/wiki/fontsize
Those look nice, but I am not sure it is easy to convert these to the font usable by the OLED display.

The added size may be a bit of a concern, since it will probably add to the flash size, which is already reaching practical limits for OTA flashes.
It is possible to add other fonts, but we're kind of limited to the font generator I already linked.
Dynamically adding fonts would involve quite a lot of effort. Compiling them in the current code isn't that hard.
But then there are probably many other fonts people like.
So maybe we could make it easier for people to add it themselves. I will think about it.

Re: add new SSD1306 OLED Display Size

Posted: 17 Mar 2018, 11:31
by whatsupskip
7keys wrote: 27 Feb 2018, 23:05 Maybe the possibility of resizing ? 2x 3x ? for each row..
I think this is the critical part. Currently the 128x32 display is not very useful with the available font.

Is it possible to change the title of the thread to include 128x32?

Re: add new SSD1306 OLED Display Size

Posted: 12 Nov 2018, 00:54
by YKnot
How can I make the font size bigger? I have 2 lines of text so can I make 1 line of text take up 2 rows so its bigger font?