diff options
author | Arksine <arksine.code@gmail.com> | 2019-04-02 12:49:08 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-04-02 15:53:16 -0400 |
commit | 2e16be224efcff315dafaf1f4e4b85e3c7a8c3c8 (patch) | |
tree | 9e8c05b685284c0fc0d6f978e6cbc4544126b88b | |
parent | 9bd3e804213b03c1a05eba3c88fabe8f1b9f7c5c (diff) | |
download | kutter-2e16be224efcff315dafaf1f4e4b85e3c7a8c3c8.tar.gz kutter-2e16be224efcff315dafaf1f4e4b85e3c7a8c3c8.tar.xz kutter-2e16be224efcff315dafaf1f4e4b85e3c7a8c3c8.zip |
uc1701: make contrast configurable
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
-rw-r--r-- | config/example-extras.cfg | 3 | ||||
-rw-r--r-- | klippy/extras/display/uc1701.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg index 2d9387ee..9f164476 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -1217,6 +1217,9 @@ #a0_pin: # The pins connected to an uc1701 type lcd. These parameters must be # provided when using an uc1701 display. +#contrast: 40 +# The contrast to set when using a uc1701 type display. The value may +# range from 0 to 63. Default is 40. #cs_pin: #dc_pin: #spi_bus: diff --git a/klippy/extras/display/uc1701.py b/klippy/extras/display/uc1701.py index 5c1a39a3..5870bba2 100644 --- a/klippy/extras/display/uc1701.py +++ b/klippy/extras/display/uc1701.py @@ -153,6 +153,7 @@ class I2C: class UC1701(DisplayBase): def __init__(self, config): DisplayBase.__init__(self, SPI4wire(config, "a0_pin")) + self.contrast = config.getint('contrast', 40, minval=0, maxval=63) def init(self): init_cmds = [0xE2, # System reset 0x40, # Set display to start at line 0 @@ -166,7 +167,7 @@ class UC1701(DisplayBase): 0x00, # Booster ratio value (4x) 0x23, # Set resistor ratio (3) 0x81, # Set Electronic Volume - 0x28, # Electronic volume value (40) + self.contrast, # Electronic Volume value 0xAC, # Set static indicator off 0x00, # NOP 0xA6, # Disable Inverse |