-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SET_GCODE_VARIABLE does not work with non-numeric values #4816
Comments
Thanks, @pedrolamas for submitting a new ticket. As mentioned in #4107, I also found the same problem (I have a bit of additional supporting information in that post as well). |
This issue keeps coming up for me. In my latest use case, I want to have a The obvious way to do this would be to simply save the message in a gcode variable, and later reference it when
I have several other cases where I want functionality such as this, such as managing the color of the lights on the printer, or tracking the name of the filament currently in each extruder. Since Klipper can only store a single number (not strings, not lists) I am unable to do these types of operations. I've also tried using Perhaps there is another way around this issue? I've tried every semi-obvious path, but no luck so far. On a side note, I have been using Marlin/Repetier for many years, and Klipper totally blows them out of the water. I am now converting all my printers to Klipper. Fantastic / amazing project, thank you! |
The code tries to interpret the value given to
Similar in case jinja2 expansion is involved:
Granted, it is a bit of a fiddly endeavor, especially when nested quotes are involved. |
Ah, does make sense considering the source code!! Thanks for pointing that out @wlhlm, and considering this I will check if we can add something in the documentation to state such behavior! |
Thanks @wlhlm! That nailed the problem. Not obvious, but makes sense and works great. This issue should be closed, but for any future readers interested, here is a working full-stack based message push/pop. Perhaps this can help others with handling some of the oddities of Jinja2 / Klipper syntax and list management...?
|
I've checked the existing documentation for SET_GCODE_VARIABLE and noticed this bit:
This explains that the Given this, I am closing this issue. |
I've noticed that
SET_GCODE_VARIABLE
fails when used with strings.Take the following example:
Calling the above macro will result in the following output:
Looking at the code, the issue seems to be related to this specific bit:
klipper/klippy/extras/gcode_macro.py
Lines 178 to 181 in 0b918b3
The text was updated successfully, but these errors were encountered: