aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Lamas <pedrolamas@gmail.com>2025-01-31 11:00:16 +0000
committerKevinOConnor <kevin@koconnor.net>2025-02-02 18:52:02 -0500
commit8a2de5f23e0ffdd2ca88b78d1a99217e5132256a (patch)
tree7c98f8111caecadae86e60b6d88f948b8475f44b
parent2c90c97ccd5ceb9b4071f95866160344f013a86f (diff)
downloadkutter-8a2de5f23e0ffdd2ca88b78d1a99217e5132256a.tar.gz
kutter-8a2de5f23e0ffdd2ca88b78d1a99217e5132256a.tar.xz
kutter-8a2de5f23e0ffdd2ca88b78d1a99217e5132256a.zip
save_variables: Check lowercase variable names
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
-rw-r--r--docs/Config_Changes.md4
-rw-r--r--docs/G-Codes.md5
-rw-r--r--klippy/extras/save_variables.py2
3 files changed, 9 insertions, 2 deletions
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index a73a0c37..adc03a08 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -8,6 +8,10 @@ All dates in this document are approximate.
## Changes
+20250131: Option `VARIABLE=<name>` in `SAVE_VARIABLE` requires lowercase
+value. For example, `extruder` instead of mixedcase `Extruder` or
+uppercase `EXTRUDER`. Using any uppercase letter will raise an error.
+
20241203: The resonance test has been changed to include slow sweeping
moves. This change requires that testing point(s) have some clearance
in X/Y plane (+/- 30 mm from the test point should suffice when using
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index ff6182fa..78c1c74b 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -1201,8 +1201,9 @@ has been enabled.
#### SAVE_VARIABLE
`SAVE_VARIABLE VARIABLE=<name> VALUE=<value>`: Saves the variable to
-disk so that it can be used across restarts. All stored variables are
-loaded into the `printer.save_variables.variables` dict at startup and
+disk so that it can be used across restarts. The VARIABLE must be lowercase.
+All stored variables are loaded into the
+`printer.save_variables.variables` dict at startup and
can be used in gcode macros. The provided VALUE is parsed as a Python
literal.
diff --git a/klippy/extras/save_variables.py b/klippy/extras/save_variables.py
index 6cedcf46..2e405657 100644
--- a/klippy/extras/save_variables.py
+++ b/klippy/extras/save_variables.py
@@ -36,6 +36,8 @@ class SaveVariables:
cmd_SAVE_VARIABLE_help = "Save arbitrary variables to disk"
def cmd_SAVE_VARIABLE(self, gcmd):
varname = gcmd.get('VARIABLE')
+ if (varname.lower() != varname):
+ raise gcmd.error("VARIABLE must not contain upper case")
value = gcmd.get('VALUE')
try:
value = ast.literal_eval(value)