Skip to content

Commit dc59a81

Browse files
committed
WIP
1 parent c45354a commit dc59a81

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

Marlin/Configuration_adv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,12 +1156,12 @@
11561156
* Enable/disable and set parameters with G-code M493 and M494.
11571157
* See ft_types.h for named values used by FTM options.
11581158
*/
1159-
//#define FT_MOTION
1159+
#define FT_MOTION
11601160
#if ENABLED(FT_MOTION)
1161-
//#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default?
1162-
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 and M494 parameters
1161+
#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default?
1162+
#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 and M494 parameters
11631163

1164-
//#define NO_STANDARD_MOTION // Disable the standard motion system entirely to save Flash and RAM
1164+
#define NO_STANDARD_MOTION // Disable the standard motion system entirely to save Flash and RAM
11651165
#if DISABLED(NO_STANDARD_MOTION)
11661166
//#define FTM_HOME_AND_PROBE // Use FT Motion for homing / probing. Disable if FT Motion breaks these functions.
11671167
#endif
@@ -1197,7 +1197,7 @@
11971197
#define FTM_SHAPING_ZETA_Z 0.03f // Zeta used by input shapers for Z axis
11981198
#define FTM_SHAPING_V_TOL_Z 0.05f // Vibration tolerance used by EI input shapers for Z axis
11991199

1200-
//#define FTM_SHAPER_E // Include E shaping support
1200+
#define FTM_SHAPER_E // Include E shaping support
12011201
// Required to synchronize extruder with XYZ (better quality)
12021202
#define FTM_DEFAULT_SHAPER_E ftMotionShaper_NONE // Default shaper mode on Extruder axis
12031203
#define FTM_SHAPING_DEFAULT_FREQ_E 21.0f // (Hz) Default peak frequency used by input shapers

Marlin/src/inc/SanityCheck.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4495,9 +4495,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive."
44954495
#error "EMERGENCY_PARSER is required with FTM_RESONANCE_TEST (to cancel the test)."
44964496
#endif
44974497
#if !HAS_STANDARD_MOTION
4498-
#if ENABLED(NONLINEAR_EXTRUSION)
4499-
#error "NONLINEAR_EXTRUSION is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
4500-
#elif ENABLED(SMOOTH_LIN_ADVANCE)
4498+
#if ENABLED(SMOOTH_LIN_ADVANCE)
45014499
#error "SMOOTH_LIN_ADVANCE is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."
45024500
#elif ENABLED(MIXING_EXTRUDER)
45034501
#error "MIXING_EXTRUDER is not yet available in FT_MOTION. Disable NO_STANDARD_MOTION if you require it."

Marlin/src/inc/Warnings.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,9 +941,6 @@
941941
#if ENABLED(I2S_STEPPER_STREAM)
942942
#warning "FT_MOTION has not been tested with I2S_STEPPER_STREAM."
943943
#endif
944-
#if ENABLED(NONLINEAR_EXTRUSION)
945-
#warning "NONLINEAR_EXTRUSION does not (currently) operate when FT_MOTION is the active motion system."
946-
#endif
947944
#if ENABLED(LIN_ADVANCE)
948945
#warning "Be aware that FT_MOTION K factor is now set with M900 K (same as LIN_ADVANCE)."
949946
#if DISABLED(FTM_SMOOTHING)

Marlin/src/lcd/menu/menu_media.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void menu_file_selector_sd() {
110110
card.release();
111111
card.selectMediaSDCard();
112112
}
113+
if (card.isSDCardMounted()) card.release();
113114
if (!card.isSDCardMounted()) card.mount();
114115
ui.goto_screen(menu_file_selector);
115116
}

Marlin/src/module/ft_motion.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,30 @@ xyze_float_t FTMotion::calc_traj_point(const float dist) {
470470
if (advK) {
471471
const float traj_e = traj_coords.e;
472472
if (use_advance_lead) {
473-
// Don't apply LA to retract/unretract blocks
473+
// Apply LA only to printing (not retract/unretract) blocks
474474
const float e_rate = (traj_e - prev_traj_e) * (FTM_FS);
475475
traj_coords.e += e_rate * advK;
476+
477+
#if ENABLED(NONLINEAR_EXTRUSION)
478+
if (stepper.ne.settings.enabled) {
479+
const float v = abs(e_rate); // extruder velocity in mm/s
480+
const float multiplier = 1.5;//max(stepper.ne.settings.coeff.C, stepper.ne.settings.coeff.A * sq(v) + stepper.ne.settings.coeff.B * v + stepper.ne.settings.coeff.C);
481+
const float nle_term = abs(traj_e - prev_traj_e) * (multiplier - 1);
482+
483+
const float traj_delta = traj_e - prev_traj_e;
484+
static uint64_t ticks = 0;
485+
486+
if (ticks++ % 1000 == 0) {
487+
SERIAL_ECHOLNPGM("traj_e ", traj_e, ", prev_traj_e", prev_traj_e, ", traj_delta ", traj_delta, ", e_rate ", e_rate, ", nle_term ", nle_term);
488+
SERIAL_ECHOLNPGM("startPos.e ", startPos.e, ", endPos_prevBlock.e ", endPos_prevBlock.e);
489+
}
490+
491+
traj_coords.e += nle_term;
492+
prev_traj_e = traj_e + nle_term;
493+
startPos.e += nle_term;
494+
endPos_prevBlock.e += nle_term;
495+
}
496+
#endif
476497
}
477498
prev_traj_e = traj_e;
478499
}

0 commit comments

Comments
 (0)