Skip to content

One linefeed too many, in case the line is filled up to the last character (4x20 display) / CircuitPython Port #28

@CrossLAN

Description

@CrossLAN

@dhylands
In a 4x20 display, if I fill the line to the last row, it skips the following line without replacement and the following line remains empty. This is independent of whether I put a \n at the end of the line or not.

If I fill the display only with 19 characters instead of the 20 possible characters, the line jump to the following line works.

Is this intentional or is it possible to turn it off?
Or am I doing something wrong?

Here is my code for testing

import board
import busio
from time import sleep, monotonic
from lcd.circuitpython_i2c_lcd import I2cLcd

# The PCF8574 has a jumper selectable address: 0x20 - 0x27
DEFAULT_I2C_ADDR = 0x26

def test_main():
    """Test function for verifying basic functionality."""
    print("Running test_main")
    i2c = busio.I2C(board.SCL, board.SDA)

    # circuitpython seems to require locking the i2c bus
    while i2c.try_lock():
        pass

    # 2 lines, 16 characters per line
    #lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR, 2, 16)

    #4 lines, 20 characters per line
    lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR, 4, 20)

    while True:
        lcd.clear()
        lcd.move_to(0, 0)
        lcd.putstr("It works!\nSecond line\n")
        print("It works!\nSecond line\n")
        sleep(2)
        lcd.clear()
        lcd.move_to(0, 0)
        lcd.putstr("12345678901234567890\n123xxxx890123yyyy890\n")
        print("12345678901234567890\n123xxxx890123yyyy890\n")
        sleep(2)
        print("Ende\n")

#if __name__ == "__main__":
test_main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions