Add multi-extruder condition

This commit is contained in:
Scott Lahteine
2020-09-20 18:29:08 -05:00
parent 8e0fac897b
commit 76d8d1742c
50 changed files with 127 additions and 144 deletions

View File

@ -21,7 +21,7 @@ void dac084s085::begin() {
// All SPI chip-select HIGH
SET_OUTPUT(DAC0_SYNC);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC);
#endif
cshigh();
@ -38,7 +38,7 @@ void dac084s085::begin() {
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC0_SYNC, HIGH);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
//init Piggy DAC
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
@ -86,7 +86,7 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
void dac084s085::cshigh() {
WRITE(DAC0_SYNC, HIGH);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
WRITE(DAC1_SYNC, HIGH);
#endif
WRITE(SPI_EEPROM1_CS, HIGH);

View File

@ -42,7 +42,7 @@ FWRetract fwretract; // Single instance - this calls the constructor
// private:
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
bool FWRetract::retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
#endif
@ -73,9 +73,7 @@ void FWRetract::reset() {
LOOP_L_N(i, EXTRUDERS) {
retracted[i] = false;
#if EXTRUDERS > 1
retracted_swap[i] = false;
#endif
TERN_(HAS_MULTI_EXTRUDER, retracted_swap[i] = false);
current_retract[i] = 0.0;
}
}
@ -92,7 +90,7 @@ void FWRetract::reset() {
* included in the G-code. Use M207 Z0 to to prevent double hop.
*/
void FWRetract::retract(const bool retracting
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
, bool swapping/*=false*/
#endif
) {
@ -100,7 +98,7 @@ void FWRetract::retract(const bool retracting
if (retracted[active_extruder] == retracting) return;
// Prevent two swap-retract or recovers in a row
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
// Allow G10 S1 only after G11
if (swapping && retracted_swap[active_extruder] == retracting) return;
// G11 priority to recover the long retract if activated
@ -117,7 +115,7 @@ void FWRetract::retract(const bool retracting
);
LOOP_L_N(i, EXTRUDERS) {
SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]);
#endif
}
@ -180,7 +178,7 @@ void FWRetract::retract(const bool retracting
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered
// If swap retract/recover update the retracted_swap flag too
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
if (swapping) retracted_swap[active_extruder] = retracting;
#endif
@ -190,7 +188,7 @@ void FWRetract::retract(const bool retracting
SERIAL_ECHOLNPAIR("active_extruder ", active_extruder);
LOOP_L_N(i, EXTRUDERS) {
SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]);
#endif
}

View File

@ -42,7 +42,7 @@ typedef struct {
class FWRetract {
private:
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
static bool retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
#endif
@ -75,7 +75,7 @@ public:
}
static void retract(const bool retracting
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
, bool swapping = false
#endif
);

View File

@ -186,13 +186,13 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
info.active_extruder = active_extruder;
#endif
#if DISABLED(NO_VOLUMETRICS)
info.volumetric_enabled = parser.volumetric_enabled;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
for (int8_t e = 0; e < EXTRUDERS; e++) info.filament_size[e] = planner.filament_size[e];
#else
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
@ -369,7 +369,7 @@ void PrintJobRecovery::resume() {
// Recover volumetric extrusion state
#if DISABLED(NO_VOLUMETRICS)
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
for (int8_t e = 0; e < EXTRUDERS; e++) {
sprintf_P(cmd, PSTR("M200 T%i D%s"), e, dtostrf(info.filament_size[e], 1, 3, str_1));
gcode.process_subcommands_now(cmd);
@ -411,7 +411,7 @@ void PrintJobRecovery::resume() {
#endif
// Select the previously active tool (with no_move)
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
sprintf_P(cmd, PSTR("T%i S"), info.active_extruder);
gcode.process_subcommands_now(cmd);
#endif
@ -543,7 +543,7 @@ void PrintJobRecovery::resume() {
DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
DEBUG_ECHOLNPAIR("active_extruder: ", int(info.active_extruder));
#endif

View File

@ -58,7 +58,7 @@ typedef struct {
uint16_t feedrate;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
uint8_t active_extruder;
#endif