Fix up some things
This commit is contained in:
parent
cddf64ad5e
commit
8f8df0204f
2 changed files with 32 additions and 31 deletions
|
|
@ -50,27 +50,35 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G34: Z-Stepper automatic alignment
|
* G34: Z-Stepper automatic alignment
|
||||||
* Manual stepper lock controls:
|
|
||||||
* L Unlock all
|
|
||||||
* Z<1-4> Select Z stepper to act on
|
|
||||||
* S<state> Boolean value for lock state to set
|
|
||||||
*
|
*
|
||||||
* Example G34Z1S1;G34Z2S1;G34Z3S0 to unlock only the 3rd Z stepper
|
* Manual stepper lock controls (reset by G28):
|
||||||
* Reset by G28
|
* L Unlock all steppers
|
||||||
|
* Z<1-4> Z stepper to lock / unlock
|
||||||
|
* S<state> 0=UNLOCKED 1=LOCKED. If omitted, assume LOCKED.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* G34 Z1 ; Lock Z1
|
||||||
|
* G34 L Z2 ; Unlock all, then lock Z2
|
||||||
|
* G34 Z2 S0 ; Unlock Z2
|
||||||
*
|
*
|
||||||
* With Z_STEPPER_AUTO_ALIGN:
|
* With Z_STEPPER_AUTO_ALIGN:
|
||||||
* I<iterations>
|
* I<iterations> Number of tests. If omitted, Z_STEPPER_ALIGN_ITERATIONS.
|
||||||
* T<accuracy>
|
* T<accuracy> Target Accuracy factor. If omitted, Z_STEPPER_ALIGN_ACC.
|
||||||
* A<amplification> Provide an Amplification value
|
* A<amplification> Provide an Amplification value. If omitted, Z_STEPPER_ALIGN_AMP.
|
||||||
* R Flag to recalculate points based on current probe offsets
|
* R Flag to recalculate points based on current probe offsets
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::G34() {
|
void GcodeSuite::G34() {
|
||||||
DEBUG_SECTION(log_G34, "G34", DEBUGGING(LEVELING));
|
DEBUG_SECTION(log_G34, "G34", DEBUGGING(LEVELING));
|
||||||
if (DEBUGGING(LEVELING)) log_machine_info();
|
if (DEBUGGING(LEVELING)) log_machine_info();
|
||||||
|
|
||||||
if (parser.seenval('Z')) {
|
planner.synchronize(); // Prevent damage
|
||||||
stepper.set_separate_multi_axis(true);
|
|
||||||
const bool state = parser.boolval('S');
|
const bool seenL = parser.seen('L');
|
||||||
|
if (seenL) stepper.set_all_z_lock(false);
|
||||||
|
|
||||||
|
const bool seenZ = parser.seenval('Z');
|
||||||
|
if (seenZ) {
|
||||||
|
const bool state = parser.boolval('S', true);
|
||||||
switch (parser.intval('Z')) {
|
switch (parser.intval('Z')) {
|
||||||
case 1: stepper.set_z1_lock(state); break;
|
case 1: stepper.set_z1_lock(state); break;
|
||||||
case 2: stepper.set_z2_lock(state); break;
|
case 2: stepper.set_z2_lock(state); break;
|
||||||
|
|
@ -81,12 +89,10 @@ void GcodeSuite::G34() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('L')) {
|
if (seenL || seenZ) {
|
||||||
stepper.set_all_z_lock(false);
|
stepper.set_separate_multi_axis(seenZ);
|
||||||
stepper.set_separate_multi_axis(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,24 +118,16 @@ void GcodeSuite::G34() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float z_auto_align_amplification =
|
const float z_auto_align_amplification = TERN(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS, Z_STEPPER_ALIGN_AMP, parser.floatval('A', Z_STEPPER_ALIGN_AMP));
|
||||||
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
if (!WITHIN(ABS(z_auto_align_amplification), 0.5f, 2.0f)) {
|
||||||
Z_STEPPER_ALIGN_AMP;
|
SERIAL_ECHOLNPGM("?(A)mplification out of bounds (0.5-2.0).");
|
||||||
#else
|
break;
|
||||||
parser.floatval('A', Z_STEPPER_ALIGN_AMP);
|
}
|
||||||
if (!WITHIN(ABS(z_auto_align_amplification), 0.5f, 2.0f)) {
|
|
||||||
SERIAL_ECHOLNPGM("?(A)mplification out of bounds (0.5-2.0).");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (parser.seen('R')) z_stepper_align.reset_to_default();
|
if (parser.seen('R')) z_stepper_align.reset_to_default();
|
||||||
|
|
||||||
const ProbePtRaise raise_after = parser.boolval('E') ? PROBE_PT_STOW : PROBE_PT_RAISE;
|
const ProbePtRaise raise_after = parser.boolval('E') ? PROBE_PT_STOW : PROBE_PT_RAISE;
|
||||||
|
|
||||||
// Wait for planner moves to finish!
|
|
||||||
planner.synchronize();
|
|
||||||
|
|
||||||
// Disable the leveling matrix before auto-aligning
|
// Disable the leveling matrix before auto-aligning
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING
|
||||||
TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active);
|
TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active);
|
||||||
|
|
|
||||||
|
|
@ -2785,8 +2785,11 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||||
#error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1."
|
#error "Z_STEPPER_AUTO_ALIGN requires NUM_Z_STEPPER_DRIVERS greater than 1."
|
||||||
#elif !HAS_BED_PROBE
|
#elif !HAS_BED_PROBE
|
||||||
#error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe."
|
#error "Z_STEPPER_AUTO_ALIGN requires a Z-bed probe."
|
||||||
#elif ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) && NUM_Z_STEPPER_DRIVERS < 3
|
#elif ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
|
||||||
#error "Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS requires NUM_Z_STEPPER_DRIVERS to be 3 or 4."
|
static_assert(WITHIN(Z_STEPPER_ALIGN_AMP, 0.5, 2.0), "Z_STEPPER_ALIGN_AMP must be between 0.5 and 2.0.");
|
||||||
|
#if NUM_Z_STEPPER_DRIVERS < 3
|
||||||
|
#error "Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS requires NUM_Z_STEPPER_DRIVERS to be 3 or 4."
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue