output_pin: Fix handling of template rendering errors

Make sure to assign 'value' on a rendering error to avoid an internal
error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2025-03-25 18:46:38 -04:00
parent 310747a636
commit 59ebdce605

View File

@ -228,6 +228,7 @@ class PrinterOutputPin:
value = float(text) value = float(text)
except ValueError as e: except ValueError as e:
logging.exception("output_pin template render error") logging.exception("output_pin template render error")
value = 0.
self.gcrq.send_async_request(value) self.gcrq.send_async_request(value)
cmd_SET_PIN_help = "Set the value of an output pin" cmd_SET_PIN_help = "Set the value of an output pin"
def cmd_SET_PIN(self, gcmd): def cmd_SET_PIN(self, gcmd):