aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Heilmann <Florian.Heilmann@gmx.net>2020-06-09 18:07:25 +0200
committerGitHub <noreply@github.com>2020-06-09 12:07:25 -0400
commit68fcbe2a62c2ed8ddb97b3935ab89bb65e7e8f8c (patch)
tree9ec9b0da8b78aebf83b0ea7759eddce297b8b02e
parentc630ecf3c79db030a49f4bbabe36dae98734dedd (diff)
downloadkutter-68fcbe2a62c2ed8ddb97b3935ab89bb65e7e8f8c.tar.gz
kutter-68fcbe2a62c2ed8ddb97b3935ab89bb65e7e8f8c.tar.xz
kutter-68fcbe2a62c2ed8ddb97b3935ab89bb65e7e8f8c.zip
display: add SET_DISPLAY_GROUP command (#2969)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
-rw-r--r--docs/G-Codes.md5
-rw-r--r--klippy/extras/display/display.py11
2 files changed, 16 insertions, 0 deletions
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index 286dce36..48ece06d 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -202,6 +202,11 @@ The following standard commands are supported:
adjustment will only be made every BAND millimeters of z height - in
that case the formula used is `value = start + factor *
((floor(z_height / band) + .5) * band)`.
+- `SET_DISPLAY_GROUP DISPLAY=<display> GROUP=<group>`: Set the active
+ display group of the display. This allows to define multiple display
+ data groups in the config, e.g.`[display_data <group> <elementname>]`
+ and switch between them using this extended gcode command. use
+ `DISPLAY=display` to change the display group of the default display.
- `SET_IDLE_TIMEOUT [TIMEOUT=<timeout>]`: Allows the user to set the
idle timeout (in seconds).
- `RESTART`: This will cause the host software to reload its config
diff --git a/klippy/extras/display/display.py b/klippy/extras/display/display.py
index ccf7c391..a7a2621f 100644
--- a/klippy/extras/display/display.py
+++ b/klippy/extras/display/display.py
@@ -103,6 +103,10 @@ class PrinterLCD:
self.printer.register_event_handler("klippy:ready", self.handle_ready)
self.screen_update_timer = self.reactor.register_timer(
self.screen_update_event)
+ gcode = self.printer.lookup_object("gcode")
+ gcode.register_mux_command(
+ 'SET_DISPLAY_GROUP', 'DISPLAY', name, self.cmd_SET_DISPLAY_GROUP,
+ desc=self.cmd_SET_DISPLAY_GROUP_help)
# Configurable display
def _parse_glyph(self, config, glyph_name, data, width, height):
glyph_data = []
@@ -215,6 +219,13 @@ class PrinterLCD:
self.lcd_chip.write_graphics(col, row, i, data)
self.lcd_chip.write_graphics(col, row, 15, [0xff]*width)
return ""
+ cmd_SET_DISPLAY_GROUP_help = "Set the active display group"
+ def cmd_SET_DISPLAY_GROUP(self, gcmd):
+ group = gcmd.get('GROUP')
+ new_dg = self.display_data_groups.get(group)
+ if new_dg is None:
+ raise gcmd.error("Unknown display_data group '%s'" % (group,))
+ self.show_data_group = new_dg
def load_config(config):
return PrinterLCD(config)