Clean up and attempt to explain

This commit is contained in:
Scott Lahteine 2020-11-10 19:28:17 -06:00
parent 56dc2e89e5
commit edb797663a

View file

@ -51,51 +51,36 @@
/** /**
* G34: Z-Stepper automatic alignment * G34: Z-Stepper automatic alignment
* *
* L Unlock all
* Z<1-4> Set separate multi-axis and lock/unlock a Z stepper
*
* With Z_STEPPER_AUTO_ALIGN:
* I<iterations> * I<iterations>
* T<accuracy> * T<accuracy>
* A<amplification> * A<amplification> Provide an Amplification value
* R<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.seen('Z') ) if (parser.seenval('Z')) {
{
int zStepper;
bool state;
parser.intval('Z', zStepper);
parser.boolval('S', state);
stepper.set_separate_multi_axis(true); stepper.set_separate_multi_axis(true);
const bool state = parser.boolval('S');
switch(zStepper) switch (parser.intval('Z')) {
{ case 1: stepper.set_z1_lock(state); break;
case 1 : case 2: stepper.set_z2_lock(state); break;
stepper.set_z1_lock(state);
break;
case 2 :
stepper.set_z2_lock(state);
break;
#if NUM_Z_STEPPER_DRIVERS >= 3 #if NUM_Z_STEPPER_DRIVERS >= 3
case 3 : case 3: stepper.set_z3_lock(state); break;
stepper.set_z3_lock(state); #if NUM_Z_STEPPER_DRIVERS >= 4
break; case 4: stepper.set_z4_lock(state); break;
#if NUM_Z_STEPPER_DRIVERS >= 4 #endif
case 4 :
stepper.set_z4_lock(state);
break;
#endif #endif
default:
break;
#endif
} }
return; return;
} }
else if ( parser.seen('L') )
{ if (parser.seen('L')) {
stepper.set_all_z_lock(false); stepper.set_all_z_lock(false);
stepper.set_separate_multi_axis(false); stepper.set_separate_multi_axis(false);
return; return;
@ -451,7 +436,8 @@ void GcodeSuite::G34() {
}while(0); }while(0);
#endif #endif
} }
#endif // END Z_MULTI_ENDSTOPS or Z_STEPPER_AUTO_ALIGN
#endif // Z_MULTI_ENDSTOPS || Z_STEPPER_AUTO_ALIGN
#if ENABLED(Z_STEPPER_AUTO_ALIGN) #if ENABLED(Z_STEPPER_AUTO_ALIGN)