Improved homing cycle. New settings: homing enable/rates, debounce and step idle lock time.

- Homing cycle will now cycle twice (spec more/less in config) to
improve repeatability and accuracy by decreasing overshoot.

- New Grbl settings added: Enable/disable homing cycles, homing seek
and feed rates, switch debounce delay, and stepper idle lock time.

- Please note that these settings may change upon the next push, since
there will be more added soon. Grbl *should* not re-write your old
settings, just re-write the new ones. So, make sure you keep these
written down somewhere in case they get lost from a code bug.

- Refactored settings migration to be a little smaller and managable
going forward.
This commit is contained in:
Sonny Jeon
2012-10-09 22:01:10 -06:00
parent 6506b7a338
commit 4c6f5bec48
8 changed files with 146 additions and 64 deletions

View File

@ -156,26 +156,28 @@ static void homing_cycle(bool x_axis, bool y_axis, bool z_axis, int8_t pos_dir,
}
}
static void approach_limit_switch(bool x, bool y, bool z)
{
homing_cycle(x, y, z, true, false, settings.default_seek_rate);
}
static void leave_limit_switch(bool x, bool y, bool z) {
homing_cycle(x, y, z, false, true, settings.default_feed_rate);
}
void limits_go_home()
{
plan_synchronize(); // Empty all motions in buffer.
// Jog all axes toward home to engage their limit switches.
approach_limit_switch(false, false, true); // First home the z axis
approach_limit_switch(true, true, false); // Then home the x and y axis
delay_ms(LIMIT_DEBOUNCE); // Delay to debounce signal before leaving limit switches
// Jog all axes toward home to engage their limit switches at faster homing seek rate.
homing_cycle(false, false, true, true, false, settings.homing_seek_rate); // First jog the z axis
homing_cycle(true, true, false, true, false, settings.homing_seek_rate); // Then jog the x and y axis
delay_ms(settings.homing_debounce_delay); // Delay to debounce signal
// Now carefully leave the limit switches
leave_limit_switch(true,true,true);
delay_ms(LIMIT_DEBOUNCE); // Delay to debounce signal before exiting routine
// Now in proximity of all limits. Carefully leave and approach switches in multiple cycles
// to precisely hone in on the machine zero location. Moves at slower homing feed rate.
int8_t n_cycle = N_HOMING_CYCLE;
while (n_cycle--) {
// Leave all switches to release them. After cycles complete, this is machine zero.
homing_cycle(true, true, true, false, true, settings.homing_feed_rate);
delay_ms(settings.homing_debounce_delay);
if (n_cycle > 0) {
// Re-approach all switches to re-engage them.
homing_cycle(true, true, true, true, false, settings.homing_feed_rate);
delay_ms(settings.homing_debounce_delay);
}
}
}