Basic Information:
Printer Model: Hevort Based + KTCv2
MCU / Printerboard: Duet3D, Super8
Host / SBC: RPI
klippy.log
Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there
Describe your issue:
Hi,
I’m experiencing a strange behavior with GCODE_BUTTON.
I’ve searched the thread for any similar issue but it does not seem to exist, if it is then I apologize in advance.
I have several GCODE_BUTTON in place to detect toolhead on a carriage/docks (on a DIY multi_tool 3D printer under construction).
I wanted to use these GCODE_Button to perform a sanity check on the printer. For example, if the GCODE_BUTTON of the carriage is PRESSED
(meaning a tool is engaged) then one (and only one) tool dock GCODE_BUTTON must be RELEASED (one tool is not on its dock). It also allow
me to retrieve which tool is engaged on the carriage.
The multi-tool management is based on the KTC v2 code from Andrei Ignat (TypQxQ)… amazing job by the way.
When I use a GCODE macro to test the status of the GCODE_BUTTON (from Fluidd or Mainsail) then everything works fine, the status of the
different GCODE_BUTTON is correctly retrieved).
When I call a GCODE macro from python (in the KTC callback function for the Klipper:READY state), then all GCODE_BUTTON status are retrieved
RELEASED, independently of there real states. When Fluidd is connected, then the macro retrieves the correct states again.
It seems like klipper’s extras python files are not using the same way to retrieve GCODE_BUTTON state as Fluidd and Mainsail (just guessing here, I’m not a Klipper expert)
I’ve tried different solutions:
- Read gcode from .cfg file at KTC init phase and execute it in the Klipper:READY callback (this is the default behavior of the KTC module)
- Using DELAYED GCODE suspecting that klipper needed more time to retrieve the correct GCODE_BUTTON status (setting the delay up to 30s)
- Calling an existing gcode macro directly from the KLIPPER:READY callback, trying to avoid any early evaluation of the macro induced by a loading of the
macro during the init phase (like in step 1)
All failed: RELEASED is always returned for all GCODE_BUTTON from python, the correct state is retrieved if I call the macro from Fluidd
If anyone can provide me with a track of investigation, it would be cool.
Search for === PRINT_TCHEAD_STATE === in the klippy.log file, it is the start of the output of the macro
Thanks,
(Sorry for the english, not my native language)
klippy.log.txt (1.3 MB)