dhylands / python_lcd

Python based library for talking to character based LCDs.
MIT License
298 stars 116 forks source link

Move the cursor after putting a char #7

Closed mcauser closed 7 years ago

mcauser commented 7 years ago

I moved the move_to() after the hal_write_data() in putstr() so that when you add the last visible character in the 32 character window, the cursor moves back to the home 0,0 position.

Previously, the blinking cursor was moving off screen to 16,1 and jumped to 1,0 on the next putchar().

lcd.blink_cursor_on()
lcd.move_to(0,0)
lcd.putstr("12345678901234561234567890123456")
# cursor offscreen (should be 0,0)
lcd.putstr("A")
# cursor at 1,0
lcd.blink_cursor_on()
lcd.move_to(15,1)
lcd.putstr("Z")
# cursor offscreen (should be 0,0)
lcd.putstr("A")
# cursor at 1,0