Script to make babysteps permanent

  • Hi, and thanks for reading.
    There are a couple of threads going about a script to make babysteps, as tweaked at the beginning of a print, permanent.

    See here:

    and here:

    This is the macro I am currently running:

    ; 0:/macros/Save-Z
    ; This macro adds the current babystep offset to the Z trigger height and saves it to config-overide.g
    ; ! M501 needs to be in config.g to automatically be recalled on reset. If using multiple filament settings,
    ; and this is for a specific filament type, recommend placing this yielded information in the filament's config.g.
    if move.axes[2].babystep !=0                                ; If no babysteps are currently adjusted - exit routine
       echo {"OLD: " ^ sensors.probes[0].triggerHeight ^ " NEW: " ^ sensors.probes[0].triggerHeight + (move.axes[2].babystep * -1)}
       G31 Z{sensors.probes[0].triggerHeight - move.axes[2].babystep}
       echo {"Place either M501 -or- G31 Z" ^ sensors.probes[0].triggerHeight^ " in your config.g"}
       M500 P10:31                                              ; save settings to config-overide.g - G31 P31 saves trigger height, 
                                                                ; trigger value, and X and Y offsets for each possible Z probe type 
                                                                ; P10 parameter saves the G10 tool offsets.
       M290 R0 S0 												; clear babystepping 
       echo "Baby stepping is not currently employed, exiting."

    The sequence of actions is that I start with a freshly homed Duet with babysteps set to zero. I start a print job and I realize that my nozzle is too high. I babystep down until I get a good first layer (this being done while the print job is running). I have now determined the correct nozzle height and I want to make that permanent so I run the macro (print job is still running).
    From what I can ascertain, the variable sensors,probes{0}.triggerHeight as used in the macro's G31 command seems to be set incorrectly when run while there is a print job going.
    After the G31 line is run, the sensor.probes[0].triggerHeight is a value that doesn't make sense. I have seen it at (roughly) 69, 120, 450 mm and other values.
    There have been occasions when the trigger height was correct but lately I get crazy values after even a single run of save z.
    I have not seen crazy values if there is no print job running.

    It would appear that the variable /memory location is somehow re-used or over-written and then restored (one possible scenario) during an active print job.

    Would you please have a look-see at the situation and the code and see if you can find an issue somewhere in the bowels of the firmware (or in the way the macro is coded or run) ?

    There have been a couple of new versions of this floated but I have stuck to an older version as it shows the issue nicely.


  • Additional info: When I refer to 'the print job running' I refer to stuff actually moving about. If I 'pause' the current job, the save operation succeeds in all the tries that I have done. As soon as I try to save z while the printhead is moving, things go pear shaped.

  • administrators

    @jens55 just changed the topic to something more useful

  • <sigh>
    Now we have three threads for the same issue.

  • I admire your persistence.


  • @fcwilt said in Script to make babysteps permanent:

    I admire your persistence.


    Is that what you call it......

    Sometimes you just have to say f*** it and go have a beer

  • Did that, ran out of suds, problem didn't go away ... 😞
    Oh yeah ... figured I would save somebody a lot of grief down the road when the issue reared it's ugly head again in another situation.

  • @DC42 Bump .....

    Could a mod please make sure that DC42 is aware of this issue?
    I realize that he is probably busier than a one armed paper hanger and I will gladly step back and forget about this issue for now once I know that it reached him.

  • Moderator

    @jens55 Probably best to actually tag him with @dc42 if you want him to look!


  • @droftarts said in Script to make babysteps permanent:

    @jens55 Probably best to actually tag him with @dc42 if you want him to look!


    That doesnt seem to work I asked a question in another thread last week (regarding firmware)

    I tagged him and got no reply, so either its not working or he didn't want to answer the question.....

  • Thanks .... how do you tag somebody and what does that do? Does he get a message when it's tagged ?

  • Moderator

    @CaLviNx He gets a lot of requests. Last week he was on holiday, so try again.


  • Moderator

    @jens55 Type an '@' sign in your post, and you'll get a list of people that have replied to the post. If the person who's attention you want is not on the list, just continue and type their name. Like replying to a particular post (the blue 'Reply' or 'Quote' words on each post), the person tagged will get a notification via the bell icon.


  • administrators

    @jens55, are you running firmware 3.1.1, or an earlier version?

  • @dc42 , thanks for replying!

  • administrators

    I confirm that's a bug, which I will fix in 3.2beta1. Meanwhile, you may be able to work around it by putting M400 just before the G31 command.

  • Thanks! No need to work around it ... I just wanted to make sure you were aware.

Log in to reply