Skip to content

Commit b0509c9

Browse files
committed
⚡️ FT_MOTION improvements
MarlinFirmware/Marlin#26074
1 parent aeac179 commit b0509c9

File tree

354 files changed

+18408
-11328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+18408
-11328
lines changed

config/default/Configuration_adv.h

+52-32
Original file line numberDiff line numberDiff line change
@@ -1121,42 +1121,62 @@
11211121
#if ENABLED(FT_MOTION)
11221122
#define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h)
11231123
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h)
1124-
#define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers.
1125-
#define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers.
1126-
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false).
1127-
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain.
1128-
#define FTM_SHAPING_ZETA 0.1f // Zeta used by input shapers.
1129-
#define FTM_SHAPING_V_TOL 0.05f // Vibration tolerance used by EI input shapers.
1124+
#define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
1125+
#define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
1126+
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
1127+
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain
1128+
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
1129+
#define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
1130+
1131+
#define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis
1132+
#define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis
1133+
1134+
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters
11301135

11311136
/**
11321137
* Advanced configuration
11331138
*/
1134-
#define FTM_BATCH_SIZE 100 // Batch size for trajectory generation;
1135-
#define FTM_WINDOW_SIZE 200 // Window size for trajectory generation.
1136-
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS)
1137-
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS)
1138-
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update.
1139-
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps.
1140-
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency.
1141-
#define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!).
1142-
// Calculate as:
1143-
// 1/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZV.
1144-
// (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZVD, MZV.
1145-
// 3/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 2HEI.
1146-
// 2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 3HEI.
1147-
#define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time.
1148-
// Calculate as (FTM_STEPPER_FS / FTM_FS).
1149-
#define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm.
1150-
// Calculate as (FTM_STEPS_PER_UNIT_TIME / 2).
1151-
// These values may be configured to adjust duration of loop().
1152-
#define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop().
1153-
#define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop().
1154-
1155-
// This value may be configured to adjust duration to consume the command buffer.
1156-
// Try increasing this value if stepper motion is not smooth.
1157-
#define FTM_STEPPERCMD_BUFF_SIZE 1000 // Size of the stepper command buffers.
1158-
1159-
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters.
1139+
#define FTM_UNIFIED_BWS // DON'T DISABLE unless you use Ulendo FBS (not implemented)
1140+
#if ENABLED(FTM_UNIFIED_BWS)
1141+
#define FTM_BW_SIZE 100 // Unified Window and Batch size with a ratio of 2
1142+
#else
1143+
#define FTM_WINDOW_SIZE 200 // Custom Window size for trajectory generation needed by Ulendo FBS
1144+
#define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS
1145+
#endif
1146+
1147+
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
1148+
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS)
1149+
1150+
// These values may be configured to adjust the duration of loop().
1151+
#define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop()
1152+
#define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop()
1153+
1154+
#if DISABLED(COREXY)
1155+
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
1156+
1157+
// Use this to adjust the time required to consume the command buffer.
1158+
// Try increasing this value if stepper motion is choppy.
1159+
#define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers
1160+
// (FTM_STEPS_PER_LOOP * FTM_POINTS_PER_LOOP) is a good start
1161+
// If you run out of memory, fall back to 3000 and increase progressively
1162+
#else
1163+
// CoreXY motion needs a larger buffer size. These values are based on our testing.
1164+
#define FTM_STEPPER_FS 30000
1165+
#define FTM_STEPPERCMD_BUFF_SIZE 6000
1166+
#endif
1167+
1168+
#define FTM_STEPS_PER_UNIT_TIME (FTM_STEPPER_FS / FTM_FS) // Interpolated stepper commands per unit time
1169+
#define FTM_CTS_COMPARE_VAL (FTM_STEPS_PER_UNIT_TIME / 2) // Comparison value used in interpolation algorithm
1170+
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps
1171+
1172+
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency
1173+
#define FTM_RATIO (FTM_FS / FTM_MIN_SHAPE_FREQ) // Factor for use in FTM_ZMAX. DON'T CHANGE.
1174+
#define FTM_ZMAX (FTM_RATIO * 2) // Maximum delays for shaping functions (even numbers only!)
1175+
// Calculate as:
1176+
// ZV : FTM_RATIO / 2
1177+
// ZVD, MZV : FTM_RATIO
1178+
// 2HEI : FTM_RATIO * 3 / 2
1179+
// 3HEI : FTM_RATIO * 2
11601180
#endif
11611181

11621182
/**

config/examples/3DFabXYZ/Migbot/Configuration_adv.h

+52-32
Original file line numberDiff line numberDiff line change
@@ -1121,42 +1121,62 @@
11211121
#if ENABLED(FT_MOTION)
11221122
#define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h)
11231123
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h)
1124-
#define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers.
1125-
#define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers.
1126-
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false).
1127-
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain.
1128-
#define FTM_SHAPING_ZETA 0.1f // Zeta used by input shapers.
1129-
#define FTM_SHAPING_V_TOL 0.05f // Vibration tolerance used by EI input shapers.
1124+
#define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
1125+
#define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers
1126+
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
1127+
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain
1128+
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
1129+
#define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
1130+
1131+
#define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis
1132+
#define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis
1133+
1134+
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters
11301135

11311136
/**
11321137
* Advanced configuration
11331138
*/
1134-
#define FTM_BATCH_SIZE 100 // Batch size for trajectory generation;
1135-
#define FTM_WINDOW_SIZE 200 // Window size for trajectory generation.
1136-
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS)
1137-
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS)
1138-
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update.
1139-
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps.
1140-
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency.
1141-
#define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!).
1142-
// Calculate as:
1143-
// 1/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZV.
1144-
// (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZVD, MZV.
1145-
// 3/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 2HEI.
1146-
// 2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 3HEI.
1147-
#define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time.
1148-
// Calculate as (FTM_STEPPER_FS / FTM_FS).
1149-
#define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm.
1150-
// Calculate as (FTM_STEPS_PER_UNIT_TIME / 2).
1151-
// These values may be configured to adjust duration of loop().
1152-
#define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop().
1153-
#define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop().
1154-
1155-
// This value may be configured to adjust duration to consume the command buffer.
1156-
// Try increasing this value if stepper motion is not smooth.
1157-
#define FTM_STEPPERCMD_BUFF_SIZE 1000 // Size of the stepper command buffers.
1158-
1159-
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters.
1139+
#define FTM_UNIFIED_BWS // DON'T DISABLE unless you use Ulendo FBS (not implemented)
1140+
#if ENABLED(FTM_UNIFIED_BWS)
1141+
#define FTM_BW_SIZE 100 // Unified Window and Batch size with a ratio of 2
1142+
#else
1143+
#define FTM_WINDOW_SIZE 200 // Custom Window size for trajectory generation needed by Ulendo FBS
1144+
#define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS
1145+
#endif
1146+
1147+
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
1148+
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS)
1149+
1150+
// These values may be configured to adjust the duration of loop().
1151+
#define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop()
1152+
#define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop()
1153+
1154+
#if DISABLED(COREXY)
1155+
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
1156+
1157+
// Use this to adjust the time required to consume the command buffer.
1158+
// Try increasing this value if stepper motion is choppy.
1159+
#define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers
1160+
// (FTM_STEPS_PER_LOOP * FTM_POINTS_PER_LOOP) is a good start
1161+
// If you run out of memory, fall back to 3000 and increase progressively
1162+
#else
1163+
// CoreXY motion needs a larger buffer size. These values are based on our testing.
1164+
#define FTM_STEPPER_FS 30000
1165+
#define FTM_STEPPERCMD_BUFF_SIZE 6000
1166+
#endif
1167+
1168+
#define FTM_STEPS_PER_UNIT_TIME (FTM_STEPPER_FS / FTM_FS) // Interpolated stepper commands per unit time
1169+
#define FTM_CTS_COMPARE_VAL (FTM_STEPS_PER_UNIT_TIME / 2) // Comparison value used in interpolation algorithm
1170+
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps
1171+
1172+
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency
1173+
#define FTM_RATIO (FTM_FS / FTM_MIN_SHAPE_FREQ) // Factor for use in FTM_ZMAX. DON'T CHANGE.
1174+
#define FTM_ZMAX (FTM_RATIO * 2) // Maximum delays for shaping functions (even numbers only!)
1175+
// Calculate as:
1176+
// ZV : FTM_RATIO / 2
1177+
// ZVD, MZV : FTM_RATIO
1178+
// 2HEI : FTM_RATIO * 3 / 2
1179+
// 3HEI : FTM_RATIO * 2
11601180
#endif
11611181

11621182
/**

0 commit comments

Comments
 (0)