- } else {
- // for a rotary delta M306 calibrates the homing angle
- // by doing M306 A-56.17 it will calculate the M206 A value (the theta offset for actuator A) based on the difference
- // between what it thinks is the current angle and what the current angle actually is specified by A (ditto for B and C)
-
- // get the current angle for each actuator
- ActuatorCoordinates current_angle{
- THEKERNEL->robot->actuators[X_AXIS]->get_current_position(),
- THEKERNEL->robot->actuators[Y_AXIS]->get_current_position(),
- THEKERNEL->robot->actuators[Z_AXIS]->get_current_position()
- };
-
- //figure out what home_offset needs to be to correct the homing_position
- if (gcode->has_letter('A')) {
- float a = gcode->get_value('A'); // what actual angle is
- home_offset[0] = (a - current_angle[0]);
- THEKERNEL->robot->reset_actuator_position(a, NAN, NAN);
- }
- if (gcode->has_letter('B')) {
- float b = gcode->get_value('B');
- home_offset[1] = (b - current_angle[1]);
- THEKERNEL->robot->reset_actuator_position(NAN, b, NAN);
- }
- if (gcode->has_letter('C')) {
- float c = gcode->get_value('C');
- home_offset[2] = (c - current_angle[2]);
- THEKERNEL->robot->reset_actuator_position(NAN, NAN, c);
- }
-
- gcode->stream->printf("Theta Offset: A %8.5f B %8.5f C %8.5f\n", home_offset[0], home_offset[1], home_offset[2]);
- }