From df9731149f54ab289ad4de29a4aae1c7ff318416 Mon Sep 17 00:00:00 2001 From: rdagger Date: Thu, 22 Apr 2021 13:42:03 -0700 Subject: [PATCH] Fix vline and contast bugs --- .gitignore | 1 + ili9341.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 51523e0..885376a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .flake8 .ftpconfig +.vscode/ \ No newline at end of file diff --git a/ili9341.py b/ili9341.py index eee450e..a8832d6 100644 --- a/ili9341.py +++ b/ili9341.py @@ -50,6 +50,7 @@ class Display(object): MADCTL = const(0x36) # Memory access control VSCRSADD = const(0x37) # Vertical scrolling start address 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) FRMCTR2 = const(0xB2) # Frame rate control (In idle mode/8 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. Args: - level (int): Contrast level (0 - 15). - Note: - Can pass list to specifiy + level (int): Contrast level (0 - 255). """ - assert(0 <= level < 16) + assert(0 <= level <= 255) self.write_cmd(self.CONTRAST_MASTER, level) def display_off(self): @@ -572,7 +571,7 @@ class Display(object): color (int): RGB565 color value. """ # 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 line = color.to_bytes(2, 'big') * h self.block(x, y, x, y + h - 1, line)