Skip to content

Commit c0262c6

Browse files
authored
Fix 16x04 lines 3 and 4 (#23)
Thanks for the fix.
1 parent 6d3a30a commit c0262c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lcd/lcd_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ def move_to(self, cursor_x, cursor_y):
128128
addr = cursor_x & 0x3f
129129
if cursor_y & 1:
130130
addr += 0x40 # Lines 1 & 3 add 0x40
131-
if cursor_y & 2:
132-
addr += 0x14 # Lines 2 & 3 add 0x14
131+
if cursor_y & 2 and self.num_columns == 16:
132+
addr += 0x10 # Lines 3 & 4 add 0x10 for 16 cols and 0x14 for 20 cols
133+
if cursor_y & 2 and self.num_columns == 20:
134+
addr += 0x14
133135
self.hal_write_command(self.LCD_DDRAM | addr)
134136

135137
def putchar(self, char):

0 commit comments

Comments
 (0)