Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1.x] Hangprinter support #9180

Merged
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Some corrections and formatting

  • Loading branch information...
thinkyhead committed Sep 8, 2018
commit b41673029a59795ac309bbf0314c993fc617e72d
@@ -729,22 +729,6 @@
#define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1))
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))

// Trinamic Stepper Drivers
#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
#define HAS_STALLGUARD HAS_DRIVER(TMC2130)
#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
#define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)

#if ENABLED(SENSORLESS_HOMING)
// Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE
#undef Z_HOMING_SENSITIVITY
#endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY))
#endif

#if ENABLED(HANGPRINTER)
#define HAS_A_ENABLE (PIN_EXISTS(A_ENABLE))
#define HAS_A_DIR (PIN_EXISTS(A_DIR))
@@ -767,6 +751,22 @@
#define HAS_D_MICROSTEPS (PIN_EXISTS(D_MS1))
#endif

// Trinamic Stepper Drivers
#define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208))
#define HAS_STALLGUARD HAS_DRIVER(TMC2130)
#define AXIS_HAS_STEALTHCHOP(ST) ( AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) )
#define AXIS_HAS_STALLGUARD(ST) AXIS_DRIVER_TYPE(ST, TMC2130)

#if ENABLED(SENSORLESS_HOMING)
// Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE
#undef Z_HOMING_SENSITIVITY
#endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_HOMING_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_HOMING_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_HOMING_SENSITIVITY))
#endif

// Endstops and bed probe
#define HAS_STOP_TEST(A,M) (PIN_EXISTS(A##_##M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_OR_PROBE(A,M))
#define HAS_X_MIN HAS_STOP_TEST(X,MIN)
@@ -1407,11 +1407,11 @@
* NUM_AXIS_N: number of movement axes + number of extruders (defined elsewhere)
*/
#if ENABLED(HANGPRINTER)
#define MOV_AXIS 4
#define NUM_AXIS 5
#define MOV_AXIS ABCD
#define NUM_AXIS ABCDE
#else
#define MOV_AXIS 3
#define NUM_AXIS 4
#define MOV_AXIS XYZ
#define NUM_AXIS XYZE
#endif

#endif // CONDITIONALS_POST_H
@@ -154,47 +154,31 @@ extern const char axis_codes[XYZE];

#if E_STEPPERS > 1 && HAS_E1_ENABLE
#define enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
#if ENABLED(HANGPRINTER) && EXTRUDERS == 1
#define disable_E1() NOOP
#else
#define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#endif
#define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E1() NOOP
#define disable_E1() NOOP
#endif

#if E_STEPPERS > 2 && HAS_E2_ENABLE
#define enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
#if ENABLED(HANGPRINTER) && EXTRUDERS == 2
#define disable_E2() NOOP
#else
#define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#endif
#define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E2() NOOP
#define disable_E2() NOOP
#endif

#if E_STEPPERS > 3 && HAS_E3_ENABLE
#define enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
#if ENABLED(HANGPRINTER) && EXTRUDERS == 3
#define disable_E3() NOOP
#else
#define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#endif
#define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E3() NOOP
#define disable_E3() NOOP
#endif

#if E_STEPPERS > 4 && HAS_E4_ENABLE
#define enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
#if ENABLED(HANGPRINTER) && EXTRUDERS == 4
#define disable_E4() NOOP
#else
#define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
#endif
#define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E4() NOOP
#define disable_E4() NOOP
@@ -203,9 +187,11 @@ extern const char axis_codes[XYZE];
#endif // !MIXING_EXTRUDER

#if ENABLED(HANGPRINTER)

#define enable_A() enable_X()
#define enable_B() enable_Y()
#define enable_C() enable_Z()

#if EXTRUDERS == 1
#define enable_D() E1_ENABLE_WRITE(E_ENABLE_ON)
#elif EXTRUDERS == 2
@@ -215,7 +201,26 @@ extern const char axis_codes[XYZE];
#elif EXTRUDERS == 4
#define enable_D() E4_ENABLE_WRITE(E_ENABLE_ON)
#endif
#endif

// Don't allow D Axis to be disabled
#if EXTRUDERS >= 1
#undef disable_E1
#define disable_E1() NOOP
#if EXTRUDERS >= 2
#undef disable_E2
#define disable_E2() NOOP
#if EXTRUDERS >= 3
#undef disable_E3
#define disable_E3() NOOP
#if EXTRUDERS >= 4
#undef disable_E4
#define disable_E4() NOOP
#endif // EXTRUDERS >= 4
#endif // EXTRUDERS >= 3
#endif // EXTRUDERS >= 2
#endif // EXTRUDERS >= 1

#endif // HANGPRINTER

#if ENABLED(G38_PROBE_TARGET)
extern bool G38_move, // flag to tell the interrupt handler that a G38 command is being run
@@ -359,7 +364,7 @@ extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];

void tool_change(const uint8_t tmp_extruder, const float fr_mm_s=0.0, bool no_move=false);

void home_all_axes();
void home_all_axes();

void report_current_position();

@@ -402,7 +407,8 @@ void report_current_position();
}while(0)

#elif ENABLED(HANGPRINTER)
// Don't collect anchor positions in array because there are no A_x, D_x or D_y

// Don't collect anchor positions in array because there are no A_x, D_x or D_y
extern float anchor_A_y,
anchor_A_z,
anchor_B_x,
@@ -418,28 +424,28 @@ void report_current_position();
void recalc_hangprinter_settings();

#define HANGPRINTER_IK(V) do { \
line_lengths[A_AXIS] = sqrt(sq(anchor_A_z - V[Z_AXIS]) \
line_lengths[A_AXIS] = SQRT(sq(anchor_A_z - V[Z_AXIS]) \
+ sq(anchor_A_y - V[Y_AXIS]) \
+ sq( V[X_AXIS])); \
line_lengths[B_AXIS] = sqrt(sq(anchor_B_z - V[Z_AXIS]) \
line_lengths[B_AXIS] = SQRT(sq(anchor_B_z - V[Z_AXIS]) \
+ sq(anchor_B_y - V[Y_AXIS]) \
+ sq(anchor_B_x - V[X_AXIS])); \
line_lengths[C_AXIS] = sqrt(sq(anchor_C_z - V[Z_AXIS]) \
line_lengths[C_AXIS] = SQRT(sq(anchor_C_z - V[Z_AXIS]) \
+ sq(anchor_C_y - V[Y_AXIS]) \
+ sq(anchor_C_x - V[X_AXIS])); \
line_lengths[D_AXIS] = sqrt(sq( V[X_AXIS]) \
line_lengths[D_AXIS] = SQRT(sq( V[X_AXIS]) \
+ sq( V[Y_AXIS]) \
+ sq(anchor_D_z - V[Z_AXIS])); \
}while(0)

// Inverse kinematics at origin
#define HANGPRINTER_IK_ORIGIN(LL) do { \
LL[A_AXIS] = sqrt(sq(anchor_A_z) \
LL[A_AXIS] = SQRT(sq(anchor_A_z) \
+ sq(anchor_A_y)); \
LL[B_AXIS] = sqrt(sq(anchor_B_z) \
LL[B_AXIS] = SQRT(sq(anchor_B_z) \
+ sq(anchor_B_y) \
+ sq(anchor_B_x)); \
LL[C_AXIS] = sqrt(sq(anchor_C_z) \
LL[C_AXIS] = SQRT(sq(anchor_C_z) \
+ sq(anchor_C_y) \
+ sq(anchor_C_x)); \
LL[D_AXIS] = anchor_D_z; \
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.