Skip to content

Commit

Permalink
menu: fix crash when opening SDCard menu while printing
Browse files Browse the repository at this point in the history
This fixes the bug introduced by f1091a4.
The problem is that condition was returning string which
could not be converted to boolean. We solve that by showing
`Start Printing` when `is_active`.

```
ERROR:root:Unhandled exception during run
Traceback (most recent call last):
   ...
   File "/opt/klipper/klippy/extras/display/menu.py", line 117, in eval_enable
     return bool(ast.literal_eval(self._enable_tpl.render(context)))
   File "/usr/lib/python2.7/ast.py", line 49, in literal_eval
     node_or_string = parse(node_or_string, mode='eval')
   File "/usr/lib/python2.7/ast.py", line 37, in parse
     return compile(source, filename, mode, PyCF_ONLY_AST)
   File "<unknown>", line 1
     /opt/octoprint/uploads/wait_print.gcode
```

Signed-off-by: Kamil Trzcinski <[email protected]>
  • Loading branch information
ayufan authored and KevinOConnor committed Jul 27, 2021
1 parent c8405fe commit 7e88f92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion klippy/extras/display/menu.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ name: SD Card

[menu __main __sdcard __start]
type: command
enable: {('virtual_sdcard' in printer) and printer.virtual_sdcard.file_path}
enable: {('virtual_sdcard' in printer) and printer.virtual_sdcard.file_path and not printer.virtual_sdcard.is_active}
name: Start printing
gcode: M24

Expand Down

0 comments on commit 7e88f92

Please sign in to comment.