power: Raise error if trying to change a locked device during printing
Signed-off-by: Jordan Ruthe <jordan.ruthe@gmail.com>
This commit is contained in:
parent
00db209d5d
commit
0b3b8cede8
|
@ -105,13 +105,9 @@ class PrinterPower:
|
||||||
async def _process_request(self, device, req):
|
async def _process_request(self, device, req):
|
||||||
if req in ["on", "off"]:
|
if req in ["on", "off"]:
|
||||||
printing = await self._check_klippy_printing()
|
printing = await self._check_klippy_printing()
|
||||||
logging.info("Device locked: %s" % device.get_locked_while_printing())
|
|
||||||
logging.info("Klippy printing: %s" % printing)
|
|
||||||
if device.get_locked_while_printing() and printing:
|
if device.get_locked_while_printing() and printing:
|
||||||
self.server.error(f"Unable to change power for {device} " +
|
raise self.server.error(f"Unable to change power for {device} "
|
||||||
"while printing")
|
+ "while printing")
|
||||||
dev_info = device.get_device_info()
|
|
||||||
return dev_info['status']
|
|
||||||
ret = device.set_power(req)
|
ret = device.set_power(req)
|
||||||
if asyncio.iscoroutine(ret):
|
if asyncio.iscoroutine(ret):
|
||||||
await ret
|
await ret
|
||||||
|
|
Loading…
Reference in New Issue