0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-22 17:52:57 +00:00

🚸 FT_MOTION Menu available in situ (#26670)

This commit is contained in:
narno2202 2024-07-15 20:27:10 +02:00 committed by GitHub
parent f0bc4274f8
commit 170df9040b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 62 additions and 34 deletions

View file

@ -331,6 +331,36 @@ 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();
@ -391,40 +421,14 @@ void menu_move() {
void menu_ft_motion() {
ft_config_t &c = ftMotion.cfg;
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
ftm_menu_get_msg_strings();
START_MENU();
BACK_ITEM(MSG_MOTION);
bool show_state = ftMotion.cfg.active;
bool show_state = c.active;
EDIT_ITEM(bool, MSG_FIXED_TIME_MOTION, &show_state, []{
ftMotion.cfg.active ^= true;
c.active ^= true;
ftMotion.update_shaping_params();
});
@ -454,7 +458,7 @@ void menu_move() {
#if HAS_DYNAMIC_FREQ
SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode);
MENU_ITEM_ADDON_START_RJ(11); lcd_put_u8str(dmode); MENU_ITEM_ADDON_END();
MENU_ITEM_ADDON_START_RJ(dmode.length()); 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);
@ -473,12 +477,28 @@ void menu_move() {
END_MENU();
}
void menu_tune_ft_motion() {
ftm_menu_get_msg_strings();
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, &ftMotion.cfg.linearAdvEna);
#endif
END_MENU();
}
#endif // FT_MOTION_MENU
void menu_motion() {
#if ENABLED(FT_MOTION_MENU)
const bool is_busy = printer_busy();
#endif
START_MENU();
@ -509,7 +529,7 @@ void menu_motion() {
// M493 - Fixed-Time Motion
//
#if ENABLED(FT_MOTION_MENU)
if (!is_busy) SUBMENU(MSG_FIXED_TIME_MOTION, menu_ft_motion);
SUBMENU(MSG_FIXED_TIME_MOTION, menu_ft_motion);
#endif
//

View file

@ -231,6 +231,14 @@ 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();
}