how to temporary change a value without variables?

  • The idea

    homeall.g (actually I have this in homex, homey and homez instead of here but this is easier to show the point):

    M913 X30 Y30 Z50
    M566 X0Y0Z0
    M98 P"homex.g"
    M98 P"homey.g"
    M98 P"homez.g"
    M913 X100 Y100 Z100
    M566 X1000Y1000Z50

    What I would like to do is

    xc = ??
    yc = ??
    zc = ??
    M913 X30 Y30 Z50
    xj = {move.axes[0].jerk}
    yj = {move.axes[1].jerk}
    zj = {move.axes[2].jerk}
    M566 X0Y0Z0E0
    M98 P"homex.g"
    M98 P"homey.g"
    M98 P"homez.g"
    M913 X{xc}Y{yc}Z{zc}
    M566 X{xj}Y{yj}Z{zj}

    Is this at all possible now or only after variables are implemented? I'm not sure if maybe push/pop can help here. They can't if I read the documentation right but better to ask then to be sorry.

    I could not find the current modifier in the M409F"vd9" response, will this be part of the model at some point?

  • After variables.

    I take it you are wishing to reduce current and jerk during homing. Current is a percent, so you can just set it back to 100. Jerk is a value, so you want to capture the 'before' value. Since you really don't want to set jerk to zero, how about dividing it by a factor, and then later multiplying by that same factor.

    M913 X30 Y30 Z50
    {move.axes[0].jerk} = {move.axes[0].jerk} / 8

    ... do the actual homing...

    {move.axes[0].jerk} = {move.axes[0].jerk} * 8
    M913 X100 Y100 Z100

  • Exactly. I had an expensive failure yesterday due to human error that I'd like to avoid in the future. The printer is able to home even with 10% of the power on the motors and on a 60+ hour print who care if homing procedure will take 3sec or 3minute so speeds can be low, jerk minimal. I did not yet test how will RRF report stall as I did not configure anything around it but even if nothing is reported still the motors should just skip steps and not break anything.

    At the moment I don't see a reason why would I want current to be anything other than 100% after homing but I guess it would not hurt to just return it to previous values. Jerk too. The divide and multiply is a great idea, I'll test it out. Thanks for the tip! So far I only set these values in config.g and here so really not a huge deal even if I keep them static but I'm just exploring as I never before used "dynamic gcode".

  • Moderator

    I store my motor currents in their own macros. Then I can just call the macro when I want to change it. It also keeps the values centralized to those macros for when I want to change them.

    CurrentsPrint.g CurrentsHoming.g etc

    Same for Z axis speeds for homing and printing.

    Not as fancy, but until variables are here it works.

  • @Phaedrux that is an awesome idea, thanks!

Log in to reply