Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FT_MOTION : FT_MOTION Menu available when printing #26670

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c8304a9
FT_MOTION : FT_MOTION Menu available when printing
narno2202 Jan 13, 2024
cf9e64f
Typo error
narno2202 Jan 13, 2024
2161ddb
Typo again
narno2202 Jan 13, 2024
eacdee9
Remove intermediate variable
narno2202 Jan 14, 2024
5b1a84a
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jan 19, 2024
dc2bfc8
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jan 20, 2024
e4ebe8b
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Feb 10, 2024
14a407a
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 2, 2024
d5cdb53
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 4, 2024
912c2d9
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 13, 2024
f2e31e4
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 17, 2024
328cc37
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 22, 2024
92a9383
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Mar 28, 2024
04db9ce
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Apr 1, 2024
00dc983
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Apr 7, 2024
5856bd3
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 May 5, 2024
20f3a69
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jun 7, 2024
18997f0
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jun 16, 2024
5d2c142
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jul 2, 2024
4be0edb
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FT_MOTION_menu_printing
narno2202 Jul 13, 2024
a0e11a1
Merge branch 'bugfix-2.1.x' into pr/26670
thinkyhead Jul 15, 2024
3535cf7
merge followup
thinkyhead Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 54 additions & 34 deletions Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -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);
Expand All @@ -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();

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

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

Expand Down
Loading