I am working on using Klipper to run a laser engraver and would like to be able to modify G1 gcode on a firmware level (using either a Klippy/extras .py module, or via a .cfg macro). So far this does not seem possible, though I could certainly be wrong. Any insight into this would be appreciated.
In the simplest of forms, I would like to be able to get the below macro working:
[gcode_macro G1]
rename_existing: G1.1 # Rename the existing G1 command to G1.1
gcode:
{% set cmd = params|join(’ ') %}
G1.1 {cmd} ; Call the renamed G1 command with ‘E’ removed
Console:
Input: “G1 X50 Y35 E2 F1600”
Desired Output: “G1.1 X50 Y35 E2 F1600” or “G1.1 G1 X50 Y35 E2 F1600”
Actual Output: !! Unable to parse move ‘G1.1 G X Y E F’
Input: G1.1 X50 Y35 E2 F1600 or G1.1 G1 X50 Y35 E2 F1600
Output: Works as expected. Printer moves to X50 Y35. No errors or issues.
It seems close to working, but does not produce the desired results, it seems to strip all numbers from G1 commands resulting in “G1.1 G X Y E F” style commands, which of course produces an error as it is looking for coordinates