void _home_axis(Homing homing_state, int axis, PrinterRail rail) { // Determine movement var _tup_1 = rail.get_range(); var position_min = _tup_1.X; var position_max = _tup_1.Y; var hi = rail.get_homing_info(); var homepos = new List <double?> { null, null, null, null }; homepos[axis] = hi.position_endstop; if (axis == 0) { homepos[1] = 0.0; } var forcepos = homepos.ToList(); if (hi.positive_dir ?? false) { forcepos[axis] -= hi.position_endstop - position_min; } else { forcepos[axis] += position_max - hi.position_endstop; } // Perform homing double?limit_speed = null; if (axis == 2) { limit_speed = this.max_z_velocity; } homing_state.home_rails(new List <PrinterRail> { rail }, (forcepos[0], forcepos[1], forcepos[2], forcepos[3]), (homepos[0], homepos[1], homepos[2], homepos[3]), limit_speed); }
public override void home(Homing homing_state) { // Each axis is homed independently and in order foreach (var axis in homing_state.get_axes()) { var rail = this.rails[axis]; // Determine movement var _tup_1 = rail.get_range(); var position_min = _tup_1.X; var position_max = _tup_1.Y; var hi = rail.get_homing_info(); var homepos = new List <double?> { null, null, null, null }; homepos[axis] = hi.position_endstop; var forcepos = homepos.ToList(); if ((bool)hi.positive_dir) { forcepos[axis] -= 1.5 * (hi.position_endstop - position_min); } else { forcepos[axis] += 1.5 * (position_max - hi.position_endstop); } // Perform homing double?limit_speed = null; if (axis == 2) { limit_speed = this.max_z_velocity; } homing_state.home_rails(new List <PrinterRail> { rail }, (forcepos[0], forcepos[1], forcepos[2], forcepos[3]), (homepos[0], homepos[1], homepos[2], homepos[3]), limit_speed); } }