I’ve been trying to improve the look of the display, but I seem to be coming up to number of issues with the ESP_SSD1306.h library, mainly:
- There’s no easy way to center or change the left / right justification of the text.
- I can’t seem to get the width of a string.
- It seems quite slow (though this could just be the way I’m using it…).
Therefore I decided to have another look at the esp8266-oled-ssd1306.h library which I did look at a while ago, but I found the example quite long and difficult to follow.
Well it turns out that the library itself is actually quite easy to use. I’m not sure why they have only make 1 very large example that makes it look much more difficult than it needs to be. I have no need of frames, transitions, etc. However, after playing around with it, I seem to have been able to overcome the issues I was having with the ESP_SSD1306.h library:
- I can center text with ease. I can also change the left / right justification of text with a single line of text.
- Getting the width of a string is really easy (only take 1 function to get the width and height of a given string).
- It does seem quicker than what I was using before (but again, this could be a trick as I’ve not tried to actually measure anything).
I’ve not updated my code to use this other library and everything seems to be going well. I think I’ll keep using it in the future for this project.
You can see the updated display below.