Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    auto update of probe height

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    3
    213
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • appjawsundefined
      appjaws
      last edited by

      I have a macro that probes 10 times so that the user can update G31 with the average probe height.
      The macro now calculates the average probe height but I don't know how to update G31 permanently from within the macro.
      My current G31 X-25 Y-5 Z0.67 P500 needs to be amended to be G31 X-25 Y-5 Z(average value) P500

      Any ideas on how to do this?

      appjaws - Core XYUV Duet Ethernet Duex5
      firmware 3.5.0-rc.4 Web Interface 3.5.0-rc.4
      Ormerod 1-converted to laser engraver, Duet wifi
      OpenSCAD version 2024.03.18
      Simplify3D 5.1.2

      1 Reply Last reply Reply Quote 0
      • oliofundefined
        oliof
        last edited by oliof

        Checking the object model, it looks like the median value spit out from the G30 S-1 runs is not available. But sensors.probes[0].lastStopHeight is. So with the variables that landed in 3.3b2, you might be able to read that after each individual probing run, and then in the end build your own median or average from the measurements.

        Untested code that will most certainly not work (I don't have a standalone machine with 3.3b2 at hand to test), assuming a single probe:

        stop_heights = 0.0
        while iterations < 30
          G30 P{iterations} X0 Y0 Z-99999
          stop_heights = stop_heights + sensors.probes[0].lastStopHeight
        G30 P31 X0 Y0 Z-9999  S-1
        stop_heights = stop_heights + sensors.probes[0].lastStopHeight
        avg_heights = stop_heights_sum/32  ; iterations starts at 0
        G31 X-25 Y-5 Z{avg_heights} P500
        

        <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

        1 Reply Last reply Reply Quote 0
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by Phaedrux

          I feel like M500 P31 and G30 S-3 could probably come into play here, but I'm not if that's needed now that conditional is available.

          https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M500_Store_parameters

          If the P31 parameter is used, the G31 trigger height, trigger value and X and Y offsets for each possible Z probe type (in older firmware versions the G31 parameters are stored even if the P31 parameter is not present)

          https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_G30_Single_Z_Probe

          G30 S-3 ; Probe the bed and set the Z probe trigger height to the height it stopped at (supported in RRF 2.03 and later)

          The downside of G30 S-3 is that it takes the singular result and not any average of several results.

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA