dbrgn / RPLCD

A Raspberry Pi LCD library for the widely used Hitachi HD44780 controller, written in Python. GPIO (parallel) and I²C modes supported.
https://rplcd.readthedocs.io/en/latest/
MIT License
262 stars 72 forks source link

auto_linebreaks is broken #118

Closed semmelsamu closed 4 years ago

semmelsamu commented 4 years ago

Code to reproduce:

from RPLCD.i2c import CharLCD

lcd = CharLCD(i2c_expander='PCF8574', address=0x27, cols=20, rows=4, auto_linebreaks=False)

lcd.write_string('HellorHellorHellorHelloHello')

Altough line breaks are disabled (auto_linebreaks=False), it breaks in the third row.

IMG_20200804_152805

dbrgn commented 4 years ago

It's not broken, that's how the layout of the LCD works. Internally, a 4x20 LCD is a 2x40 LCD, where the first row is split up into rows 1 and 3, and the second row is split up into rows 2 and 4.

semmelsamu commented 4 years ago

Still, auto_linebreaks should prevent that from happening. What else should it effect?

dbrgn commented 4 years ago

No, with auto_linebreaks off the data is written directly to the controller memory. In that case you are responsible for setting the proper coordinates before writing data, depending on your LCD layout.

I think the behavior you want is precisely auto_linebreaks=True. In that case, the wrapping happens as expected.

dbrgn commented 4 years ago

https://rplcd.readthedocs.io/en/stable/usage.html#automatic-line-breaks