From d94c8561180bdd080c389e14c63ed1d862d7e2f9 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 21 Jun 2018 09:58:35 -0400 Subject: [PATCH] display: Allow the ST7920_DISPLAY parameter to be configured Signed-off-by: Kevin O'Connor --- config/example-extras.cfg | 4 ++++ klippy/extras/display.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/example-extras.cfg b/config/example-extras.cfg index 81231f758..1398f992d 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -539,6 +539,10 @@ #sid_pin: # The pins connected to an st7920 type lcd. These parameters must be # provided when using an st7920 display. +#chip_delay: +# This parameter specifies the internal command delay (in seconds) +# on st7920 displays. It may be necessary to increase this if the +# display shows garbled data. The default is 0.000020. # Custom thermistors (one may define any number of sections with a diff --git a/klippy/extras/display.py b/klippy/extras/display.py index 0f15fd78c..e68c3db74 100644 --- a/klippy/extras/display.py +++ b/klippy/extras/display.py @@ -182,6 +182,7 @@ class ST7920: self.mcu = mcu self.oid = self.mcu.create_oid() self.mcu.add_config_object(self) + self.chip_delay = config.getfloat('chip_delay', ST7920_DELAY, minval=0.) self.send_data_cmd = self.send_cmds_cmd = None self.is_extended = False # framebuffers @@ -196,7 +197,7 @@ class ST7920: "config_st7920 oid=%u cs_pin=%s sclk_pin=%s sid_pin=%s" " delay_ticks=%d" % ( self.oid, self.pins[0], self.pins[1], self.pins[2], - self.mcu.seconds_to_clock(ST7920_DELAY))) + self.mcu.seconds_to_clock(self.chip_delay))) cmd_queue = self.mcu.alloc_command_queue() self.send_cmds_cmd = self.mcu.lookup_command( "st7920_send_cmds oid=%c cmds=%*s", cq=cmd_queue)