🚸 FT Motion toggle() more safely
This commit is contained in:
@@ -465,10 +465,7 @@ void menu_move() {
|
||||
BACK_ITEM(MSG_MOTION);
|
||||
|
||||
bool show_state = c.active;
|
||||
EDIT_ITEM(bool, MSG_FIXED_TIME_MOTION, &show_state, []{
|
||||
FLIP(ftMotion.cfg.active);
|
||||
ftMotion.update_shaping_params();
|
||||
});
|
||||
EDIT_ITEM(bool, MSG_FIXED_TIME_MOTION, &show_state, []{ (void)ftMotion.toggle(); });
|
||||
|
||||
// Show only when FT Motion is active (or optionally always show)
|
||||
if (c.active || ENABLED(FT_MOTION_NO_MENU_TOGGLE)) {
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* FTConfig - The active configured state of FT Motion
|
||||
*/
|
||||
typedef struct FTConfig {
|
||||
bool active = ENABLED(FTM_IS_DEFAULT_MOTION); // Active (else standard motion)
|
||||
bool axis_sync_enabled = true; // Axis synchronization enabled
|
||||
@@ -77,6 +80,9 @@ typedef struct FTConfig {
|
||||
float poly6_acceleration_overshoot; // Overshoot factor for Poly6 (1.25 to 2.0)
|
||||
} ft_config_t;
|
||||
|
||||
/**
|
||||
* FTMotion - Singleton class encapsulating Fixed Time Motion
|
||||
*/
|
||||
class FTMotion {
|
||||
|
||||
public:
|
||||
@@ -157,6 +163,13 @@ class FTMotion {
|
||||
|
||||
static void reset(); // Reset all states of the fixed time conversion to defaults.
|
||||
|
||||
static bool toggle() {
|
||||
stepper.ftMotion_syncPosition();
|
||||
FLIP(cfg.active);
|
||||
update_shaping_params();
|
||||
return cfg.active;
|
||||
}
|
||||
|
||||
// Trajectory generator selection
|
||||
static void setTrajectoryType(const TrajectoryType type);
|
||||
static TrajectoryType getTrajectoryType() { return trajectoryType; }
|
||||
@@ -269,8 +282,12 @@ class FTMotion {
|
||||
|
||||
}; // class FTMotion
|
||||
|
||||
extern FTMotion ftMotion;
|
||||
extern FTMotion ftMotion; // Use ftMotion.thing, not FTMotion::thing.
|
||||
|
||||
/**
|
||||
* Optional behavior to turn FT Motion off for homing/probing.
|
||||
* Applies when FTM_HOME_AND_PROBE is disabled.
|
||||
*/
|
||||
typedef struct FTMotionDisableInScope {
|
||||
#if DISABLED(FTM_HOME_AND_PROBE)
|
||||
bool isactive;
|
||||
|
||||
Reference in New Issue
Block a user