mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 22:14:05 -06:00
display: add support for multiple displays
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
6d5ce309a5
commit
aa7d24b0af
3 changed files with 52 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue