Code changes supporting up to 6 extruders

This commit is contained in:
Scott Lahteine
2018-09-13 01:35:55 -05:00
parent f5c210d33d
commit 1718eff54a
52 changed files with 848 additions and 191 deletions

View File

@ -646,6 +646,37 @@ void I2CPositionEncodersMgr::init() {
encoders[i].set_homed();
#endif
#endif
#if I2CPE_ENCODER_CNT > 5
i++;
encoders[i].init(I2CPE_ENC_6_ADDR, I2CPE_ENC_6_AXIS);
#ifdef I2CPE_ENC_6_TYPE
encoders[i].set_type(I2CPE_ENC_6_TYPE);
#endif
#ifdef I2CPE_ENC_6_TICKS_UNIT
encoders[i].set_ticks_unit(I2CPE_ENC_6_TICKS_UNIT);
#endif
#ifdef I2CPE_ENC_6_TICKS_REV
encoders[i].set_stepper_ticks(I2CPE_ENC_6_TICKS_REV);
#endif
#ifdef I2CPE_ENC_6_INVERT
encoders[i].set_inverted(I2CPE_ENC_6_INVERT);
#endif
#ifdef I2CPE_ENC_6_EC_METHOD
encoders[i].set_ec_method(I2CPE_ENC_6_EC_METHOD);
#endif
#ifdef I2CPE_ENC_6_EC_THRESH
encoders[i].set_ec_threshold(I2CPE_ENC_6_EC_THRESH);
#endif
encoders[i].set_active(encoders[i].passes_test(true));
#if I2CPE_ENC_6_AXIS == E_AXIS
encoders[i].set_homed();
#endif
#endif
}
void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units, const bool noOffset) {

View File

@ -57,11 +57,14 @@ void controllerfan_update() {
#if E_STEPPERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 2
|| E2_ENABLE_READ == E_ENABLE_ON
|| E2_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 3
|| E3_ENABLE_READ == E_ENABLE_ON
|| E3_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 4
|| E4_ENABLE_READ == E_ENABLE_ON
|| E4_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 5
|| E5_ENABLE_READ == E_ENABLE_ON
#endif
#endif
#endif
#endif

View File

@ -68,11 +68,14 @@ bool Power::is_power_needed() {
#if E_STEPPERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 2
|| E2_ENABLE_READ == E_ENABLE_ON
|| E2_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 3
|| E3_ENABLE_READ == E_ENABLE_ON
|| E3_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 4
|| E4_ENABLE_READ == E_ENABLE_ON
|| E4_ENABLE_READ == E_ENABLE_ON
#if E_STEPPERS > 5
|| E5_ENABLE_READ == E_ENABLE_ON
#endif
#endif
#endif
#endif

View File

@ -54,6 +54,9 @@ void FilamentRunoutSensor::setup() {
INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN);
#if NUM_RUNOUT_SENSORS > 4
INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN);
#if NUM_RUNOUT_SENSORS > 5
INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN);
#endif
#endif
#endif
#endif

View File

@ -71,6 +71,9 @@ class FilamentRunoutSensor {
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 5
case 5: is_out = READ(FIL_RUNOUT6_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
#endif
#endif
#endif

View File

@ -53,6 +53,11 @@ inline void enable_solenoid(const uint8_t num) {
OUT_WRITE(SOL4_PIN, HIGH);
break;
#endif
#if HAS_SOLENOID_5 && EXTRUDERS > 5
case 5:
OUT_WRITE(SOL5_PIN, HIGH);
break;
#endif
default:
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
@ -76,6 +81,9 @@ void disable_all_solenoids() {
#if HAS_SOLENOID_4 && EXTRUDERS > 4
OUT_WRITE(SOL4_PIN, LOW);
#endif
#if HAS_SOLENOID_5 && EXTRUDERS > 5
OUT_WRITE(SOL5_PIN, LOW);
#endif
}
#endif // EXT_SOLENOID

View File

@ -213,6 +213,10 @@ bool report_tmc_status = false;
static uint8_t e4_otpw_cnt = 0;
monitor_tmc_driver(stepperE4, TMC_E4, e4_otpw_cnt);
#endif
#if HAS_HW_COMMS(E5)
static uint8_t e5_otpw_cnt = 0;
monitor_tmc_driver(stepperE5, TMC_E5, e5_otpw_cnt);
#endif
if (report_tmc_status) SERIAL_EOL();
}
@ -244,6 +248,9 @@ void _tmc_say_axis(const TMC_AxisEnum axis) {
, ext_E3[] PROGMEM = "E3"
#if E_STEPPERS > 4
, ext_E4[] PROGMEM = "E4"
#if E_STEPPERS > 5
, ext_E5[] PROGMEM = "E5"
#endif
#endif
#endif
#endif
@ -274,6 +281,9 @@ void _tmc_say_axis(const TMC_AxisEnum axis) {
, ext_E3
#if E_STEPPERS > 4
, ext_E4
#if E_STEPPERS > 5
, ext_E5
#endif
#endif
#endif
#endif
@ -532,6 +542,13 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#endif
]);
#endif
#if AXIS_IS_TMC(E5)
tmc_status(stepperE5, TMC_E5, i, planner.axis_steps_per_mm[E_AXIS
#if ENABLED(DISTINCT_E_FACTORS)
+ 5
#endif
]);
#endif
SERIAL_EOL();
}
@ -576,6 +593,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#if AXIS_IS_TMC(E4)
tmc_parse_drv_status(stepperE4, TMC_E4, i);
#endif
#if AXIS_IS_TMC(E5)
tmc_parse_drv_status(stepperE5, TMC_E5, i);
#endif
SERIAL_EOL();
}
@ -693,6 +713,9 @@ void _tmc_say_sgt(const TMC_AxisEnum axis, const int8_t sgt) {
#if AXIS_DRIVER_TYPE(E4, TMC2130)
SET_CS_PIN(E4);
#endif
#if AXIS_DRIVER_TYPE(E5, TMC2130)
SET_CS_PIN(E5);
#endif
}
#endif // TMC2130

View File

@ -49,19 +49,24 @@ enum TMC_AxisEnum : char {
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
, TMC_Z3
#endif
, TMC_E0
#if E_STEPPERS > 1
, TMC_E1
#if E_STEPPERS > 2
, TMC_E2
#if E_STEPPERS > 3
, TMC_E3
#if E_STEPPERS > 4
, TMC_E4
#endif
#endif
#endif
#endif
#if E_STEPPERS
, TMC_E0
#if E_STEPPERS > 1
, TMC_E1
#if E_STEPPERS > 2
, TMC_E2
#if E_STEPPERS > 3
, TMC_E3
#if E_STEPPERS > 4
, TMC_E4
#if E_STEPPERS > 5
, TMC_E5
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
#endif // E_STEPPERS
};
constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {