mirror of
				https://github.com/Klipper3d/klipper.git
				synced 2025-10-31 10:25:57 +01:00 
			
		
		
		
	display: add support for multiple displays
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
		| @@ -1868,6 +1868,37 @@ | |||||||
| #   template. This field is evaluated using command templates (see | #   template. This field is evaluated using command templates (see | ||||||
| #   docs/Command_Templates.md). This parameter must be provided. | #   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 | # Filament sensors | ||||||
|   | |||||||
| @@ -7,3 +7,15 @@ import display | |||||||
|  |  | ||||||
| def load_config(config): | def load_config(config): | ||||||
|     return display.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_chip = config.getchoice('lcd_type', LCD_chips)(config) | ||||||
|         self.lcd_type = config.get('lcd_type') |         self.lcd_type = config.get('lcd_type') | ||||||
|         # Load menu and display_status |         # 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") |         self.printer.try_load_module(config, "display_status") | ||||||
|         # Configurable display |         # Configurable display | ||||||
|         self.display_templates = {} |         self.display_templates = {} | ||||||
| @@ -145,9 +149,10 @@ class PrinterLCD: | |||||||
|     # Screen updating |     # Screen updating | ||||||
|     def screen_update_event(self, eventtime): |     def screen_update_event(self, eventtime): | ||||||
|         # update menu component |         # update menu component | ||||||
|         ret = self.menu.screen_update_event(eventtime) |         if self.menu is not None: | ||||||
|         if ret: |             ret = self.menu.screen_update_event(eventtime) | ||||||
|             return ret |             if ret: | ||||||
|  |                 return ret | ||||||
|         # Update normal display |         # Update normal display | ||||||
|         self.lcd_chip.clear() |         self.lcd_chip.clear() | ||||||
|         try: |         try: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user