Support multiple power devices. (#350)

Enable multiple devices to power on when turning on printer. Devices starting with "Printer" will turn on
This commit is contained in:
d8ahazard 2021-12-24 08:31:01 -06:00 committed by GitHub
parent 0b9d545c6f
commit 6c3c579e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,7 @@ class SplashScreenPanel(ScreenPanel):
logging.debug("Power devices: %s" % devices)
if len(devices) > 0:
logging.debug("Adding power button")
self.labels['power'].connect("clicked", self.power_on, devices[0])
self.labels['power'].connect("clicked", self.power_on, devices)
self.labels['actions'].add(self.labels['power'])
self.labels['actions'].add(self.labels['restart'])
@ -82,7 +82,8 @@ class SplashScreenPanel(ScreenPanel):
def firmware_restart(self, widget):
self._screen._ws.klippy.restart_firmware()
def power_on(self, widget, device):
def power_on(self, widget, devices):
for device in devices:
self._screen._ws.klippy.power_device_on(device)
def restart(self, widget):