G31 Z-Probe value to "macro" ?
-
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}
-
found this:
echo {sensors.probes[0].value[0]}
what are other values in the array? (I see only [0] exist now?)
-
@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.
-
@dc42
ah yes, I remember now, I was asking if I confire few with different K how to switchEDIT: 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. -
@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.
-
@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