gamma_min 0 #
gamma_max 200 #
+# optional order in which axis will home, default is they all home at the same time,
+# if this is set it will force each axis to home one at a time in the specified order
+#homing_order XYZ # x axis followed by y then z last
+
# optional enable limit switches, actions will stop if any enabled limit switch is triggered
#alpha_limit_enable false # set to true to enable X min and max limit switches
#beta_limit_enable false # set to true to enable Y min and max limit switches
#include "StreamOutputPool.h"
#include "Pauser.h"
+#include <ctype.h>
+
#define ALPHA_AXIS 0
#define BETA_AXIS 1
#define GAMMA_AXIS 2
#define beta_limit_enable_checksum CHECKSUM("beta_limit_enable")
#define gamma_limit_enable_checksum CHECKSUM("gamma_limit_enable")
+#define homing_order_checksum CHECKSUM("homing_order")
+
#define STEPPER THEKERNEL->robot->actuators
#define STEPS_PER_MM(a) (STEPPER[a]->get_steps_per_mm())
this->is_corexy = THEKERNEL->config->value(corexy_homing_checksum)->by_default(false)->as_bool();
this->is_delta = THEKERNEL->config->value(delta_homing_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;
+ if(order.size() == 3 && !this->is_delta) {
+ int shift= 0;
+ for(auto c : order) {
+ uint8_t i= toupper(c) - 'X';
+ if(i > 2) { // bad value
+ this->homing_order= 0;
+ break;
+ }
+ homing_order |= (i << shift);
+ shift += 2;
+ }
+ }
+
// endstop trim used by deltas to do soft adjusting
// on a delta homing to max, a negative trim value will move the carriage down, and a positive will move it up
this->trim_mm[0] = THEKERNEL->config->value(alpha_trim_checksum )->by_default(0 )->as_number();
}
}
-// this homing works for cartesian and delta printers, not for HBots/CoreXY
void Endstops::do_homing(char axes_to_move)
{
+ if (is_corexy){
+ // do corexy/HBot homing
+ do_homing_corexy(axes_to_move);
+ return;
+ }
+
+ // this homing works for cartesian and delta printers
// Start moving the axes to the origin
this->status = MOVING_TO_ORIGIN_FAST;
for ( int c = X_AXIS; c <= Z_AXIS; c++ ) {
THEKERNEL->stepper->turn_enable_pins_on();
// do the actual homing
- if (is_corexy)
- do_homing_corexy(axes_to_move);
- else
+ if(homing_order != 0){
+ // if an order has been specified do it in the specified order
+ // homing order is 0b00ccbbaa where aa is 0,1,2 to specify the first axis, bb is the second and cc is the third
+ // eg 0b00100001 would be Y X Z, 0b00100100 would be X Y Z
+ for (uint8_t m = homing_order; m != 0; m >>= 2) {
+ int a= (1 << (m & 0x03)); // axis to move
+ if((a & axes_to_move) != 0)
+ do_homing(a);
+ }
+ }else {
+ // they all home at the same time
do_homing(axes_to_move);
+ }
// Zero the ax(i/e)s position, add in the home offset
for ( int c = X_AXIS; c <= Z_AXIS; c++ ) {