Skip to content

Commit

Permalink
🚸 Revert FT Motion tune menu
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 15, 2024
1 parent 5140726 commit ade05c0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 66 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HC32/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
88 changes: 33 additions & 55 deletions Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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();

//
Expand Down Expand Up @@ -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

//
Expand Down
8 changes: 0 additions & 8 deletions Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit ade05c0

Please sign in to comment.