aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/example-extras.cfg3
-rw-r--r--klippy/extras/display/uc1701.py3
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