🐛 Fix backlash applied steps when config changes (#23826)
Followup to #23814
This commit is contained in:
committed by
Scott Lahteine
parent
2d648e4dd9
commit
41a51e9527
@ -861,16 +861,16 @@ namespace ExtUI {
|
||||
#endif
|
||||
|
||||
#if ENABLED(BACKLASH_GCODE)
|
||||
float getAxisBacklash_mm(const axis_t axis) { return backlash.distance_mm[axis]; }
|
||||
float getAxisBacklash_mm(const axis_t axis) { return backlash.get_distance_mm((AxisEnum)axis); }
|
||||
void setAxisBacklash_mm(const_float_t value, const axis_t axis)
|
||||
{ backlash.distance_mm[axis] = constrain(value,0,5); }
|
||||
{ backlash.set_distance_mm((AxisEnum)axis, constrain(value,0,5)); }
|
||||
|
||||
float getBacklashCorrection_percent() { return ui8_to_percent(backlash.correction); }
|
||||
void setBacklashCorrection_percent(const_float_t value) { backlash.correction = map(constrain(value, 0, 100), 0, 100, 0, 255); }
|
||||
float getBacklashCorrection_percent() { return backlash.get_correction() * 100.0f; }
|
||||
void setBacklashCorrection_percent(const_float_t value) { backlash.set_correction(constrain(value, 0, 100) / 100.0f); }
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
float getBacklashSmoothing_mm() { return backlash.smoothing_mm; }
|
||||
void setBacklashSmoothing_mm(const_float_t value) { backlash.smoothing_mm = constrain(value, 0, 999); }
|
||||
float getBacklashSmoothing_mm() { return backlash.get_smoothing_mm(); }
|
||||
void setBacklashSmoothing_mm(const_float_t value) { backlash.set_smoothing_mm(constrain(value, 0, 999)); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -36,14 +36,20 @@ void menu_backlash() {
|
||||
START_MENU();
|
||||
BACK_ITEM(MSG_MAIN);
|
||||
|
||||
EDIT_ITEM_FAST(percent, MSG_BACKLASH_CORRECTION, &backlash.correction, all_off, all_on);
|
||||
editable.uint8 = backlash.get_correction_uint8();
|
||||
EDIT_ITEM_FAST(percent, MSG_BACKLASH_CORRECTION, &editable.uint8, backlash.all_off, backlash.all_on, []{ backlash.set_correction_uint8(editable.uint8); });
|
||||
|
||||
#if DISABLED(CORE_BACKLASH) || EITHER(MARKFORGED_XY, MARKFORGED_YX)
|
||||
#define _CAN_CALI AXIS_CAN_CALIBRATE
|
||||
#else
|
||||
#define _CAN_CALI(A) true
|
||||
#endif
|
||||
#define EDIT_BACKLASH_DISTANCE(N) EDIT_ITEM_FAST(float43, MSG_BACKLASH_##N, &backlash.distance_mm[_AXIS(N)], 0.0f, 9.9f);
|
||||
|
||||
#define EDIT_BACKLASH_DISTANCE(N) do { \
|
||||
editable.decimal = backlash.get_distance_mm(_AXIS(N)); \
|
||||
EDIT_ITEM_FAST(float43, MSG_BACKLASH_##N, &editable.decimal, 0.0f, 9.9f, []{ backlash.set_distance_mm(_AXIS(N), editable.decimal); }); \
|
||||
} while (0);
|
||||
|
||||
if (_CAN_CALI(A)) EDIT_BACKLASH_DISTANCE(A);
|
||||
#if HAS_Y_AXIS && _CAN_CALI(B)
|
||||
EDIT_BACKLASH_DISTANCE(B);
|
||||
@ -62,7 +68,8 @@ void menu_backlash() {
|
||||
#endif
|
||||
|
||||
#ifdef BACKLASH_SMOOTHING_MM
|
||||
EDIT_ITEM_FAST(float43, MSG_BACKLASH_SMOOTHING, &backlash.smoothing_mm, 0.0f, 9.9f);
|
||||
editable.decimal = backlash.get_smoothing_mm();
|
||||
EDIT_ITEM_FAST(float43, MSG_BACKLASH_SMOOTHING, &editable.decimal, 0.0f, 9.9f, []{ backlash.set_smoothing_mm(editable.decimal); });
|
||||
#endif
|
||||
|
||||
END_MENU();
|
||||
|
Reference in New Issue
Block a user