Skip to content

Commit

Permalink
motion_state_t
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 12, 2021
1 parent 1eea57b commit c440471
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
7 changes: 0 additions & 7 deletions Marlin/src/feature/tmc_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,6 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
extern millis_t sg_guard_period;
constexpr uint16_t default_sg_guard_duration = 400;

struct motion_state_t {
xy_ulong_t acceleration;
#if HAS_CLASSIC_JERK
xy_float_t jerk_state;
#endif
};
#endif

bool tmc_enable_stallguard(TMC2130Stepper &st);
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@

#if ENABLED(IMPROVE_HOMING_RELIABILITY)

motion_state_s begin_slow_homing() {
motion_state_s motion_state{0};
motion_state_t begin_slow_homing() {
motion_state_t motion_state{0};
motion_state.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]
OPTARG(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS])
Expand All @@ -181,7 +181,7 @@
return motion_state;
}

void end_slow_homing(const motion_state_s &motion_state) {
void end_slow_homing(const motion_state_t &motion_state) {
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z);
Expand Down Expand Up @@ -299,7 +299,7 @@ void GcodeSuite::G28() {
#endif

#if ENABLED(IMPROVE_HOMING_RELIABILITY)
motion_state_s saved_motion_state = begin_slow_homing();
motion_state_t saved_motion_state = begin_slow_homing();
#endif

// Always home with tool 0 active
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ void Planner::check_axes_activity() {
#if ENABLED(IMPROVE_HOMING_RELIABILITY)

void Planner::enable_stall_prevention(const bool onoff) {
static motion_state_s saved_motion_state;
static saved_motion_state_t saved_motion_state;
if (onoff) {
saved_motion_state.acceleration.x = settings.max_acceleration_mm_per_s2[X_AXIS];
saved_motion_state.acceleration.y = settings.max_acceleration_mm_per_s2[Y_AXIS];
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ typedef struct {
} planner_settings_t;

#if ENABLED(IMPROVE_HOMING_RELIABILITY)
struct motion_state_s {
struct motion_state_t {
TERN(DELTA, xyz_ulong_t, xy_ulong_t) acceleration;
#if HAS_CLASSIC_JERK
TERN(DELTA, xyz_float_t, xy_float_t) jerk_state;
Expand Down

0 comments on commit c440471

Please sign in to comment.