🐛 Fix BACKLASH_COMPENSATION compile (#24072)

Followup to #23826
This commit is contained in:
ellensp 2022-04-23 21:16:15 +12:00 committed by Scott Lahteine
parent fd13a928c1
commit d58497bc8e

View File

@ -162,32 +162,37 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
} }
class Backlash::StepAdjuster { class Backlash::StepAdjuster {
xyz_long_t applied_steps; private:
public: xyz_long_t applied_steps;
StepAdjuster() { public:
LOOP_NUM_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis); StepAdjuster() {
} LOOP_NUM_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis);
~StepAdjuster() { }
// after backlash compensation parameter changes, ensure applied step count does not change ~StepAdjuster() {
LOOP_NUM_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis]; // after backlash compensation parameter changes, ensure applied step count does not change
} LOOP_NUM_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis];
}
}; };
void Backlash::set_correction_uint8(const uint8_t v) { #if ENABLED(BACKLASH_GCODE)
StepAdjuster adjuster;
correction = v;
}
void Backlash::set_distance_mm(const AxisEnum axis, const float v) { void Backlash::set_correction_uint8(const uint8_t v) {
StepAdjuster adjuster;
distance_mm[axis] = v;
}
#ifdef BACKLASH_SMOOTHING_MM
void Backlash::set_smoothing_mm(const float v) {
StepAdjuster adjuster; StepAdjuster adjuster;
smoothing_mm = v; correction = v;
} }
void Backlash::set_distance_mm(const AxisEnum axis, const float v) {
StepAdjuster adjuster;
distance_mm[axis] = v;
}
#ifdef BACKLASH_SMOOTHING_MM
void Backlash::set_smoothing_mm(const float v) {
StepAdjuster adjuster;
smoothing_mm = v;
}
#endif
#endif #endif
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)