forked from Mirrors/Marlin
@@ -28,18 +28,9 @@
|
||||
#include "../../../module/stepper.h"
|
||||
#include "../../../module/planner.h"
|
||||
|
||||
static FSTR_P get_trajectory_type_name() {
|
||||
switch (ftMotion.getTrajectoryType()) {
|
||||
default:
|
||||
case TrajectoryType::TRAPEZOIDAL: return GET_TEXT_F(MSG_FTM_TRAPEZOIDAL);
|
||||
case TrajectoryType::POLY5: return GET_TEXT_F(MSG_FTM_POLY5);
|
||||
case TrajectoryType::POLY6: return GET_TEXT_F(MSG_FTM_POLY6);
|
||||
}
|
||||
}
|
||||
|
||||
void say_ftm_settings() {
|
||||
#if ENABLED(FTM_POLYS)
|
||||
SERIAL_ECHOLN(F(" Trajectory: "), get_trajectory_type_name(), C('('), (uint8_t)ftMotion.getTrajectoryType(), C(')'));
|
||||
SERIAL_ECHOLN(F(" Trajectory: "), ftMotion.getTrajectoryName(), C('('), (uint8_t)ftMotion.getTrajectoryType(), C(')'));
|
||||
#endif
|
||||
|
||||
const ft_config_t &c = ftMotion.cfg;
|
||||
|
||||
@@ -1541,9 +1541,6 @@
|
||||
#if !HAS_EXTRUDERS
|
||||
#undef FTM_SHAPER_E
|
||||
#endif
|
||||
#if DISABLED(FTM_POLYS)
|
||||
#define FTM_TRAJECTORY_TYPE TRAPEZOIDAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Multi-Stepping Limit
|
||||
|
||||
@@ -327,18 +327,6 @@ void menu_move() {
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(FTM_POLYS)
|
||||
FSTR_P get_trajectory_name() {
|
||||
switch (ftMotion.getTrajectoryType()) {
|
||||
default:
|
||||
case TrajectoryType::TRAPEZOIDAL: return GET_TEXT_F(MSG_FTM_TRAPEZOIDAL);
|
||||
case TrajectoryType::POLY5: return GET_TEXT_F(MSG_FTM_POLY5);
|
||||
case TrajectoryType::POLY6: return GET_TEXT_F(MSG_FTM_POLY6);
|
||||
|
||||
}
|
||||
}
|
||||
#endif // FTM_POLYS
|
||||
|
||||
#if HAS_DYNAMIC_FREQ
|
||||
FSTR_P get_dyn_freq_mode_name() {
|
||||
switch (ftMotion.cfg.dynFreqMode) {
|
||||
@@ -494,7 +482,7 @@ void menu_move() {
|
||||
auto _traj_name = [&]{
|
||||
if (TERN1(CACHE_FOR_SPEED, !got_t)) {
|
||||
TERN_(CACHE_FOR_SPEED, got_t = true);
|
||||
traj_name = get_trajectory_name();
|
||||
traj_name = ftMotion.getTrajectoryName();
|
||||
}
|
||||
return traj_name;
|
||||
};
|
||||
@@ -504,7 +492,7 @@ void menu_move() {
|
||||
auto _dmode = []{ return get_dyn_freq_mode_name(); };
|
||||
#endif
|
||||
#if ENABLED(FTM_POLYS)
|
||||
auto _traj_name = []{ return get_trajectory_name(); };
|
||||
auto _traj_name = []{ return ftMotion.getTrajectoryName(); };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -598,7 +586,7 @@ void menu_move() {
|
||||
auto _traj_name = [&]{
|
||||
if (TERN1(CACHE_FOR_SPEED, !got_t)) {
|
||||
TERN_(CACHE_FOR_SPEED, got_t = true);
|
||||
traj_name = get_trajectory_name();
|
||||
traj_name = ftMotion.getTrajectoryName();
|
||||
}
|
||||
return traj_name;
|
||||
};
|
||||
@@ -611,7 +599,7 @@ void menu_move() {
|
||||
auto _dmode = []{ return get_dyn_freq_mode_name(); };
|
||||
#endif
|
||||
#if ENABLED(FTM_POLYS)
|
||||
auto _traj_name = []{ return get_trajectory_name(); };
|
||||
auto _traj_name = []{ return ftMotion.getTrajectoryName(); };
|
||||
#endif
|
||||
|
||||
#endif // !__AVR__
|
||||
|
||||
@@ -74,11 +74,11 @@ float FTMotion::tau = 0.0f; // (s) Time since start of b
|
||||
// Trajectory generators
|
||||
TrapezoidalTrajectoryGenerator FTMotion::trapezoidalGenerator;
|
||||
#if ENABLED(FTM_POLYS)
|
||||
TrajectoryType FTMotion::trajectoryType = TrajectoryType::FTM_TRAJECTORY_TYPE;
|
||||
Poly5TrajectoryGenerator FTMotion::poly5Generator;
|
||||
Poly6TrajectoryGenerator FTMotion::poly6Generator;
|
||||
TrajectoryGenerator* FTMotion::currentGenerator = &FTMotion::trapezoidalGenerator;
|
||||
#endif
|
||||
TrajectoryGenerator* FTMotion::currentGenerator = &FTMotion::trapezoidalGenerator;
|
||||
TrajectoryType FTMotion::trajectoryType = TrajectoryType::FTM_TRAJECTORY_TYPE;
|
||||
|
||||
// Resonance Test
|
||||
TERN_(FTM_RESONANCE_TEST,ResonanceGenerator FTMotion::rtg;) // Resonance trajectory generator instance
|
||||
@@ -288,20 +288,33 @@ void FTMotion::plan_runout_block() {
|
||||
void FTMotion::init() {
|
||||
update_shaping_params();
|
||||
TERN_(FTM_SMOOTHING, update_smoothing_params());
|
||||
setTrajectoryType(cfg.trajectory_type);
|
||||
TERN_(FTM_POLYS, setTrajectoryType(cfg.trajectory_type));
|
||||
reset(); // Precautionary.
|
||||
}
|
||||
|
||||
// Set trajectory generator type
|
||||
void FTMotion::setTrajectoryType(const TrajectoryType type) {
|
||||
cfg.trajectory_type = trajectoryType = type;
|
||||
switch (type) {
|
||||
default: cfg.trajectory_type = trajectoryType = TrajectoryType::FTM_TRAJECTORY_TYPE;
|
||||
case TrajectoryType::TRAPEZOIDAL: currentGenerator = &trapezoidalGenerator; break;
|
||||
#if ENABLED(FTM_POLYS)
|
||||
case TrajectoryType::POLY5: currentGenerator = &poly5Generator; break;
|
||||
case TrajectoryType::POLY6: currentGenerator = &poly6Generator; break;
|
||||
#endif
|
||||
#if ENABLED(FTM_POLYS)
|
||||
|
||||
// Set trajectory generator type
|
||||
void FTMotion::setTrajectoryType(const TrajectoryType type) {
|
||||
cfg.trajectory_type = trajectoryType = type;
|
||||
switch (type) {
|
||||
default:
|
||||
case TrajectoryType::TRAPEZOIDAL: currentGenerator = &trapezoidalGenerator; break;
|
||||
#if ENABLED(FTM_POLYS)
|
||||
case TrajectoryType::POLY5: currentGenerator = &poly5Generator; break;
|
||||
case TrajectoryType::POLY6: currentGenerator = &poly6Generator; break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // FTM_POLYS
|
||||
|
||||
FSTR_P FTMotion::getTrajectoryName() {
|
||||
switch (getTrajectoryType()) {
|
||||
default:
|
||||
case TrajectoryType::TRAPEZOIDAL: return GET_TEXT_F(MSG_FTM_TRAPEZOIDAL);
|
||||
case TrajectoryType::POLY5: return GET_TEXT_F(MSG_FTM_POLY5);
|
||||
case TrajectoryType::POLY6: return GET_TEXT_F(MSG_FTM_POLY6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,9 +84,11 @@ typedef struct FTConfig {
|
||||
ft_smoothed_float_t smoothingTime; // Smoothing time. [s]
|
||||
#endif
|
||||
|
||||
TrajectoryType trajectory_type = TrajectoryType::FTM_TRAJECTORY_TYPE; // Trajectory generator type
|
||||
#if ENABLED(FTM_POLYS)
|
||||
float poly6_acceleration_overshoot; // Overshoot factor for Poly6 (1.25 to 2.0)
|
||||
TrajectoryType trajectory_type = TrajectoryType::FTM_TRAJECTORY_TYPE; // Trajectory generator type
|
||||
#else
|
||||
static constexpr TrajectoryType trajectory_type = TrajectoryType::TRAPEZOIDAL;
|
||||
#endif
|
||||
} ft_config_t;
|
||||
|
||||
@@ -140,10 +142,9 @@ class FTMotion {
|
||||
|
||||
#if ENABLED(FTM_POLYS)
|
||||
cfg.poly6_acceleration_overshoot = FTM_POLY6_ACCELERATION_OVERSHOOT;
|
||||
setTrajectoryType(TrajectoryType::FTM_TRAJECTORY_TYPE);
|
||||
#endif
|
||||
|
||||
setTrajectoryType(TrajectoryType::FTM_TRAJECTORY_TYPE);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -182,7 +183,8 @@ class FTMotion {
|
||||
|
||||
// Trajectory generator selection
|
||||
static void setTrajectoryType(const TrajectoryType type);
|
||||
static TrajectoryType getTrajectoryType() { return trajectoryType; }
|
||||
static TrajectoryType getTrajectoryType() { return TERN(FTM_POLYS, trajectoryType, TrajectoryType::TRAPEZOIDAL); }
|
||||
static FSTR_P getTrajectoryName();
|
||||
|
||||
FORCE_INLINE static bool axis_is_moving(const AxisEnum axis) {
|
||||
return cfg.active ? moving_axis_flags[axis] : stepper.axis_is_moving(axis);
|
||||
@@ -219,9 +221,11 @@ class FTMotion {
|
||||
#if ENABLED(FTM_POLYS)
|
||||
static Poly5TrajectoryGenerator poly5Generator;
|
||||
static Poly6TrajectoryGenerator poly6Generator;
|
||||
static TrajectoryType trajectoryType;
|
||||
static TrajectoryGenerator* currentGenerator;
|
||||
#else
|
||||
static constexpr TrajectoryGenerator *currentGenerator = trapezoidalGenerator;
|
||||
#endif
|
||||
static TrajectoryGenerator* currentGenerator;
|
||||
static TrajectoryType trajectoryType;
|
||||
|
||||
#if FTM_HAS_LIN_ADVANCE
|
||||
static bool use_advance_lead;
|
||||
|
||||
Reference in New Issue
Block a user