Fix vline and contast bugs

pull/4/merge
rdagger 4 years ago
parent 6c2f8ca250
commit df9731149f

1
.gitignore vendored

@ -1,2 +1,3 @@
.flake8 .flake8
.ftpconfig .ftpconfig
.vscode/

@ -50,6 +50,7 @@ class Display(object):
MADCTL = const(0x36) # Memory access control MADCTL = const(0x36) # Memory access control
VSCRSADD = const(0x37) # Vertical scrolling start address VSCRSADD = const(0x37) # Vertical scrolling start address
PIXFMT = const(0x3A) # COLMOD: Pixel format set PIXFMT = const(0x3A) # COLMOD: Pixel format set
CONTRAST_MASTER = const(0x51) # Write Display Brightness
FRMCTR1 = const(0xB1) # Frame rate control (In normal mode/full colors) FRMCTR1 = const(0xB1) # Frame rate control (In normal mode/full colors)
FRMCTR2 = const(0xB2) # Frame rate control (In idle mode/8 colors) FRMCTR2 = const(0xB2) # Frame rate control (In idle mode/8 colors)
FRMCTR3 = const(0xB3) # Frame rate control (In partial mode/full colors) FRMCTR3 = const(0xB3) # Frame rate control (In partial mode/full colors)
@ -193,11 +194,9 @@ class Display(object):
"""Set display contrast to specified level. """Set display contrast to specified level.
Args: Args:
level (int): Contrast level (0 - 15). level (int): Contrast level (0 - 255).
Note:
Can pass list to specifiy
""" """
assert(0 <= level < 16) assert(0 <= level <= 255)
self.write_cmd(self.CONTRAST_MASTER, level) self.write_cmd(self.CONTRAST_MASTER, level)
def display_off(self): def display_off(self):
@ -572,7 +571,7 @@ class Display(object):
color (int): RGB565 color value. color (int): RGB565 color value.
""" """
# Confirm coordinates in boundary # Confirm coordinates in boundary
if self.is_off_grid(x, y, x, y + h): if self.is_off_grid(x, y, x, y + h - 1):
return return
line = color.to_bytes(2, 'big') * h line = color.to_bytes(2, 'big') * h
self.block(x, y, x, y + h - 1, line) self.block(x, y, x, y + h - 1, line)

Loading…
Cancel
Save