diff --git a/mainsail.cfg b/mainsail.cfg index 9b31cff..5284be9 100644 --- a/mainsail.cfg +++ b/mainsail.cfg @@ -50,9 +50,11 @@ description: Cancel the actual running print rename_existing: CANCEL_PRINT_BASE gcode: ##### get user parameters or use default ##### - {% set allow_park = False if printer['gcode_macro _CLIENT_VARIABLE'] is not defined - else False if printer['gcode_macro _CLIENT_VARIABLE'].park_at_cancel is not defined - else True if printer['gcode_macro _CLIENT_VARIABLE'].park_at_cancel|lower == 'true' + {% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %} + {% set client = printer['gcode_macro _CLIENT_VARIABLE'] %} + {% set allow_park = False if not macro_found + else False if client.park_at_cancel is not defined + else True if client.park_at_cancel|lower == 'true' else False %} {% set retract = 5.0 if not macro_found else client.cancel_retract|default(5.0)|abs %} {% set sp_retract = 2100 if not macro_found else client.speed_retract|default(35) * 60 %}