From f08a0c5e93b92a6efa72d16a3d53968f3e54bf1c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 22 Jun 2018 22:07:48 -0400 Subject: lcd_st7920: Use a longer delay at the start of each command/data It appears the st7920 requires a longer delay when switching from command to data mode (and vice-versa). Slower MCUs don't show a problem because the klipper command processing time results in a sufficient delay. However, some of the faster MCUs can process klipper commands fast enough that the next st7920 transfer is sent too fast. Add an additional delay to account for this. Signed-off-by: Kevin O'Connor --- klippy/extras/display.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'klippy/extras/display.py') diff --git a/klippy/extras/display.py b/klippy/extras/display.py index e68c3db7..00a4777d 100644 --- a/klippy/extras/display.py +++ b/klippy/extras/display.py @@ -161,7 +161,9 @@ HD44780_chars = [ # ST7920 (128x64 graphics) lcd chip ###################################################################### -ST7920_DELAY = .000020 # Spec says 72us, but faster is possible in practice +# Spec says 72us, but faster is possible in practice +ST7920_CMD_DELAY = .000020 +ST7920_SYNC_DELAY = .000045 class ST7920: char_right_arrow = '\x1a' @@ -182,7 +184,6 @@ 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 @@ -195,9 +196,10 @@ class ST7920: def build_config(self): self.mcu.add_config_cmd( "config_st7920 oid=%u cs_pin=%s sclk_pin=%s sid_pin=%s" - " delay_ticks=%d" % ( + " sync_delay_ticks=%d cmd_delay_ticks=%d" % ( self.oid, self.pins[0], self.pins[1], self.pins[2], - self.mcu.seconds_to_clock(self.chip_delay))) + self.mcu.seconds_to_clock(ST7920_SYNC_DELAY), + self.mcu.seconds_to_clock(ST7920_CMD_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) -- cgit v1.2.3-70-g09d2