-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSD1306 128x64 I2C not working #1030
Comments
I need to see the error immediately after activation. The errors you are showing occur after the relevant error has already occurred, |
Sure!
|
I just pushed a fix. upgrade to master and see if the issue persists. |
I'm now getting another error. This shows up after enabling the display function. Thanks!
|
What are your settings? It seems like you're using a non-latin-1 character. |
Try replacing Line 108:
with: font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu//DejaVuSans.ttf') Save, restart the backend, and see if it works and if there are any display issues. |
that seems to work! |
Keep issues separated. We should only be discussing the LCD here. To diagnose, you should create a new dashboard, then add one widget at a time until an issue presents. |
This issue as been resolved, but it will be left open until the next release. |
BTW, how does the font look on the display? Are there any display issues? |
The font is really small IMHO, even more if you use the smaller 0.9inch version of the SSD1306. On my ESP32 I have it with 4 lines max It seems there's a "clean screen" command at some point and the whole screen blinks before updating, maybe it's just because the library that this is using but I'm not having that problem using ESPHome (it only refreshes what is changed in the screen) |
Can you compare the default font (just display text lines, no measurements) with the one you edited the library to use? I don't have this display available to use and would like to see the difference, if you can take a photo of each. |
Sure! here you have a couple of videos as photos looks a bit weird with the refresh. Notice how small the text is vs the USB ports! IMG_6656.movIMG_6667.mov |
Alright, I made some changes that allow the font and font size to be set. This is one of two necessary changes for this to be effective. The next change will involve allowing the 128x64 displays to have 4 lines instead of 8, which will allow the font to be increased above 10 pt without causing an overlap. Can you upgrade to master and see if the new settings work by changing "Font Size" to greater than 10 pt and check the option "Use Non-Default Font". Try just upgrading and see if it works before deactivating and saving different options. I'd like to see if there are any issues from only upgrading. If it then works, try changing the options to see how they affect the display. If everything works well, I'll add another Display Function for your display that has 4 lines and you can use a larger font size. |
I've upgraded from Master and it looks like even enabling "Use Non-Default Font" setting I'm getting back the old error. I've checked and it's enabled, at least in the front-end
|
Okay, I forgot you need the option "Use Non-Default Font" if you have non-latin-1 characters (probably the micro symbol). |
So you're getting that error when not using the default font? Strange. Let me look into it. |
Just pushed a fix and it should not work. Upgrade to master and give it a try. |
Yes, this one works!. I've tried to change font-size but doesn't seem to have an effect, not sure if it's implemented yet but just wanted to let you know |
Oops, lol I didn't implement it. I'll add it after I get some other work done. |
Just implemented the font size option. |
Just tested it but something is happening, I've changed the size to 14. Pasting the error log below
|
It was expecting an integer instead of a float value. I just pushed a fix. Upgrade to master, save the settings once, then activate. |
It works! |
Great! I'll make a version with 4 lines and you can experiment and let me know what font size works best for that display, and I'll set that to the default. |
I just added a 4 line version of the 128x64 SSD1306 Function. Give it a try and let me know if it works and what font size looks the best. |
Umm I think something is off, I've added a new 4 line function and if I increase the font size above 10pt the line-height won't grow so the text lines will overlap. |
Well, I don't have this display with me to test, so development will take a while to get right. Can you provide photos demonstrating what you're describing so I can try to develop a solution to the issue? |
Thanks. Just pushed a fix that should fix the spacing. |
Btw noticed the ph value is not right-aligned as the EC... just a small detail tho. |
The issue with spacing is because it calculates the length of strings based on a mono-spaced font, from the Class I created to handle outputting to mono-spaced LCDs. This gets a lot trickier to determine when we're not using mono-spaced fonts. |
oh then it's an easy fix for me, just upload a new font and use that one instead! |
The width is set to 20 characters. I'll add an option so the user can change this value. |
I just updated the Function to have an additional option Characters Per Line. Let me know if it works as expected. |
I should also add an option to choose whether to display the unit or not. |
Yes, just tested it and it's working fine! |
Describe the problem/bug
The screen is not showing anything. I know this screen is working as It was working with an ESP32 a few minutes ago. It's being correctly detected through i2cdetect command as well.
Versions:
Reproducibility
Expected behavior
Screen should show the lines
Screenshots
After enabling the device the log goes crazy showing this
![Screenshot 2021-06-19 at 21 34 23](https://user-images.githubusercontent.com/190036/122653661-53df6f80-d146-11eb-8b31-cd51d97ef868.png)
The text was updated successfully, but these errors were encountered: