aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config_Changes.md6
-rw-r--r--docs/Config_Reference.md3
-rw-r--r--klippy/extras/virtual_sdcard.py8
3 files changed, 15 insertions, 2 deletions
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 668732f9..b5212ce1 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -8,6 +8,12 @@ All dates in this document are approximate.
## Changes
+20240415: The `on_error_gcode` parameter in the `[virtual_sdcard]`
+config section now has a default. If this parameter is not specified
+it now defaults to `TURN_OFF_HEATERS`. If the previous behavior is
+desired (take no default action on an error during a virtual_sdcard
+print) then define `on_error_gcode` with an empty value.
+
20240313: The `max_accel_to_decel` parameter in the `[printer]` config
section has been deprecated. The `ACCEL_TO_DECEL` parameter of the
`SET_VELOCITY_LIMIT` command has been deprecated. The
diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md
index 4999aba5..403dfdfc 100644
--- a/docs/Config_Reference.md
+++ b/docs/Config_Reference.md
@@ -1472,7 +1472,8 @@ path:
# be provided.
#on_error_gcode:
# A list of G-Code commands to execute when an error is reported.
-
+# See docs/Command_Templates.md for G-Code format. The default is to
+# run TURN_OFF_HEATERS.
```
### [sdcard_loop]
diff --git a/klippy/extras/virtual_sdcard.py b/klippy/extras/virtual_sdcard.py
index d49ebbcc..6dc49e2f 100644
--- a/klippy/extras/virtual_sdcard.py
+++ b/klippy/extras/virtual_sdcard.py
@@ -7,6 +7,12 @@ import os, sys, logging, io
VALID_GCODE_EXTS = ['gcode', 'g', 'gco']
+DEFAULT_ERROR_GCODE = """
+{% if 'heaters' in printer %}
+ TURN_OFF_HEATERS
+{% endif %}
+"""
+
class VirtualSD:
def __init__(self, config):
self.printer = config.get_printer()
@@ -27,7 +33,7 @@ class VirtualSD:
# Error handling
gcode_macro = self.printer.load_object(config, 'gcode_macro')
self.on_error_gcode = gcode_macro.load_template(
- config, 'on_error_gcode', '')
+ config, 'on_error_gcode', DEFAULT_ERROR_GCODE)
# Register commands
self.gcode = self.printer.lookup_object('gcode')
for cmd in ['M20', 'M21', 'M23', 'M24', 'M25', 'M26', 'M27']: