Z Axis Probing Issues

Nice!

Could you please format your code with the code braces:

Format

All leading spaces are gone without that.

Ok done

1 Like
[gcode_macro SENSORLESS_HOME_X]
gcode:
    {% set HOME_CUR = 0.700 %}
    {% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %}
    {% set RUN_CUR = driver_config.run_current %}
    # Set current for sensorless homing
    SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
    # Pause to ensure driver stall flag is clear
    G4 P2000
    # Home
    G28 X0
    # Move away
    G90
    G1 X157 F1200
    # Set current during print
    SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}


[gcode_macro SENSORLESS_HOME_Y]
gcode:
    {% set HOME_CUR = 0.700 %}
    {% set driver_config = printer.configfile.settings['tmc2209 stepper_y'] %}
    {% set RUN_CUR = driver_config.run_current %}
    # Set current for sensorless homing
    SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
    # Pause to ensure driver stall flag is clear
    G4 P2000
    # Home
    G28 Y0
    # Move away
    G90
    G1 Y174 F1200
    # Set current during print
    SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}


[homing_override]
axes: z
set_position_z: 0
gcode:
   G90
   G0 Z6 F600

   {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

 {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

  {% if home_all or 'X' in params %}
  SENSORLESS_HOME_X
  {% endif %}
  
  {% if home_all or 'Y' in params %}
  SENSORLESS_HOME_Y
  {% endif %}
  
  {% if home_all or 'Z' in params %}

   G28 Z
   G0 Z10 F1800
   {% endif %}

Can I ask why you set your final toolhead raise:

G0 Z10 F1800

Is so fast? Iā€™m not sure what kind of Z axis motion drive you have but if you got that kind of speed, arenā€™t you going to get a hell of a jerk?

hello you can edit to your liking, for now I set up this way because Iā€™m still finishing to fix everything. The configuration is fine but I have to finish optimizing.

I get that youā€™re going to be looking at things, but this is an honest order of magnitude faster than what most people use for Z movement - thatā€™s why I reacted and asked.

Have you actually run with the Z movement at this speed?

Hello,

I know this topic is solvedā€¦ I can only say that jinja or flask or whatever tool you use as a microframework in html type coding within the .cfg or other python2/3 scripts should not have many if statements. It slows the processā€¦

I think this is the reference to who made jinja?

Anywayā€¦I will get the actual template describing why/how jinja html if statements slows down things in general.

Seth

P.S. Template Designer Documentation ā€” Jinja Documentation (3.1.x) states that expressions are available in any form but that using it in html makes things different: Template Designer Documentation ā€” Jinja Documentation (3.1.x) .

I am not saying jinja is indeed a cure or a foe but only that it gets as complicated as other formulary programsā€¦ If I am off base, okay. I just figured some people may want to see how html and python like expressions create issues in the case of making html called whatever but using it as html.

I know this is not Jinja course work studies. So, no big woof here but!

  1. I see they have done some updating and maybe, just maybe, I am confusing pure jinja w/ flask.
  2. Sorry if numeral one is correct. My mistake.

How much does an ā€œifā€ statement in a jinja2 .cfg slow things down? I would think that weā€™re talking single digit milliseconds at most to evaluate an {% if <cond> %} statement and branch to the appropriate locations for execution. I doubt it would be noticeable across a print.

Now, I do agree that the use of conditional execution statements in a macro should be minimized simply because there is no decent way of debugging complex operations and, unless you have lots of echo statements for tracking actual execution , you may not know how they will actually execute.

1 Like

For now yes but only for this small movement in the home phase. In printing, the axis to these parameters:



[printer]
kinematics: corexy
max_velocity: 300
max_accel: 3000
max_accel_to_decel: 3000
max_z_velocity: 14
max_z_accel: 40

I believe (and, if Iā€™m wrong Iā€™m sure I will hear about it) that the two values are separate for their respective operations.

You have a reasonable value for Z axis movement while printing and and a real potential jerk after doing your homing which I would think could affect the final position of the toolhead after the Z axis movement. I would be concerned that the steppers driving the leadscrews can turn fast enough for that speed.

I would suggest a value for ā€œFā€ of 600 or so after homing.

okay

Then Iā€™ll update you Iā€™m putting the tmc5160pro. What I posted now refers to Stepper TMC 2209