Skip to content

Commit

Permalink
Fix compile for LINEAR_AXES 5 and
Browse files Browse the repository at this point in the history
workaround steps per mm for LINEAR_AXES 4
Too high steps per mm and feedrate for LINEAR _AXES 5
  • Loading branch information
DerAndere1 committed Aug 27, 2020
1 parent 9b8ae80 commit 2c02474
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 459 deletions.
280 changes: 0 additions & 280 deletions Marlin/src/core/types.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M92.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void GcodeSuite::M92() {

// No arguments? Show M92 report.
if (!parser.seen("E"
GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR AXIS5_STR AXIS6_STR)
GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR)
TERN_(MAGIC_NUMBERS_GCODE, "HL")
)) return report_M92(true, target_extruder);

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/control/M17_M18_M84.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* M17: Enable stepper motors
*/
void GcodeSuite::M17() {
if (parser.seen(GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR AXIS5_STR AXIS6_STR) "E")) {
if (parser.seen(GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR) "E")) {
if (parser.seen('X')) ENABLE_AXIS_X();
if (parser.seen('Y')) ENABLE_AXIS_Y();
if (parser.seen('Z')) ENABLE_AXIS_Z();
Expand Down Expand Up @@ -63,7 +63,7 @@ void GcodeSuite::M18_M84() {
stepper_inactive_time = parser.value_millis_from_seconds();
}
else {
if (parser.seen(GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR AXIS5_STR AXIS6_STR) "E")) {
if (parser.seen(GANG_N(LINEAR_AXES, "X", "Y", "Z", AXIS4_STR, AXIS5_STR, AXIS6_STR) "E")) {
planner.synchronize();
if (parser.seen('X')) DISABLE_AXIS_X();
if (parser.seen('Y')) DISABLE_AXIS_Y();
Expand Down
37 changes: 34 additions & 3 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ ENABLED(COREYZ) \
+ ENABLED(COREYX) \
+ ENABLED(COREZX) \
+ ENABLED(COREZY)
#error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, or COREZY."
+ ENABLED(COREZY) \
+ ENABLED(ASYNC_SECONDARY_AXES) \
+ ENABLED(FOAMCUTTER_XYUV)
#error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, ASYNC_SECONDARY_AXES or FOAMCUTTER_XYUV."
#endif

/**
Expand All @@ -1199,6 +1201,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif

/**
* Delta requirements
*/
#if ENABLED(FOAMCUTTER_XYUV) && LINEAR_AXES < 5
#error "FOAMCUTTER_XYUV requires LINEAR_AXES >= 5."
#endif
/**
* Junction deviation is incompatible with kinematic systems.
*/
Expand Down Expand Up @@ -1948,7 +1956,15 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \
&& !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \
&& !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
#define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
#if LINEAR_AXES == 6
#define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z) && _PLUG_UNUSED_TEST(A,I) && _PLUG_UNUSED_TEST(A,J) && _PLUG_UNUSED_TEST(A,K))
#elif LINEAR_AXES == 5
#define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z) && _PLUG_UNUSED_TEST(A,I) && _PLUG_UNUSED_TEST(A,J))
#elif LINEAR_AXES == 4
#define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z) && _PLUG_UNUSED_TEST(A,I))
#else
#define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
#endif

// At least 3 endstop plugs must be used
#if _AXIS_PLUG_UNUSED_TEST(X)
Expand All @@ -1960,6 +1976,21 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#if _AXIS_PLUG_UNUSED_TEST(Z)
#error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
#endif
#if LINEAR_AXES >= 4
#if _AXIS_PLUG_UNUSED_TEST(I)
#error "You must enable USE_IMIN_PLUG or USE_IMAX_PLUG."
#endif
#endif
#if LINEAR_AXES >= 5
#if _AXIS_PLUG_UNUSED_TEST(J)
#error "You must enable USE_JMIN_PLUG or USE_JMAX_PLUG."
#endif
#endif
#if LINEAR_AXES >= 6
#if _AXIS_PLUG_UNUSED_TEST(K)
#error "You must enable USE_KMIN_PLUG or USE_KMAX_PLUG."
#endif
#endif

// Delta and Cartesian use 3 homing endstops
#if !IS_SCARA
Expand Down
14 changes: 11 additions & 3 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ Endstops endstops;

bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load()

volatile axis_bits_t Endstops::hit_state; //TODO (DerAndere): volatile hitbits_t Endstops::hit_state;
#if LINEAR_AXES >= 4
volatile uint16_t Endstops::hit_state; //TODO (DerAndere): volatile hitbits_t Endstops::hit_state;
#else
volatile uint8_t Endstops::hit_state; //TODO (DerAndere): volatile hitbits_t Endstops::hit_state;
#endif

Endstops::esbits_t Endstops::live_state = 0;

Expand Down Expand Up @@ -408,8 +412,12 @@ void Endstops::resync() {
#endif

void Endstops::event_handler() {
static hitbits_t prev_hit_state; // = 0
if (hit_state == prev_hit_state) return;
#if LINEAR_AXES >= 4
static uint16_t prev_hit_state; // = 0
#else
static uint8_t prev_hit_state; // = 0
#endif
if (hit_state == prev_hit_state) return;
prev_hit_state = hit_state;
if (hit_state) {
#if HAS_SPI_LCD
Expand Down
19 changes: 15 additions & 4 deletions Marlin/src/module/endstops.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ enum EndstopEnum : char {

class Endstops {
public:
typedef IF<(LINEAR_AXES >= 4 || ENABLED(HAS_EXTRA_ENDSTOPS)), uint16_t, uint8_t>::type esbits_t;
typedef IF<(LINEAR_AXES >= 4), uint16_t, uint8_t>::type hitbits_t;
#if LINEAR_AXES >=4 || ENABLED(HAS_EXTRA_ENDSTOPS)
typedef uint16_t esbits_t;
#else
typedef uint8_t esbits_t;
#endif

#if HAS_EXTRA_ENDSTOPS
TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj);
Expand All @@ -62,7 +65,11 @@ class Endstops {
private:
static bool enabled, enabled_globally;
static esbits_t live_state;
static volatile axis_bits_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index
#if LINEAR_AXES >= 4
static volatile uint16_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index
#else
static volatile uint8_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index
#endif

#if ENDSTOP_NOISE_THRESHOLD
static esbits_t validated_live_state;
Expand Down Expand Up @@ -101,7 +108,11 @@ class Endstops {
/**
* Get Endstop hit state.
*/
FORCE_INLINE static hitbits_t trigger_state() { return hit_state; }
#if LINEAR_AXES > 3
FORCE_INLINE static uint16_t trigger_state() { return hit_state; }
#else
FORCE_INLINE static uint8_t trigger_state() { return hit_state; }
#endif

/**
* Get current endstops state
Expand Down
56 changes: 31 additions & 25 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,36 +514,39 @@ void do_blocking_move_to(
}

void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, current_position.z, fr_mm_s);
do_blocking_move_to(LIST_N(LINEAR_AXES, raw.x, raw.y, current_position.z, current_position.i, current_position.j, current_position.k), fr_mm_s);
}
void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(LIST_N(LINEAR_AXES, raw.x, raw.y, raw.z, raw.i, raw.j, raw.k), fr_mm_s);
}
void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(LIST_N(LINEAR_AXES, raw.x, raw.y, raw.z, raw.i, raw.j, raw.k), fr_mm_s);
}

#if LINEAR_AXES >= 4
void do_blocking_move_to(const xyzOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, raw.z, current_position.i, fr_mm_s);
}
// #if LINEAR_AXES >= 5
// void do_blocking_move_to(const xyziOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(raw.x, raw.y, raw.z, raw.i, current_position.j, fr_mm_s);
// }
// #if LINEAR_AXES >= 6
// void do_blocking_move_to(const xyzijOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(raw.x, raw.y, raw.z, raw.i, raw.j, current_position.k, fr_mm_s);
// }
// #endif
// #endif
#endif

//void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(LIST_N(LINEAR_AXES, raw.x, raw.y, raw.z, raw.i, raw.j, raw.k), fr_mm_s);
//}
//#if LINEAR_AXES >= 4
// void do_blocking_move_to(const xyzOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(raw.x, raw.y, raw.z, current_position.i, fr_mm_s);
// }
//#endif
//#if LINEAR_AXES >= 5
// void do_blocking_move_to(const xyziOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(raw.x, raw.y, raw.z, raw.i, current_position.j, fr_mm_s);
// }
//#endif
//#if LINEAR_AXES >= 6
// void do_blocking_move_to(const xyzijOnly_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0f*/) {
// do_blocking_move_to(raw.x, raw.y, raw.z, raw.i, raw.j, current_position.k, fr_mm_s);
// }
//#endif
//
void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s/*=0.0*/) {
do_blocking_move_to(rx, current_position.y, current_position.z, fr_mm_s);
do_blocking_move_to(
LIST_N(LINEAR_AXES, rx, current_position.y, current_position.z, current_position.i, current_position.j, current_position.k),
fr_mm_s);
}
void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s/*=0.0*/) {
do_blocking_move_to(current_position.x, ry, current_position.z, fr_mm_s);
do_blocking_move_to(
LIST_N(LINEAR_AXES, current_position.x, ry, current_position.z, current_position.i, current_position.j, current_position.k),
fr_mm_s);
}
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s/*=0.0*/) {
do_blocking_move_to_xy_z(current_position, rz, fr_mm_s);
Expand All @@ -560,7 +563,7 @@ void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s/*=0.0*/) {

#if LINEAR_AXES >= 5
void do_blocking_move_to_j(const float &rj, const feedRate_t &fr_mm_s/*=0.0*/) {
do_blocking_move_to_xyzi_j(current_position, ri, fr_mm_s);
do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s);
}
void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const float &j, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, raw.z, raw.i, j, fr_mm_s);
Expand All @@ -587,7 +590,10 @@ void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t &fr_mm_s/*=0.0
}

void do_blocking_move_to_xy_z(const xy_pos_t &raw, const float &z, const feedRate_t &fr_mm_s/*=0.0f*/) {
do_blocking_move_to(raw.x, raw.y, z, fr_mm_s);
do_blocking_move_to(
LIST_N(LINEAR_AXES, raw.x, raw.y, z, current_position.i, current_position.j, current_position.k),
fr_mm_s
);
}

void do_z_clearance(const float &zclear, const bool z_known/*=true*/, const bool raise_on_unknown/*=true*/, const bool lower_allowed/*=false*/) {
Expand Down
21 changes: 3 additions & 18 deletions Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,36 +218,21 @@ void do_blocking_move_to(
);
void do_blocking_move_to(const xy_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const xyz_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to(const xyze_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
#if LINEAR_AXES >= 4
void do_blocking_move_to(const xyzeOnly_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
/*
#if LINEAR_AXES >= 5
void do_blocking_move_to(const xyzieOnly_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
#if LINEAR_AXES >= 6
void do_blocking_move_to(const xyzieOnly_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
#endif
#endif
*/
#endif

void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s=0.0f);
#if LINEAR_AXES >= 4
void do_blocking_move_to_i(const float &ri, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const float &i, const feedRate_t &fr_mm_s=0.0f);
/*
FORCE_INLINE void do_blocking_move_to_xyz_i(const xyz_pos_t &raw, const float &i, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xyz_i(xyzOnly_pos_t(raw), i, fr_mm_s); }
FORCE_INLINE void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const float &i, const feedRate_t &fr_mm_s=0.0f) { do_blocking_move_to_xyz_i(xyzOnly_pos_t(raw), i, fr_mm_s); }
*/
#endif
#if LINEAR_AXES >= 5
void do_blocking_move_to_j(const float &rj, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xyz_j(const xyze_pos_t &raw, const float &j, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const float &j, const feedRate_t &fr_mm_s=0.0f);
#endif
#if LINEAR_AXES >= 6
void do_blocking_move_to_k(const float &rk, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xyz_k(const xyze_pos_t &raw, const float &k, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const float &k, const feedRate_t &fr_mm_s=0.0f);
#endif
void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s=0.0f);
void do_blocking_move_to_xy(const xy_pos_t &raw, const feedRate_t &fr_mm_s=0.0f);
Expand Down
Loading

0 comments on commit 2c02474

Please sign in to comment.