Basic Information:
Printer Model: Voron 2.4, Pi4a,
MCU / Printerboard: Spider 1.1
klippy.log
…
klippy.log (1.4 MB)
I’m seeing odd behavior from a G-Code button, that seems to depend on some aspects of the macro, potentially simply the length?
So,
- pressing the button will trigger the macro and the macro will complete.
- then on pressing the button again nothing will happen, unless there is a release g code specified, in which case the release g code will play when the button is pushed a second time
- Then after pushing the button a third time the macro will play through and the cycle will start again.
After debugging it appears that it’s potentially even simply the length of the macro that will produce this odd behavior. I will include two versions of a very similar macro the first does not create the issue the second does.
Pull-up, or inversion don’t appear to have anything to do with the issue. Neither does the board pin, i’ve tried different pins. Also commenting out release_gcode entirely has no effect. It also doesn’t seem to matter if the button is triggering a macro or the code directly.
Is this potentially a bug? None of this occurs triggering the macro from the Mainsail interface.
…
[gcode_button F_PURGE_BUTTON]
pin:^!PA3
press_gcode:
FIL_PURGE
release_gcode:
M117 Released
…
[gcode_macro FIL_PURGE] (Button works as expected)
gcode:
{% if printer.extruder.temperature > 50.0|int %} ; Nozzle temp based
{% set varix = (range(0, 25) | random) + 35 %} ; x = to random between 35-55
STATUS_HEATING
M204 S7000
G91 ; relative for lift
G1 Z3.00 ; Raise before move Purge XY
G90 ; Absolute for move
G1 F24000 X{varix} Y359.3 ; Move to Purge XY
G1 Z8 ; Move to Purge Z
M117 Filament down
G1 Z5.75 ; Move to Purge Z
G1 F8000 X75 Y359.3 ; Move to Purge Z
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
{% else %}
M117 Too Cold! 209C
{% endif %}
[gcode_macro FIL_PURGE] (Button exhibits behaviour described above)
gcode:
{% if printer.extruder.temperature > 50.0|int %} ; Nozzle temp based
{% set varix = (range(0, 25) | random) + 35 %} ; x = to random between 35-55
STATUS_HEATING
M204 S7000
G91 ; relative for lift
G1 Z3.00 ; Raise before move Purge XY
G90 ; Absolute for move
G1 F24000 X{varix} Y359.3 ; Move to Purge XY
G1 Z8 ; Move to Purge Z
M117 Filament down
G1 Z5.75 ; Move to Purge Z
G1 F8000 X75 Y359.3 ; Move to Purge Z
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
G0 X125 F14000 ; Wipe back
G0 X75 F14000 ; Wipe forth
{% else %}
M117 Too Cold! 209C
{% endif %}