jlas1 / Klicky-Probe

Microswitch probe with magnetic attachement, primarily aimed at CoreXY 3d printers
GNU General Public License v3.0
1.27k stars 283 forks source link

Certain Events & Probing Error Leaves Potential For Starting Next Print With Probe Still Attached & Unchecked #230

Open 3DPrintDemon opened 1 year ago

3DPrintDemon commented 1 year ago

If the user encounters a "probe triggered prior to movement" error during probing like if there's a poor connection with the magnets due to say a buildup of old filament candy floss, or a failing probe for example it leaves potential for the possibility for the user to start the next print with the probe still attached & it's state unchecked - if Klicky is used on a machine with conditional homing in the Print_Start macro instead of a plain G28 command.

Note G28 Z is used in the macro, but before that nozzle cleaning etc is called.

I experienced these series of events during a live print_start & was able to start the next print with the probe state unchecked. I then could replicate this series of events manually by triggering the probe while the printer was probing the bed & got the same results every time. I understand these series of events are extremely unlikely for most users but it is possible to do this.

Example of conditional homing used that bypassed the standard Klicky probe state check after error :

   {% if "xyz" not in printer.toolhead.homed_axes %}
    STATUS_HOMING
    M117 Homing...
    G28

   {% endif %}

This was allowed to occur because after the "probe triggered prior to movement" error the system parks the toolhead but does not disable the steppers, so the active toolhead status is retained, & if the user then forgets to manually remove the probe from the toolhead before starting the next print the conditional homing will not call a homing event so the Klicky status is not checked & the new print starts with the probe still on the toolhead.

I made a simple macro that inserts a Klicky state check using probe_query to use if the steppers are still active & conditional homing is not engaged, if Klicky is found to be attached the macro will call Dock_Probe_Unlock to dock the probe before continuing on with the new print.

Example of modified conditional homing with Klicky state check before continuing:

 {% if "xyz" not in printer.toolhead.homed_axes %}
    STATUS_HOMING
    M117 Homing...
    G28
 {% else %}
    _klicky_check
 {% endif %}

Example of simple Klicky state check & how to proceed:

[gcode_macro _klicky_check]
gcode:   
    query_probe
    _probe_state action={ params.ACTION }

[gcode_macro _probe_state]
gcode:
  {% set query_probe_triggered = printer.probe.last_query %}
  {% set action  = params.ACTION|default('') %}

  {% if query_probe_triggered %}

  {% else %}
    Dock_Probe_Unlock  
  {% endif %}

I know my macro writing skills aren't anything special but the above works & if it helps someone else who's using a similar setup & experienced the same thing that's great. Also I hope you'll be able to take this account & incorporate something to help mitigate this in the future for everyone else.

Thanks for reading.