The idea was to make a single Z-Probe on each Extruder (Toolhead) and then calculate The Z-Offset of both Nozzles. I need to say, that I have preasure sensitive print bed.
I used a M114 to get the position an then I wanted to read it from last_position.
How ever I tried it, The value comming from last_position is something completly different and does not change during both readings. As a test I used 2 different X-positions and read last_position.x) The result was that I got with M117 the last X-position of G29.
What am I doing wrong? Where is the mistake. I'm thankfull for every hint.
It'll be from the last response to M114 that was parsed. Sending a command to OctoPrint does not mean that its result will be immediately available, and due to how buffers are implemented firmware side and differences in firmware interpretations of the protocol there's also no way for OctoPrint to wait for responses for specific commands or somethings like that.
Calculating a delta is way outside of what you can do with a GCODE script. You could do it with a plugin that listens to the PositionUpdated event.
It seems that any M114 command in a script, can and will not be used in that script. So you can G4 S30000 and still not get the reaction you wanted.
Also there is a new G60 command in marlin, which will store positions in the firmware.
We also asked to report the info of the stored positions to the host:
G60 works great, but is there a way to save the G60/G61 coordinates with octoprint and reuse them later ?
Currently, G60 save coordinates to flash so, in case of reset, we have no possibility to retrieve this coordinates.
edit: add details
I'm not sure how one goes about requesting an enhancement to Marlin since I've been experimenting with building my own firmware, I added a Q parameter to G60 which reports the position being saved, same format as M114.
Not sure if that helps. I think a new command (G62?) would be needed to report a saved position at another point in time.