tatu
November 14, 2023, 10:23am
1
Hi!
I´ve got problem with SSD1322 OLED-display.
Text won´t fit to display, orientation wrong and white line on the other end of display.
Any ideas what could be wrong, display faulty?
Tested also with same model display and result is the same.
Displays bought from Aliexpress.
My code / pinout configuration:
spi:
clk_pin: 5
mosi_pin: 23
display:
- platform: ssd1322_spi
model: "SSD1322 256x64"
reset_pin: 17
cs_pin: 22
dc_pin: 19
lambda: |-
it.print(0, 0, id(font1), " Hello World!");
font:
- file: 'arial.ttf'
id: font1
size: 25
Sounds like you need a “flip_x” type setting.
This issue sounds a bit similar.
opened 02:19PM - 20 Apr 23 UTC
closed 07:59AM - 22 Apr 23 UTC
### The problem
The last [commit ](https://github.com/esphome/esphome/pull/45… 55) from @rafal83 breaks rotated and reversed displays. My clock is installed upside down so i used to rotate & flip it and it worked fine:
```
rotate_chip: 180
reverse_enable: true
```
But with that commit the display is completely broken(see details)
### Which version of ESPHome has the issue?
2023.04
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
2023.4.3
### What platform are you using?
ESP32
### Board
_No response_
### Component causing the issue
MAX7219digit
### Example YAML snippet
```yaml
display:
- platform: max7219digit
cs_pin: GPIO25
num_chips: 4
intensity: 0
rotate_chip: 180
reverse_enable: false
flip_x: false
lambda: |-
it.print(0, 5, id(digit_font), TextAlign::CENTER_LEFT, "1234567890");
```
<details>
![image](https://user-images.githubusercontent.com/10352360/233393003-4aa4b3d2-6275-4466-b248-f41badd1ecad.png)
</details>
==========================================================================
reverse_enable: false
flip_x: true
<details>
![image](https://user-images.githubusercontent.com/10352360/233393245-95368176-907e-4781-940a-0824d3971793.png)
</details>
==========================================================================
reverse_enable: true
flip_x: true
With reverse enable the text is even duplicated from both directions
<details>
![image](https://user-images.githubusercontent.com/10352360/233393370-015e4e75-b15e-49bd-bd93-3b6013866d20.png)
</details>
==========================================================================
reverse_enable: true
flip_x: false
<details>
![image](https://user-images.githubusercontent.com/10352360/233393771-a67f0f5b-dd92-489f-8165-0dcd61d3e442.png)
</details>
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
tatu
November 17, 2023, 5:47pm
3
Can´t use rotate_chip+reverse_enable+flip_x attributes with ssd1322_spi-component.
With rotation: 180 attribute I was able to rotate text but wrong orientation and white line still exists.
display:
- platform: ssd1322_spi
model: "SSD1322 256x64"
rotation: 180
spi_mode: mode1
brightness: 10%
rotate_chip: 180
reverse_enable: true
reset_pin: GPIO17
cs_pin: GPIO22
dc_pin: GPIO19
lambda: |-
it.print(0, 0, id(font1), "Hello World!");
Neo-geo
(George)
January 11, 2024, 8:13pm
4
Hello,
did you resolve this as I have exactly the same display with exactly this issue!!!
G
I solved this problem. I have exactly this same OLED display like you showed on first post. Mirror on the screen and blank bar exist for olikraus u8g2 arduino drivers and ESPHome as well.
For olikraus u8g2 drivers solution is explained at the link: Blank bar and text mirrored on 256x64 SSD1322 OLED display · Issue #2386 · olikraus/u8g2 · GitHub
For ESPHome you need to do following steps:
You need to change some parameters at SSD1322 ESPHome drivers. To be possible to do it you need to create external components at ESPHome yaml.
You need to put ESPHome drivers for SSD1322 at my_components folder. My example of external component is following:
external_components:
external_components:
- source:
type: local
path: my_components
components: [ ssd1322_base, ssd1322_spi ]
After that you need to modify file ssd1322_base.cpp
this->command(SSD1322_SETREMAP);
this->data(0x016 );
this->data(0x11);
and
void SSD1322::display() {
this->command(SSD1322_SETCOLUMNADDRESS); // set column address
int offset_x = -4;
this->data(0x1C + offset_x ); // set column start address
this->data(0x5B + offset_x) ; // set column end address
this->command(SSD1322_SETROWADDRESS); // set row address
this->data(0x00); // set row start address
this->data(0x3F); // set last row
this->command(SSD1322_WRITERAM); // write
That is all - it should works.
tatu
March 17, 2024, 5:34pm
7
Can´t get work external component. Maybe problem is that init .py file missing? ZIP-package only included .cpp and .h files.
It gives me error “init .py not found”
How to create init .py ?
My YAML code:
esphome:
name: lcd1
friendly_name: lcd1
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
external_components:
- source:
type: local
path: my_components
components: [ ssd1322_base, ssd1322_spi ]
ota:
password: "xxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
spi:
clk_pin: GPIO5
mosi_pin: GPIO23
display:
- platform: ssd1322_spi
model: "SSD1322 256x64"
brightness: 10%
reset_pin: GPIO17
cs_pin: GPIO22
dc_pin: GPIO19
lambda: |-
it.print(0, 0, id(font1), "Hello World!");
font:
- file: 'arial.ttf'
id: font1
size: 25
tatu
March 23, 2024, 5:05pm
8
Success! I figured it out myself, sorry for stupid questions.
I downloaded drivers from Github https://github.com/esphome/esphome/tree/dev/esphome/components
Made changes above (spiderjuka post) to ssd1322_base.cpp and then succesfully compiled program.
Display working perfectly now, thank you so much for help