aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArksine <arksine.code@gmail.com>2020-03-04 12:31:09 -0500
committerKevin O'Connor <kevin@koconnor.net>2020-03-08 17:38:24 -0400
commitaa7d24b0af03b75ddbdb83875954cb54b9c796e9 (patch)
tree0971ef8ecfa83449f00c1512da6e5ac1df545726
parent6d5ce309a5720d635432236ffad82bc5bec02335 (diff)
downloadkutter-aa7d24b0af03b75ddbdb83875954cb54b9c796e9.tar.gz
kutter-aa7d24b0af03b75ddbdb83875954cb54b9c796e9.tar.xz
kutter-aa7d24b0af03b75ddbdb83875954cb54b9c796e9.zip
display: add support for multiple displays
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
-rw-r--r--config/example-extras.cfg31
-rw-r--r--klippy/extras/display/__init__.py12
-rw-r--r--klippy/extras/display/display.py13
3 files changed, 52 insertions, 4 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg
index dbf3a6f4..5d319fe0 100644
--- a/config/example-extras.cfg
+++ b/config/example-extras.cfg
@@ -1868,6 +1868,37 @@
# template. This field is evaluated using command templates (see
# docs/Command_Templates.md). This parameter must be provided.
+# If a primary [display] section has been defined in printer.cfg as shown
+# above it is possible to define multiple auxilary displays. Note that
+# auxilary displays do not currently support menu functionality, thus they
+# do not support the "menu" options or button configuration.
+#[display my_display]
+#lcd_type:
+#rs_pin:
+#e_pin:
+#d4_pin:
+#d5_pin:
+#d6_pin:
+#d7_pin:
+#cs_pin:
+#sclk_pin:
+#sid_pin:
+#cs_pin:
+#a0_pin:
+#rst_pin:
+#contrast: 40
+#cs_pin:
+#dc_pin:
+#spi_bus:
+#spi_speed:
+#spi_software_sclk_pin:
+#spi_software_mosi_pin:
+#spi_software_miso_pin:
+#reset_pin:
+#display_group:
+# See the [display] section above for details on each configuration
+# option above.
+
######################################################################
# Filament sensors
diff --git a/klippy/extras/display/__init__.py b/klippy/extras/display/__init__.py
index 3b5e999e..c839b098 100644
--- a/klippy/extras/display/__init__.py
+++ b/klippy/extras/display/__init__.py
@@ -7,3 +7,15 @@ import display
def load_config(config):
return display.load_config(config)
+
+def load_config_prefix(config):
+ if not config.has_section('display'):
+ raise config.error(
+ "A primary [display] section must be defined in printer.cfg "
+ "to use auxilary displays")
+ name = config.get_name().split()[-1]
+ if name == "display":
+ raise config.error(
+ "Section name [display display] is not valid. "
+ "Please choose a different postfix.")
+ return display.load_config(config)
diff --git a/klippy/extras/display/display.py b/klippy/extras/display/display.py
index 19483802..4d594329 100644
--- a/klippy/extras/display/display.py
+++ b/klippy/extras/display/display.py
@@ -84,7 +84,11 @@ class PrinterLCD:
self.lcd_chip = config.getchoice('lcd_type', LCD_chips)(config)
self.lcd_type = config.get('lcd_type')
# Load menu and display_status
- self.menu = menu.MenuManager(config, self.lcd_chip)
+ self.menu = None
+ name = config.get_name()
+ if name == 'display':
+ # only load menu for primary display
+ self.menu = menu.MenuManager(config, self.lcd_chip)
self.printer.try_load_module(config, "display_status")
# Configurable display
self.display_templates = {}
@@ -145,9 +149,10 @@ class PrinterLCD:
# Screen updating
def screen_update_event(self, eventtime):
# update menu component
- ret = self.menu.screen_update_event(eventtime)
- if ret:
- return ret
+ if self.menu is not None:
+ ret = self.menu.screen_update_event(eventtime)
+ if ret:
+ return ret
# Update normal display
self.lcd_chip.clear()
try: