🐛 Fix backlash applied steps when config changes (#23826)

Followup to #23814
This commit is contained in:
tombrazier
2022-03-01 22:14:52 +00:00
committed by Scott Lahteine
parent 2d648e4dd9
commit 41a51e9527
8 changed files with 167 additions and 117 deletions

View File

@@ -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();