Additional 5 extruders support (solenoids, microstepping)

This commit is contained in:
Scott Lahteine 2017-04-14 17:14:14 -05:00
parent fd2a0784ba
commit 0ac2b5c045
4 changed files with 81 additions and 6 deletions

View file

@ -487,15 +487,19 @@
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
#define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
#define HAS_MICROSTEPS_X (PIN_EXISTS(X_MS1))
#define HAS_MICROSTEPS_Y (PIN_EXISTS(Y_MS1))
#define HAS_MICROSTEPS_Z (PIN_EXISTS(Z_MS1))
#define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
#define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
#define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
#define HAS_MICROSTEPS_E3 (PIN_EXISTS(E3_MS1))
#define HAS_MICROSTEPS_E4 (PIN_EXISTS(E4_MS1))
#define HAS_MICROSTEPS (HAS_MICROSTEPS_X || HAS_MICROSTEPS_Y || HAS_MICROSTEPS_Z || HAS_MICROSTEPS_E0 || HAS_MICROSTEPS_E1 || HAS_MICROSTEPS_E2)
#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))

View file

@ -7599,21 +7599,26 @@ inline void gcode_M303() {
case 0:
OUT_WRITE(SOL0_PIN, HIGH);
break;
#if HAS_SOLENOID_1
#if HAS_SOLENOID_1 && EXTRUDERS > 1
case 1:
OUT_WRITE(SOL1_PIN, HIGH);
break;
#endif
#if HAS_SOLENOID_2
#if HAS_SOLENOID_2 && EXTRUDERS > 2
case 2:
OUT_WRITE(SOL2_PIN, HIGH);
break;
#endif
#if HAS_SOLENOID_3
#if HAS_SOLENOID_3 && EXTRUDERS > 3
case 3:
OUT_WRITE(SOL3_PIN, HIGH);
break;
#endif
#if HAS_SOLENOID_4 && EXTRUDERS > 4
case 4:
OUT_WRITE(SOL4_PIN, HIGH);
break;
#endif
default:
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
@ -7625,9 +7630,18 @@ inline void gcode_M303() {
void disable_all_solenoids() {
OUT_WRITE(SOL0_PIN, LOW);
#if HAS_SOLENOID_1 && EXTRUDERS > 1
OUT_WRITE(SOL1_PIN, LOW);
#endif
#if HAS_SOLENOID_2 && EXTRUDERS > 2
OUT_WRITE(SOL2_PIN, LOW);
#endif
#if HAS_SOLENOID_3 && EXTRUDERS > 3
OUT_WRITE(SOL3_PIN, LOW);
#endif
#if HAS_SOLENOID_4 && EXTRUDERS > 4
OUT_WRITE(SOL4_PIN, LOW);
#endif
}
/**

View file

@ -1076,6 +1076,9 @@ void Stepper::init() {
#if HAS_E3_STEP
E_AXIS_INIT(3);
#endif
#if HAS_E4_STEP
E_AXIS_INIT(4);
#endif
// waveform generation = 0100 = CTC
CBI(TCCR1B, WGM13);
@ -1477,6 +1480,18 @@ void Stepper::report_positions() {
SET_OUTPUT(E1_MS1_PIN);
SET_OUTPUT(E1_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E2
SET_OUTPUT(E2_MS1_PIN);
SET_OUTPUT(E2_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E3
SET_OUTPUT(E3_MS1_PIN);
SET_OUTPUT(E3_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E4
SET_OUTPUT(E4_MS1_PIN);
SET_OUTPUT(E4_MS2_PIN);
#endif
static const uint8_t microstep_modes[] = MICROSTEP_MODES;
for (uint16_t i = 0; i < COUNT(microstep_modes); i++)
microstep_mode(i, microstep_modes[i]);
@ -1497,6 +1512,15 @@ void Stepper::report_positions() {
#if HAS_MICROSTEPS_E1
case 4: WRITE(E1_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E2
case 5: WRITE(E2_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E3
case 6: WRITE(E3_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E4
case 7: WRITE(E4_MS1_PIN, ms1); break;
#endif
}
if (ms2 >= 0) switch (driver) {
case 0: WRITE(X_MS2_PIN, ms2); break;
@ -1512,6 +1536,15 @@ void Stepper::report_positions() {
#if HAS_MICROSTEPS_E1
case 4: WRITE(E1_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E2
case 5: WRITE(E2_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E3
case 6: WRITE(E3_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E4
case 7: WRITE(E4_MS2_PIN, ms2); break;
#endif
}
}
@ -1550,6 +1583,21 @@ void Stepper::report_positions() {
SERIAL_PROTOCOL(READ(E1_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E2
SERIAL_PROTOCOLPGM("E2: ");
SERIAL_PROTOCOL(READ(E2_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E2_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E3
SERIAL_PROTOCOLPGM("E3: ");
SERIAL_PROTOCOL(READ(E3_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E3_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E4
SERIAL_PROTOCOLPGM("E4: ");
SERIAL_PROTOCOL(READ(E4_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));
#endif
}
#endif // HAS_MICROSTEPS

View file

@ -226,6 +226,15 @@
#define HEATER_3_RAW_LO_TEMP 0
#endif
#endif
#ifndef HEATER_4_RAW_HI_TEMP
#ifdef HEATER_4_USES_THERMISTOR
#define HEATER_4_RAW_HI_TEMP 0
#define HEATER_4_RAW_LO_TEMP 16383
#else
#define HEATER_4_RAW_HI_TEMP 16383
#define HEATER_4_RAW_LO_TEMP 0
#endif
#endif
#ifndef HEATER_BED_RAW_HI_TEMP
#ifdef BED_USES_THERMISTOR
#define HEATER_BED_RAW_HI_TEMP 0