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

    G31 Z-Probe value to "macro" ?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    2
    6
    251
    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.
    • arhiundefined
      arhi
      last edited by

      What I want to do:

      set zpmax = move.zprobe
      set zpavg = move.zprobe
      set zptemp = move.zprobe
      set iter = 0
      
      while iter < 10
        iter++
        zpavg = zpavg + zptemp
        if zptemp > zpmax
          zpmax = zptemp
        zptemp = move.zprobe
      zpavg = zpavg / 10.0
      
      if (zpmax - zpavg ) > 10
        echo "ERROR"
      else
        G31 X0 Y0 Z0 P{zpmax + 5}
        G30
      
      

      I know variables are not yet supported, but currently, I don't see how to extract Z-Probe analog value at all? I do not see it in object model. Maybe have something like move.zprobe.max, move.zprobe.avg and move.zprobe.value already in the model and have max and avg be calculated in last x milliseconds (e.g. more than 100ms less than 1000ms what makes the most sense) so something like this would work:

      G31 X0 Y0 Z0 P{move.zprobe.max + 5}
      
      1 Reply Last reply Reply Quote 0
      • arhiundefined
        arhi
        last edited by

        found this:

        echo {sensors.probes[0].value[0]}
        

        what are other values in the array? (I see only [0] exist now?)

        dc42undefined 1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @arhi
          last edited by

          @arhi said in G31 Z-Probe value to "macro" ?:

          found this:

          echo {sensors.probes[0].value[0]}
          

          what are other values in the array? (I see only [0] exist now?)

          RRF3 supports defining multiple Z probes (which is why it is an array), although at present there is no way to switch between them.

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          arhiundefined 1 Reply Last reply Reply Quote 1
          • arhiundefined
            arhi @dc42
            last edited by arhi

            @dc42 ah yes, I remember now, I was asking if I confire few with different K how to switch 🙂

            EDIT: sensors.probes[0].value[0]
            actually, no. Defining multiple probes is the first array, so probes[], what's still confusing is value[], what other values are supposed to be there?

            I can't get average value but it looks like with this new setup my value is stable while sitting idle. The previous setup with Mellow used two loud fan's on the hotend so that was probably making the idle noise too high. Now I put the E3D V6 back in and it's steady as a rock.

            I'm doing this now for homez:

            T0
            G90
            G0X0Y0F3000
            G91
            G0Z5F900H2
            G90
            G4S3
            G31X0Y0Z0P{sensors.probes[0].value[0] + 5}
            G30
            

            This works awesome! I don't think .average is required for what I wanted to use it at all, but it would be cool if we could get some "probe statistic" where for e.g. zprobe.in would be scanned as fast as possible for a while (1sec or 5sec or some configurable time) and then some stats reported like min, max, median, average... Does not have to be related to zprobe.in but for any analog input. zprobe.in def. the most important one.

            I want to do the same thing for G29 😄
            ATTM just doing G28 and then G29 works rather good as homeall just calls homex, homey, homez so the G31 will set the P value according to "current values" and that will be valid for G29 following. But if there is way to embed this into G29 I'd like to know.

            dc42undefined 1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @arhi
              last edited by dc42

              @arhi said in G31 Z-Probe value to "macro" ?:

              what's still confusing is value[], what other values are supposed to be there?

              Simple modulated IR sensors provide 2 values: the standard one that is compared to the trigger, and a second one that gives the background IR intensity (so that you know when it is to high).

              What type of probe are you using? Most digital output probes don't need averaging.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              arhiundefined 1 Reply Last reply Reply Quote 0
              • arhiundefined
                arhi @dc42
                last edited by

                @dc42 ah that makes sense then .. for multivalue, had no clue about IR one..
                I'm using precise piezo orion, but I'm using analog output as their digital output is not easy to setup (the pot on the board will die after 10-20 rotations, mine did maybe even sooner) and with analog output I can easily change the trigger position in config doing pretty much exactly the same thing as comparator on board the pcb only with higher precission. I replaced the hotend and how the averaging is not really needed for me as with new hotend everything is pretty "flat", but old one had two loud fans that were obviously shaking it introducing noise to the sensor

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