#define gamma_homing_retract_mm_checksum CHECKSUM("gamma_homing_retract_mm")
#define endstop_debounce_count_checksum CHECKSUM("endstop_debounce_count")
+#define endstop_debounce_ms_checksum CHECKSUM("endstop_debounce_ms")
#define alpha_homing_direction_checksum CHECKSUM("alpha_homing_direction")
#define beta_homing_direction_checksum CHECKSUM("beta_homing_direction")
this->retract_mm[1] = THEKERNEL->config->value(beta_homing_retract_mm_checksum )->by_default(this->retract_mm[1])->as_number();
this->retract_mm[2] = THEKERNEL->config->value(gamma_homing_retract_mm_checksum )->by_default(this->retract_mm[2])->as_number();
+ // NOTE the debouce count is in milliseconds so probably does not need to beset anymore
+ this->debounce_ms = THEKERNEL->config->value(endstop_debounce_ms_checksum )->by_default(0)->as_number();
this->debounce_count = THEKERNEL->config->value(endstop_debounce_count_checksum )->by_default(100)->as_number();
// get homing direction and convert to boolean where true is home to min, and false is home to max
if(STEPPER[m]->is_moving()) {
// if it is moving then we check the associated endstop, and debounce it
if(this->pins[m + (this->home_direction[m] ? 0 : 3)].get()) {
- if(debounce[m] < debounce_count) {
+ if(debounce[m] < debounce_ms) {
debounce[m]++;
} else {
// we signal the motor to stop, which will preempt any moves on that axis
for ( int m = X_AXIS; m <= Z_AXIS; m++ ) {
if(axis_to_home[m]) {
if(this->pins[m + (this->home_direction[m] ? 0 : 3)].get()) {
- if(debounce[m] < debounce_count) {
+ if(debounce[m] < debounce_ms) {
debounce[m]++;
} else {
// we signal all the motors to stop, as on corexy X and Y motors will move for X and Y axis homing and we only hom eone axis at a time
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, beta_max, 0};
+ 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]);
} else if(axis_to_home[X_AXIS]) {
// now home X only
- float delta[3] {alpha_max, 0, 0};
+ 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]);
// wait for X
} else if(axis_to_home[Y_AXIS]) {
// now home Y only
- float delta[3] {0, beta_max, 0};
+ 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]);
// wait for Y
if(axis_to_home[Z_AXIS]) {
// now home z
- float delta[3] {0, 0, gamma_max};
+ 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]);
// wait for Z
#define enable_checksum CHECKSUM("enable")
#define probe_pin_checksum CHECKSUM("probe_pin")
-#define debounce_count_checksum CHECKSUM("debounce_count")
+#define debounce_ms_checksum CHECKSUM("debounce_ms")
#define slow_feedrate_checksum CHECKSUM("slow_feedrate")
#define fast_feedrate_checksum CHECKSUM("fast_feedrate")
#define return_feedrate_checksum CHECKSUM("return_feedrate")
void ZProbe::config_load(void *argument)
{
this->pin.from_string( THEKERNEL->config->value(zprobe_checksum, probe_pin_checksum)->by_default("nc" )->as_string())->as_input();
- this->debounce_count = THEKERNEL->config->value(zprobe_checksum, debounce_count_checksum)->by_default(0 )->as_number();
+ this->debounce_ms = THEKERNEL->config->value(zprobe_checksum, debounce_ms_checksum)->by_default(0 )->as_number();
// get strategies to load
vector<uint16_t> modules;
if(STEPPER[Z_AXIS]->is_moving()) {
// if it is moving then we check the probe, and debounce it
if(this->pin.get()) {
- if(debounce < debounce_count) {
+ if(debounce < debounce_ms) {
debounce++;
} else {
// we signal the motors to stop, which will preempt any moves on that axis
};
// move Z down
+ THEROBOT->disable_segmentation= true; // we must disable segmentation as this won't work with it enabled
bool dir= (!reverse_z != reverse); // xor
float delta[3]= {0,0,0};
- delta[Z_AXIS]= dir ? maxz : -maxz;
+ delta[Z_AXIS]= dir ? -maxz : maxz;
THEROBOT->solo_move(delta, feedrate);
// wait until finished
THECONVEYOR->wait_for_empty_queue();
+ THEROBOT->disable_segmentation= false;
// now see how far we moved, get delta in z we moved
mm= start_pos[2] - THEROBOT->actuators[2]->get_current_position();
mm,
probe_detected?1:0));
+ probing= false;
+
+ if(probe_detected) {
+ // if the probe stopped the move we need to correct the last_milestone as it did not reach where it thought
+ THEROBOT->reset_position_from_current_actuator_position();
+ }
return probe_detected;
}
if(reverse) dir= !dir;
float delta[3]= {0,0,0};
- delta[Z_AXIS]= dir ? mm : -mm;
+ delta[Z_AXIS]= dir ? -mm : mm;
THEROBOT->solo_move(delta, fr);
// wait until finished
// first wait for an empty queue i.e. no moves left
THEKERNEL->conveyor->wait_for_empty_queue();
- float mm;
bool probe_result;
bool reverse= (gcode->has_letter('R') && gcode->get_value('R') != 0); // specify to probe in reverse direction
float rate= gcode->has_letter('F') ? gcode->get_value('F') / 60 : this->slow_feedrate;
+ float mm;
probe_result = run_probe(mm, rate, -1, reverse);
if(probe_result) {