How can I access the Z-Probe Offset in a Wizard to read current setting?

I'm trying to write a wizard to allow setting the Z-Probe Offset. I know I can set the offset with an M851 but how can I read the current setting?

Comments

  • DId you already try M503 and see if it contains the value.
    In wizards you add parsing responses for a few seconds with hit and fail function and then send the gcode that will return the value from printer. Once it is catched you extract value from answer and show wizard dialog with old value.

    Isn't this already available in eeprom settings? In eeprom I see this rule:
    <entry type="float">
    <description unit="[mm]">Z probe offset</description>
    <set>M851 Z@</set>
    <detect>M851 .*Z(-?\d*\.?\d*)</detect>
    </entry>


  • I thought I might have to catch the response from M851, but I wasn't sure. And yes it's in the M503 and in the EEPROM Settings. I was hoping there might be an simpler way such as a {{config.probe_offset}}. 
  • I used he following:
    @monitorCall getOff 'M851 .*Z(-?\d*\.?\d*)' 5000 hitOff missOff
    M851

    @func hitOff Z
      @set global.probeOffset {{local.Z}}
      @call display

    @func missOff
      @info "Miss"

    M851 returns
    M851 X-40.00 Y-6.00 Z-1.39 ; (mm)

    global.probeOffset then contains -1 instead of -1.39

    The only way I can get the full value is to use
    @monitorCall getOff 'M851 .*Z(-?....)' 5000 hitOff missOff
    but if the Z value is -12.23, I would miss the last 3. Luckily the value should never be 2 digits before the decimal so I'm okay for now. But there seems to be an error in the Regular Expression processing. Or is it me?

    I also tried 
    @monitorCall getOff 'M851 .*Z(\S*)' 5000 hitOff missOff
    which should give all characters up to the next white space character. But that also only retuns -1

  • Watch out baskslashes as they escape the next char. So the effective regex while correct normally is missing the baskslashes I think. Try this one:

    @monitorCall getOff 'M851 .*Z(-?\\d*\\.?\\d*)' 5000 hitOff missOff
  • That works well. I also tried the following which will parse up to the next whitespace and it works also and is simpler.

    @monitorCall getOff 'M851 .*Z(\\S*)' 5000 hitOff missOff
Sign In or Register to comment.