break;
case 206: // M206 - set homing offset
- if(is_rdelta) break; // RotaryDeltaCalibration module will handle this
+ if(is_rdelta) return; // RotaryDeltaCalibration module will handle this
if (gcode->has_letter('X')) home_offset[0] = gcode->get_value('X');
if (gcode->has_letter('Y')) home_offset[1] = gcode->get_value('Y');
break;
case 306: // set homing offset based on current position
- if(is_rdelta) break; // RotaryDeltaCalibration module will handle this
+ if(is_rdelta) return; // RotaryDeltaCalibration module will handle this
+
set_homing_offset(gcode);
break;
register_for_event(ON_GCODE_RECEIVED);
}
+float *RotaryDeltaCalibration::get_homing_offset()
+{
+ float *theta_offset; // points to theta offset in Endstop module
+ bool ok = PublicData::get_value( endstops_checksum, home_offset_checksum, &theta_offset );
+ return ok ? theta_offset : nullptr;
+}
+
void RotaryDeltaCalibration::on_gcode_received(void *argument)
{
Gcode *gcode = static_cast<Gcode *>(argument);
if( gcode->has_m) {
switch( gcode->m ) {
case 206: {
- float *theta_offset; // points to theta offset in Endstop module
- bool ok = PublicData::get_value( endstops_checksum, home_offset_checksum, &theta_offset );
- if (!ok) {
+ float *theta_offset= get_homing_offset(); // points to theta offset in Endstop module
+ if (theta_offset == nullptr) {
gcode->stream->printf("error:no endstop module found\n");
return;
}
}
}
- float *theta_offset; // points to theta offset in Endstop module
- bool ok = PublicData::get_value( endstops_checksum, home_offset_checksum, &theta_offset );
- if (!ok) {
+ float *theta_offset= get_homing_offset(); // points to theta offset in Endstop module
+ if (theta_offset == nullptr) {
gcode->stream->printf("error:no endstop module found\n");
return;
}