Browse Source

More updates for 8 extruders, REPEAT

pull/1/head
Scott Lahteine 5 years ago
parent
commit
f312ddfa4f
  1. 25
      Marlin/src/core/drivers.h
  2. 36
      Marlin/src/feature/tmc_util.cpp
  3. 6
      Marlin/src/gcode/feature/L6470/M122.cpp
  4. 12
      Marlin/src/gcode/feature/L6470/M906.cpp
  5. 12
      Marlin/src/gcode/feature/trinamic/M569.cpp
  6. 12
      Marlin/src/gcode/feature/trinamic/M906.cpp
  7. 6
      Marlin/src/gcode/host/M114.cpp
  8. 12
      Marlin/src/lcd/extensible_ui/ui_api.cpp
  9. 2
      Marlin/src/lcd/extensible_ui/ui_api.h
  10. 44
      Marlin/src/libs/L64XX/L64XX_Marlin.cpp
  11. 2
      Marlin/src/libs/L64XX/L64XX_Marlin.h
  12. 40
      Marlin/src/module/configuration_store.cpp
  13. 12
      Marlin/src/module/stepper/L64xx.cpp
  14. 6
      Marlin/src/module/stepper/trinamic.cpp

25
Marlin/src/core/drivers.h

@ -57,6 +57,7 @@
#define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T)
#define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T)
#define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T)
#if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE)
#define AXIS_DRIVER_TYPE_X2(T) _AXIS_DRIVER_TYPE(X2,T)
#else
@ -66,21 +67,21 @@
#define AXIS_DRIVER_TYPE_Z2(T) (NUM_Z_STEPPER_DRIVERS >= 2 && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (NUM_Z_STEPPER_DRIVERS >= 3 && _AXIS_DRIVER_TYPE(Z3,T))
#define AXIS_DRIVER_TYPE_Z4(T) (NUM_Z_STEPPER_DRIVERS >= 4 && _AXIS_DRIVER_TYPE(Z4,T))
#define AXIS_DRIVER_TYPE_E0(T) (E_STEPPERS > 0 && _AXIS_DRIVER_TYPE(E0,T))
#define AXIS_DRIVER_TYPE_E1(T) (E_STEPPERS > 1 && _AXIS_DRIVER_TYPE(E1,T))
#define AXIS_DRIVER_TYPE_E2(T) (E_STEPPERS > 2 && _AXIS_DRIVER_TYPE(E2,T))
#define AXIS_DRIVER_TYPE_E3(T) (E_STEPPERS > 3 && _AXIS_DRIVER_TYPE(E3,T))
#define AXIS_DRIVER_TYPE_E4(T) (E_STEPPERS > 4 && _AXIS_DRIVER_TYPE(E4,T))
#define AXIS_DRIVER_TYPE_E5(T) (E_STEPPERS > 5 && _AXIS_DRIVER_TYPE(E5,T))
#define AXIS_DRIVER_TYPE_E6(T) (E_STEPPERS > 6 && _AXIS_DRIVER_TYPE(E6,T))
#define AXIS_DRIVER_TYPE_E7(T) (E_STEPPERS > 7 && _AXIS_DRIVER_TYPE(E7,T))
#define AXIS_DRIVER_TYPE_E(N,T) (E_STEPPERS > N && _AXIS_DRIVER_TYPE(E##N,T))
#define AXIS_DRIVER_TYPE_E0(T) AXIS_DRIVER_TYPE_E(0,T)
#define AXIS_DRIVER_TYPE_E1(T) AXIS_DRIVER_TYPE_E(1,T)
#define AXIS_DRIVER_TYPE_E2(T) AXIS_DRIVER_TYPE_E(2,T)
#define AXIS_DRIVER_TYPE_E3(T) AXIS_DRIVER_TYPE_E(3,T)
#define AXIS_DRIVER_TYPE_E4(T) AXIS_DRIVER_TYPE_E(4,T)
#define AXIS_DRIVER_TYPE_E5(T) AXIS_DRIVER_TYPE_E(5,T)
#define AXIS_DRIVER_TYPE_E6(T) AXIS_DRIVER_TYPE_E(6,T)
#define AXIS_DRIVER_TYPE_E7(T) AXIS_DRIVER_TYPE_E(7,T)
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
#define HAS_E_DRIVER(T) ( AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) \
|| AXIS_DRIVER_TYPE_E6(T) || AXIS_DRIVER_TYPE_E7(T) )
#define _OR_ADTE(N,T) || AXIS_DRIVER_TYPE_E(N,T)
#define HAS_E_DRIVER(T) (0 RREPEAT2(E_STEPPERS, _OR_ADTE, T))
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \

36
Marlin/src/feature/tmc_util.cpp

@ -439,6 +439,12 @@
#if AXIS_IS_TMC(E5)
(void)monitor_tmc_driver(stepperE5, need_update_error_counters, need_debug_reporting);
#endif
#if AXIS_IS_TMC(E6)
(void)monitor_tmc_driver(stepperE6, need_update_error_counters, need_debug_reporting);
#endif
#if AXIS_IS_TMC(E7)
(void)monitor_tmc_driver(stepperE7, need_update_error_counters, need_debug_reporting);
#endif
#if ENABLED(TMC_DEBUG)
if (need_debug_reporting) SERIAL_EOL();
@ -782,6 +788,12 @@
#if AXIS_IS_TMC(E5)
tmc_status(stepperE5, i);
#endif
#if AXIS_IS_TMC(E6)
tmc_status(stepperE6, i);
#endif
#if AXIS_IS_TMC(E7)
tmc_status(stepperE7, i);
#endif
}
SERIAL_EOL();
@ -840,6 +852,12 @@
#if AXIS_IS_TMC(E5)
tmc_parse_drv_status(stepperE5, i);
#endif
#if AXIS_IS_TMC(E6)
tmc_parse_drv_status(stepperE6, i);
#endif
#if AXIS_IS_TMC(E7)
tmc_parse_drv_status(stepperE7, i);
#endif
}
SERIAL_EOL();
@ -1018,6 +1036,12 @@
#if AXIS_IS_TMC(E5)
tmc_get_registers(stepperE5, i);
#endif
#if AXIS_IS_TMC(E6)
tmc_get_registers(stepperE6, i);
#endif
#if AXIS_IS_TMC(E7)
tmc_get_registers(stepperE7, i);
#endif
}
SERIAL_EOL();
@ -1124,6 +1148,12 @@
#if AXIS_HAS_SPI(E5)
SET_CS_PIN(E5);
#endif
#if AXIS_HAS_SPI(E6)
SET_CS_PIN(E6);
#endif
#if AXIS_HAS_SPI(E7)
SET_CS_PIN(E7);
#endif
}
#endif // TMC_HAS_SPI
@ -1204,6 +1234,12 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
#if AXIS_IS_TMC(E5)
axis_connection += test_connection(stepperE5);
#endif
#if AXIS_IS_TMC(E6)
axis_connection += test_connection(stepperE6);
#endif
#if AXIS_IS_TMC(E7)
axis_connection += test_connection(stepperE7);
#endif
}
if (axis_connection) ui.set_status_P(GET_TEXT(MSG_ERROR_TMC));

6
Marlin/src/gcode/feature/L6470/M122.cpp

@ -136,6 +136,12 @@ void GcodeSuite::M122() {
#if AXIS_IS_L64XX(E5)
L6470_say_status(E5);
#endif
#if AXIS_IS_L64XX(E6)
L6470_say_status(E6);
#endif
#if AXIS_IS_L64XX(E7)
L6470_say_status(E7);
#endif
L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags
L64xxManager.spi_abort = false;

12
Marlin/src/gcode/feature/L6470/M906.cpp

@ -298,6 +298,12 @@ void GcodeSuite::M906() {
#if AXIS_IS_L64XX(E5)
case 5: L6470_SET_KVAL_HOLD(E5); break;
#endif
#if AXIS_IS_L64XX(E6)
case 6: L6470_SET_KVAL_HOLD(E6); break;
#endif
#if AXIS_IS_L64XX(E7)
case 7: L6470_SET_KVAL_HOLD(E7); break;
#endif
}
} break;
}
@ -350,6 +356,12 @@ void GcodeSuite::M906() {
#if AXIS_IS_L64XX(E5)
L64XX_REPORT_CURRENT(E5);
#endif
#if AXIS_IS_L64XX(E6)
L64XX_REPORT_CURRENT(E6);
#endif
#if AXIS_IS_L64XX(E7)
L64XX_REPORT_CURRENT(E7);
#endif
L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags
L64xxManager.spi_abort = false;

12
Marlin/src/gcode/feature/trinamic/M569.cpp

@ -104,6 +104,12 @@ static void set_stealth_status(const bool enable, const int8_t target_extruder)
#if AXIS_HAS_STEALTHCHOP(E5)
case 5: TMC_SET_STEALTH(E5); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
case 6: TMC_SET_STEALTH(E6); break;
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
case 7: TMC_SET_STEALTH(E7); break;
#endif
}
} break;
}
@ -155,6 +161,12 @@ static void say_stealth_status() {
#if AXIS_HAS_STEALTHCHOP(E5)
TMC_SAY_STEALTH_STATUS(E5);
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
TMC_SAY_STEALTH_STATUS(E6);
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
TMC_SAY_STEALTH_STATUS(E7);
#endif
}
/**

12
Marlin/src/gcode/feature/trinamic/M906.cpp

@ -107,6 +107,12 @@ void GcodeSuite::M906() {
#if AXIS_IS_TMC(E5)
case 5: TMC_SET_CURRENT(E5); break;
#endif
#if AXIS_IS_TMC(E6)
case 6: TMC_SET_CURRENT(E6); break;
#endif
#if AXIS_IS_TMC(E7)
case 7: TMC_SET_CURRENT(E7); break;
#endif
}
} break;
}
@ -155,6 +161,12 @@ void GcodeSuite::M906() {
#if AXIS_IS_TMC(E5)
TMC_SAY_CURRENT(E5);
#endif
#if AXIS_IS_TMC(E6)
TMC_SAY_CURRENT(E6);
#endif
#if AXIS_IS_TMC(E7)
TMC_SAY_CURRENT(E7);
#endif
}
}

6
Marlin/src/gcode/host/M114.cpp

@ -142,6 +142,12 @@
#if AXIS_IS_L64XX(E5)
REPORT_ABSOLUTE_POS(E5);
#endif
#if AXIS_IS_L64XX(E6)
REPORT_ABSOLUTE_POS(E6);
#endif
#if AXIS_IS_L64XX(E7)
REPORT_ABSOLUTE_POS(E7);
#endif
SERIAL_EOL();
#endif // HAS_L64XX

12
Marlin/src/lcd/extensible_ui/ui_api.cpp

@ -481,6 +481,12 @@ namespace ExtUI {
#if AXIS_IS_TMC(E5)
case E5: return stepperE5.getMilliamps();
#endif
#if AXIS_IS_TMC(E6)
case E6: return stepperE6.getMilliamps();
#endif
#if AXIS_IS_TMC(E7)
case E7: return stepperE7.getMilliamps();
#endif
default: return NAN;
};
}
@ -520,6 +526,12 @@ namespace ExtUI {
#if AXIS_IS_TMC(E5)
case E5: stepperE5.rms_current(constrain(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E6)
case E6: stepperE6.rms_current(constrain(mA, 500, 1500)); break;
#endif
#if AXIS_IS_TMC(E7)
case E7: stepperE7.rms_current(constrain(mA, 500, 1500)); break;
#endif
default: break;
};
}

2
Marlin/src/lcd/extensible_ui/ui_api.h

@ -53,7 +53,7 @@ namespace ExtUI {
static constexpr size_t eeprom_data_size = 48;
enum axis_t : uint8_t { X, Y, Z };
enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 };
enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5, E6, E7 };
enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER };
enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7 };
enum result_t : uint8_t { PID_BAD_EXTRUDER_NUM, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE };

44
Marlin/src/libs/L64XX/L64XX_Marlin.cpp

@ -127,6 +127,12 @@ void L6470_populate_chain_array() {
#if AXIS_IS_L64XX(E5)
_L6470_INIT_SPI(E5);
#endif
#if AXIS_IS_L64XX(E6)
_L6470_INIT_SPI(E6);
#endif
#if AXIS_IS_L64XX(E7)
_L6470_INIT_SPI(E7);
#endif
}
@ -240,6 +246,12 @@ uint16_t L64XX_Marlin::get_status(const L64XX_axis_t axis) {
#if AXIS_IS_L64XX(E5)
case E5: return STATUS_L6470(E5);
#endif
#if AXIS_IS_L64XX(E6)
case E6: return STATUS_L6470(E6);
#endif
#if AXIS_IS_L64XX(E7)
case E7: return STATUS_L6470(E7);
#endif
}
return 0; // Not needed but kills a compiler warning
@ -293,6 +305,12 @@ uint32_t L64XX_Marlin::get_param(const L64XX_axis_t axis, const uint8_t param) {
#if AXIS_IS_L64XX(E5)
case E5: return GET_L6470_PARAM(E5);
#endif
#if AXIS_IS_L64XX(E6)
case E6: return GET_L6470_PARAM(E6);
#endif
#if AXIS_IS_L64XX(E7)
case E7: return GET_L6470_PARAM(E7);
#endif
}
return 0; // not needed but kills a compiler warning
@ -346,6 +364,12 @@ void L64XX_Marlin::set_param(const L64XX_axis_t axis, const uint8_t param, const
#if AXIS_IS_L64XX(E5)
case E5: SET_L6470_PARAM(E5); break;
#endif
#if AXIS_IS_L64XX(E6)
case E6: SET_L6470_PARAM(E6); break;
#endif
#if AXIS_IS_L64XX(E7)
case E7: SET_L6470_PARAM(E7); break;
#endif
}
}
@ -694,25 +718,31 @@ void L64XX_Marlin::say_axis(const L64XX_axis_t axis, const uint8_t label/*=true*
{ 6, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(Z4)
{ 6, 0, 0, 0, 0, 0, 0 },
{ 7, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E0)
{ 7, 0, 0, 0, 0, 0, 0 },
{ 8, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E1)
{ 8, 0, 0, 0, 0, 0, 0 },
{ 9, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E2)
{ 9, 0, 0, 0, 0, 0, 0 },
{ 10, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E3)
{ 10, 0, 0, 0, 0, 0, 0 },
{ 11, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E4)
{ 11, 0, 0, 0, 0, 0, 0 },
{ 12, 0, 0, 0, 0, 0, 0 },
#endif
#if AXIS_IS_L64XX(E5)
{ 12, 0, 0, 0, 0, 0, 0 }
{ 13, 0, 0, 0, 0, 0, 0 }
#endif
#if AXIS_IS_L64XX(E6)
{ 14, 0, 0, 0, 0, 0, 0 }
#endif
#if AXIS_IS_L64XX(E7)
{ 16, 0, 0, 0, 0, 0, 0 }
#endif
};

2
Marlin/src/libs/L64XX/L64XX_Marlin.h

@ -33,7 +33,7 @@
#define dSPIN_STEP_CLOCK 0x58
#define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
#define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
#define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5))
#define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5) || AXIS_IS_L64XX(E6) || AXIS_IS_L64XX(E7))
enum L64XX_axis_t : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5, E6, E7, MAX_L64XX };

40
Marlin/src/module/configuration_store.cpp

@ -1905,6 +1905,12 @@ void MarlinSettings::postprocess() {
#if AXIS_IS_TMC(E5)
SET_CURR(E5);
#endif
#if AXIS_IS_TMC(E6)
SET_CURR(E6);
#endif
#if AXIS_IS_TMC(E7)
SET_CURR(E7);
#endif
}
#endif
}
@ -1959,6 +1965,12 @@ void MarlinSettings::postprocess() {
#if AXIS_HAS_STEALTHCHOP(E5)
stepperE5.set_pwm_thrs(tmc_hybrid_threshold.E5);
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
stepperE6.set_pwm_thrs(tmc_hybrid_threshold.E6);
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
stepperE7.set_pwm_thrs(tmc_hybrid_threshold.E7);
#endif
}
#endif
}
@ -2065,6 +2077,12 @@ void MarlinSettings::postprocess() {
#if AXIS_HAS_STEALTHCHOP(E5)
SET_STEPPING_MODE(E5);
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
SET_STEPPING_MODE(E6);
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
SET_STEPPING_MODE(E7);
#endif
}
#endif
}
@ -3333,6 +3351,14 @@ void MarlinSettings::reset() {
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T5 E", stepperE5.getMilliamps());
#endif
#if AXIS_IS_TMC(E6)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T6 E", stepperE6.getMilliamps());
#endif
#if AXIS_IS_TMC(E7)
say_M906(forReplay);
SERIAL_ECHOLNPAIR(" T7 E", stepperE7.getMilliamps());
#endif
SERIAL_EOL();
/**
@ -3407,6 +3433,14 @@ void MarlinSettings::reset() {
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T5 E", stepperE5.get_pwm_thrs());
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T6 E", stepperE6.get_pwm_thrs());
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
say_M913(forReplay);
SERIAL_ECHOLNPAIR(" T7 E", stepperE7.get_pwm_thrs());
#endif
SERIAL_EOL();
#endif // HYBRID_THRESHOLD
@ -3539,6 +3573,12 @@ void MarlinSettings::reset() {
#if AXIS_HAS_STEALTHCHOP(E5)
if (stepperE5.get_stealthChop_status()) { say_M569(forReplay, PSTR("T5 E"), true); }
#endif
#if AXIS_HAS_STEALTHCHOP(E6)
if (stepperE6.get_stealthChop_status()) { say_M569(forReplay, PSTR("T6 E"), true); }
#endif
#if AXIS_HAS_STEALTHCHOP(E7)
if (stepperE7.get_stealthChop_status()) { say_M569(forReplay, PSTR("T7 E"), true); }
#endif
#endif // HAS_STEALTHCHOP

12
Marlin/src/module/stepper/L64xx.cpp

@ -73,6 +73,12 @@
#if AXIS_IS_L64XX(E5)
L64XX_CLASS(E5) stepperE5(L6470_CHAIN_SS_PIN);
#endif
#if AXIS_IS_L64XX(E6)
L64XX_CLASS(E6) stepperE6(L6470_CHAIN_SS_PIN);
#endif
#if AXIS_IS_L64XX(E7)
L64XX_CLASS(E7) stepperE7(L6470_CHAIN_SS_PIN);
#endif
// Not using L64XX class init method because it
// briefly sends power to the steppers
@ -208,6 +214,12 @@ void L64XX_Marlin::init_to_defaults() {
#if AXIS_IS_L64XX(E5)
L6470_INIT_CHIP(E5);
#endif
#if AXIS_IS_L64XX(E6)
L6470_INIT_CHIP(E6);
#endif
#if AXIS_IS_L64XX(E7)
L6470_INIT_CHIP(E7);
#endif
}
#endif // HAS_L64XX

6
Marlin/src/module/stepper/trinamic.cpp

@ -109,6 +109,12 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#if AXIS_HAS_SPI(E5)
TMC_SPI_DEFINE_E(5);
#endif
#if AXIS_HAS_SPI(E6)
TMC_SPI_DEFINE_E(6);
#endif
#if AXIS_HAS_SPI(E7)
TMC_SPI_DEFINE_E(7);
#endif
#ifndef TMC_BAUD_RATE
#define TMC_BAUD_RATE 115200

Loading…
Cancel
Save