#define beta_limit_enable_checksum CHECKSUM("beta_limit_enable")
#define gamma_limit_enable_checksum CHECKSUM("gamma_limit_enable")
+#define home_z_first_checksum CHECKSUM("home_z_first")
#define homing_order_checksum CHECKSUM("homing_order")
#define move_to_origin_checksum CHECKSUM("move_to_origin_after_home")
this->is_rdelta = THEKERNEL->config->value(rdelta_homing_checksum)->by_default(false)->as_bool();
this->is_scara = THEKERNEL->config->value(scara_homing_checksum)->by_default(false)->as_bool();
+ this->home_z_first = THEKERNEL->config->value(home_z_first_checksum)->by_default(false)->as_bool();
+
// see if an order has been specified, must be three characters, XYZ or YXZ etc
string order = THEKERNEL->config->value(homing_order_checksum)->by_default("")->as_string();
this->homing_order = 0;
return 0;
}
-void Endstops::home(std::bitset<3> a)
+void Endstops::home_xy()
{
- // reset debounce counts
- debounce.fill(0);
-
- this->axis_to_home= a;
-
- // Start moving the axes to the origin
- this->status = MOVING_TO_ENDSTOP_FAST;
-
- THEROBOT->disable_segmentation= true; // we must disable segmentation as this won't work with it enabled
if(axis_to_home[X_AXIS] && axis_to_home[Y_AXIS]) {
// Home XY first so as not to slow them down by homing Z at the same time
float delta[3] {alpha_max*2, beta_max*2, 0};
if(this->home_direction[X_AXIS]) delta[X_AXIS]= -delta[X_AXIS];
if(this->home_direction[Y_AXIS]) delta[Y_AXIS]= -delta[Y_AXIS];
float feed_rate = std::min(fast_rates[X_AXIS], fast_rates[Y_AXIS]);
- THEROBOT->solo_move(delta, feed_rate);
+ THEROBOT->delta_move(delta, feed_rate, 3);
// Wait for XY to have homed
THECONVEYOR->wait_for_empty_queue();
// now home X only
float delta[3] {alpha_max*2, 0, 0};
if(this->home_direction[X_AXIS]) delta[X_AXIS]= -delta[X_AXIS];
- THEROBOT->solo_move(delta, fast_rates[X_AXIS]);
+ THEROBOT->delta_move(delta, fast_rates[X_AXIS], 3);
// wait for X
THECONVEYOR->wait_for_empty_queue();
// now home Y only
float delta[3] {0, beta_max*2, 0};
if(this->home_direction[Y_AXIS]) delta[Y_AXIS]= -delta[Y_AXIS];
- THEROBOT->solo_move(delta, fast_rates[Y_AXIS]);
+ THEROBOT->delta_move(delta, fast_rates[Y_AXIS], 3);
// wait for Y
THECONVEYOR->wait_for_empty_queue();
}
+}
+
+void Endstops::home(std::bitset<3> a)
+{
+ // reset debounce counts
+ debounce.fill(0);
+
+ this->axis_to_home= a;
+
+ // Start moving the axes to the origin
+ this->status = MOVING_TO_ENDSTOP_FAST;
+
+ THEROBOT->disable_segmentation= true; // we must disable segmentation as this won't work with it enabled
+
+ if(!home_z_first) home_xy();
if(axis_to_home[Z_AXIS]) {
// now home z
float delta[3] {0, 0, gamma_max*2}; // we go twice the maxz just in case it was set incorrectly
if(this->home_direction[Z_AXIS]) delta[Z_AXIS]= -delta[Z_AXIS];
- THEROBOT->solo_move(delta, fast_rates[Z_AXIS]);
+ THEROBOT->delta_move(delta, fast_rates[Z_AXIS], 3);
// wait for Z
THECONVEYOR->wait_for_empty_queue();
}
+ if(home_z_first) home_xy();
+
// TODO should check that the endstops were hit and it did not stop short for some reason
// Move back a small distance for all homing axis
}
}
- THEROBOT->solo_move(delta, feed_rate);
+ THEROBOT->delta_move(delta, feed_rate, 3);
// wait until finished
THECONVEYOR->wait_for_empty_queue();
delta[c]= 0;
}
}
- THEROBOT->solo_move(delta, feed_rate);
+ THEROBOT->delta_move(delta, feed_rate, 3);
// wait until finished
THECONVEYOR->wait_for_empty_queue();