- // the result is in actuator coordinates and raw steps
- gcode->stream->printf("Z:%1.4f\n", mm);
-
- // set the last probe position to the current actuator units
- THEROBOT->set_last_probe_position(std::make_tuple(
- THEROBOT->actuators[X_AXIS]->get_current_position(),
- THEROBOT->actuators[Y_AXIS]->get_current_position(),
- THEROBOT->actuators[Z_AXIS]->get_current_position(),
- 1));
-
- // move back to where it started, unless a Z is specified (and not a rotary delta)
- if(gcode->has_letter('Z') && !is_rdelta) {
- // set Z to the specified value, and leave probe where it is
- THEROBOT->reset_axis_position(gcode->get_value('Z'), Z_AXIS);
-
- } else {
- // return to pre probe position
- return_probe(mm, reverse);
+ // the result is in actuator coordinates moved
+ gcode->stream->printf("Z:%1.4f\n", THEKERNEL->robot->from_millimeters(mm));
+
+ if(set_z) {
+ // set current Z to the specified value, shortcut for G92 Znnn
+ char buf[32];
+ int n = snprintf(buf, sizeof(buf), "G92 Z%f", gcode->get_value('Z'));
+ string g(buf, n);
+ Gcode gc(g, &(StreamOutput::NullStream));
+ THEKERNEL->call_event(ON_GCODE_RECEIVED, &gc);