From ade05c045ef13f0f8a557ef0588a6ac6a80a1ab1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 15 Jul 2024 15:23:47 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Revert=20FT=20Motion=20tune=20me?= =?UTF-8?q?nu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/HC32/pinsDebug.h | 2 +- Marlin/src/HAL/STM32/pinsDebug.h | 2 +- Marlin/src/HAL/STM32F1/pinsDebug.h | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 88 +++++++++++------------------ Marlin/src/lcd/menu/menu_tune.cpp | 8 --- 5 files changed, 36 insertions(+), 66 deletions(-) diff --git a/Marlin/src/HAL/HC32/pinsDebug.h b/Marlin/src/HAL/HC32/pinsDebug.h index 70789701ba6e..c00ddf3ba252 100644 --- a/Marlin/src/HAL/HC32/pinsDebug.h +++ b/Marlin/src/HAL/HC32/pinsDebug.h @@ -71,7 +71,7 @@ #define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q)) #endif -static pin_t digitalPinToAnalogIndex(pin_t pin) { +static int8_t digitalPinToAnalogIndex(pin_t pin) { if (!isValidPin(pin)) return -1; const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel); return pin_t(adc_channel); diff --git a/Marlin/src/HAL/STM32/pinsDebug.h b/Marlin/src/HAL/STM32/pinsDebug.h index 6813a856caa8..cce705410c72 100644 --- a/Marlin/src/HAL/STM32/pinsDebug.h +++ b/Marlin/src/HAL/STM32/pinsDebug.h @@ -173,7 +173,7 @@ int8_t digital_pin_to_analog_pin(const pin_t Ard_num) { if (WITHIN(Ard_num, NUM_ANALOG_FIRST, NUM_ANALOG_LAST)) return Ard_num - NUM_ANALOG_FIRST; - const uint32_t ind = digitalPinToAnalogIndex(Ard_num); + const int8_t ind = digitalPinToAnalogIndex(Ard_num); return (ind < NUM_ANALOG_INPUTS) ? ind : -1; } diff --git a/Marlin/src/HAL/STM32F1/pinsDebug.h b/Marlin/src/HAL/STM32F1/pinsDebug.h index 448d974deca9..ab8bc8816eae 100644 --- a/Marlin/src/HAL/STM32F1/pinsDebug.h +++ b/Marlin/src/HAL/STM32F1/pinsDebug.h @@ -54,7 +54,7 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS]; int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? _GET_MODE(pin) : -1; } -pin_t digitalPinToAnalogIndex(const pin_t pin) { +int8_t digitalPinToAnalogIndex(const pin_t pin) { if (!isValidPin(pin)) return -1; pin_t adc_channel = pin_t(PIN_MAP[pin].adc_channel); #ifdef NUM_ANALOG_INPUTS diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index c09ab04c5e7d..0460949d56d0 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -331,36 +331,6 @@ void menu_move() { ui.go_back(); } - TString ftmode(5), dmode(10); - - void ftm_menu_get_msg_strings() { - ft_config_t &c = ftMotion.cfg; - - switch (c.mode) { - default: - case ftMotionMode_DISABLED: ftmode = GET_TEXT_F(MSG_LCD_OFF); break; - case ftMotionMode_ENABLED: ftmode = GET_TEXT_F(MSG_LCD_ON); break; - case ftMotionMode_ZV: ftmode = GET_TEXT_F(MSG_FTM_ZV); break; - case ftMotionMode_ZVD: ftmode = GET_TEXT_F(MSG_FTM_ZVD); break; - case ftMotionMode_ZVDD: ftmode = GET_TEXT_F(MSG_FTM_ZVDD); break; - case ftMotionMode_ZVDDD: ftmode = GET_TEXT_F(MSG_FTM_ZVDDD);break; - case ftMotionMode_EI: ftmode = GET_TEXT_F(MSG_FTM_EI); break; - case ftMotionMode_2HEI: ftmode = GET_TEXT_F(MSG_FTM_2HEI); break; - case ftMotionMode_3HEI: ftmode = GET_TEXT_F(MSG_FTM_3HEI); break; - case ftMotionMode_MZV: ftmode = GET_TEXT_F(MSG_FTM_MZV); break; - } - - #if HAS_DYNAMIC_FREQ - switch (c.dynFreqMode) { - default: - case dynFreqMode_DISABLED: dmode = GET_TEXT_F(MSG_LCD_OFF); break; - case dynFreqMode_Z_BASED: dmode = GET_TEXT_F(MSG_FTM_Z_BASED); break; - case dynFreqMode_MASS_BASED: dmode = GET_TEXT_F(MSG_FTM_MASS_BASED); break; - } - #endif - - } - inline void menu_ftm_cmpn_x() { const ftMotionShaper_t shaper = ftMotion.cfg.shaper[X_AXIS]; START_MENU(); @@ -421,7 +391,33 @@ void menu_move() { void menu_ft_motion() { ft_config_t &c = ftMotion.cfg; - ftm_menu_get_msg_strings(); + FSTR_P ftshaper[1 + ENABLED(HAS_Y_AXIS)] {}; + + #if HAS_X_AXIS + for (uint_fast8_t a = X_AXIS; a <= TERN(HAS_Y_AXIS, Y_AXIS, X_AXIS); ++a) { + switch (c.shaper[a]) { + case ftMotionShaper_NONE: ftshaper[a] = GET_TEXT_F(MSG_LCD_OFF); break; + case ftMotionShaper_ZV: ftshaper[a] = GET_TEXT_F(MSG_FTM_ZV); break; + case ftMotionShaper_ZVD: ftshaper[a] = GET_TEXT_F(MSG_FTM_ZVD); break; + case ftMotionShaper_ZVDD: ftshaper[a] = GET_TEXT_F(MSG_FTM_ZVDD); break; + case ftMotionShaper_ZVDDD: ftshaper[a] = GET_TEXT_F(MSG_FTM_ZVDDD);break; + case ftMotionShaper_EI: ftshaper[a] = GET_TEXT_F(MSG_FTM_EI); break; + case ftMotionShaper_2HEI: ftshaper[a] = GET_TEXT_F(MSG_FTM_2HEI); break; + case ftMotionShaper_3HEI: ftshaper[a] = GET_TEXT_F(MSG_FTM_3HEI); break; + case ftMotionShaper_MZV: ftshaper[a] = GET_TEXT_F(MSG_FTM_MZV); break; + } + } + #endif + + #if HAS_DYNAMIC_FREQ + FSTR_P dmode; + switch (c.dynFreqMode) { + default: + case dynFreqMode_DISABLED: dmode = GET_TEXT_F(MSG_LCD_OFF); break; + case dynFreqMode_Z_BASED: dmode = GET_TEXT_F(MSG_FTM_Z_BASED); break; + case dynFreqMode_MASS_BASED: dmode = GET_TEXT_F(MSG_FTM_MASS_BASED); break; + } + #endif START_MENU(); BACK_ITEM(MSG_MOTION); @@ -458,7 +454,7 @@ void menu_move() { #if HAS_DYNAMIC_FREQ SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); - MENU_ITEM_ADDON_START_RJ(dmode.length()); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); + MENU_ITEM_ADDON_START_RJ(11); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); if (c.dynFreqMode != dynFreqMode_DISABLED) { #if HAS_X_AXIS EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_DFREQ_K_N, &c.dynFreqK[X_AXIS], 0.0f, 20.0f); @@ -477,32 +473,14 @@ void menu_move() { END_MENU(); } - void menu_tune_ft_motion() { - - ftm_menu_get_msg_strings(); - - ft_config_t &c = ftMotion.cfg; - - START_MENU(); - SUBMENU(MSG_FTM_MODE, menu_ftm_mode); - MENU_ITEM_ADDON_START_RJ(ftmode.length()); lcd_put_u8str(ftmode); MENU_ITEM_ADDON_END(); - #if HAS_DYNAMIC_FREQ - SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); - MENU_ITEM_ADDON_START_RJ(dmode.length()); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END(); - #endif - #if HAS_EXTRUDERS - EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna); - if (c.linearAdvEna) EDIT_ITEM(float62, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 1000.0f); - #endif - - END_MENU(); - - } - #endif // FT_MOTION_MENU void menu_motion() { + #if ENABLED(FT_MOTION_MENU) + const bool is_busy = printer_busy(); + #endif + START_MENU(); // @@ -532,7 +510,7 @@ void menu_motion() { // M493 - Fixed-Time Motion // #if ENABLED(FT_MOTION_MENU) - SUBMENU(MSG_FIXED_TIME_MOTION, menu_ft_motion); + if (!is_busy) SUBMENU(MSG_FIXED_TIME_MOTION, menu_ft_motion); #endif // diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 22d412bac63f..68f61caaec77 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -231,14 +231,6 @@ void menu_tune() { #endif #endif - // - // FT_MOTION - // - #if ENABLED(FT_MOTION_MENU) - extern void menu_tune_ft_motion(); - SUBMENU(MSG_FIXED_TIME_MOTION, menu_tune_ft_motion); - #endif - END_MENU(); }