aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-06-22 22:07:48 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-06-22 23:47:09 -0400
commitf08a0c5e93b92a6efa72d16a3d53968f3e54bf1c (patch)
treeef562213a7898d4c0dcc95c5fb0718c4f20769d9 /klippy/extras
parent74de181e59fcc6f2d8d86190e73a1382810add8b (diff)
downloadkutter-f08a0c5e93b92a6efa72d16a3d53968f3e54bf1c.tar.gz
kutter-f08a0c5e93b92a6efa72d16a3d53968f3e54bf1c.tar.xz
kutter-f08a0c5e93b92a6efa72d16a3d53968f3e54bf1c.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r--klippy/extras/display.py10
1 files changed, 6 insertions, 4 deletions
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)