From d32575ee74181775f66d614f10a61a4d514f944f Mon Sep 17 00:00:00 2001 From: lujios <83166168+lujios@users.noreply.github.com> Date: Fri, 30 Apr 2021 11:38:30 +0200 Subject: [PATCH] Fix compile with DISTINCT_E_FACTORS + SLIM_LCD_MENUS (#21733) Co-authored-by: Scott Lahteine --- Marlin/src/lcd/menu/menu_advanced.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 463433685e..044797b749 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -350,16 +350,6 @@ void menu_backlash(); #if DISABLED(SLIM_LCD_MENUS) - #if ENABLED(DISTINCT_E_FACTORS) - inline void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) planner.reset_acceleration_rates(); } - inline void _planner_refresh_e_positioning(const uint8_t e) { - if (e == active_extruder) - planner.refresh_positioning(); - else - planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)]; - } - #endif - // M203 / M205 Velocity options void menu_advanced_velocity() { // M203 Max Feedrate @@ -443,7 +433,10 @@ void menu_backlash(); #if ENABLED(DISTINCT_E_FACTORS) EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); }); LOOP_L_N(n, E_STEPPERS) - EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{ _reset_e_acceleration_rate(MenuItemBase::itemIndex); }); + EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{ + if (MenuItemBase::itemIndex == active_extruder) + planner.reset_acceleration_rates(); + }); #elif E_STEPPERS EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); }); #endif @@ -530,7 +523,13 @@ void menu_advanced_steps_per_mm() { #if ENABLED(DISTINCT_E_FACTORS) LOOP_L_N(n, E_STEPPERS) - EDIT_ITEM_FAST_N(float51, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{ _planner_refresh_e_positioning(MenuItemBase::itemIndex); }); + EDIT_ITEM_FAST_N(float51, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{ + const uint8_t e = MenuItemBase::itemIndex; + if (e == active_extruder) + planner.refresh_positioning(); + else + planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)]; + }); #elif E_STEPPERS EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); }); #endif