Correct HOTENDS for SWITCHING_EXTRUDER

This commit is contained in:
Scott Lahteine 2018-05-27 17:56:21 -05:00
parent 945139e328
commit 0ca9db7051
6 changed files with 44 additions and 31 deletions

View file

@ -167,7 +167,6 @@ script:
- opt_set EXTRUDERS 2
- opt_enable NUM_SERVOS
- opt_set NUM_SERVOS 1
- opt_set TEMP_SENSOR_1 1
- opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER
- build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
#
@ -421,7 +420,6 @@ script:
- opt_set EXTRUDERS 2
- opt_enable NUM_SERVOS
- opt_set NUM_SERVOS 1
- opt_set TEMP_SENSOR_1 1
- opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER
- build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
#

View file

@ -427,8 +427,16 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
&& !planner.has_blocks_queued()
) {
#if ENABLED(SWITCHING_EXTRUDER)
const bool oldstatus = E0_ENABLE_READ;
enable_E0();
bool oldstatus;
switch (active_extruder) {
default: oldstatus = E0_ENABLE_READ; enable_E0(); break;
#if E_STEPPERS > 1
case 2: case 3: oldstatus = E1_ENABLE_READ; enable_E1(); break;
#if E_STEPPERS > 2
case 4: oldstatus = E2_ENABLE_READ; enable_E2(); break;
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
}
#else // !SWITCHING_EXTRUDER
bool oldstatus;
switch (active_extruder) {
@ -454,9 +462,18 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
current_position[E_AXIS] = olde;
planner.set_e_position_mm(olde);
planner.synchronize();
#if ENABLED(SWITCHING_EXTRUDER)
E0_ENABLE_WRITE(oldstatus);
#else
switch (active_extruder) {
default: oldstatus = E0_ENABLE_WRITE(oldstatus); break;
#if E_STEPPERS > 1
case 2: case 3: oldstatus = E1_ENABLE_WRITE(oldstatus); break;
#if E_STEPPERS > 2
case 4: oldstatus = E2_ENABLE_WRITE(oldstatus); break;
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
}
#else // !SWITCHING_EXTRUDER
switch (active_extruder) {
case 0: E0_ENABLE_WRITE(oldstatus); break;
#if E_STEPPERS > 1

View file

@ -406,23 +406,8 @@
* E_MANUAL - Number of E steppers for LCD move options
*
*/
#if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#undef HOTEND_OFFSET_X
#undef HOTEND_OFFSET_Y
#else // Two hotends
#define HOTENDS EXTRUDERS
#endif
#define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++)
#if HOTENDS == 1
#define HOTEND_INDEX 0
#else
#define HOTEND_INDEX e
#endif
#if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS
#if EXTRUDERS > 4
#define E_STEPPERS 3
@ -431,6 +416,7 @@
#else
#define E_STEPPERS 1
#endif
#define HOTENDS E_STEPPERS
#define E_MANUAL EXTRUDERS
#elif ENABLED(MIXING_EXTRUDER)
#define E_STEPPERS MIXING_STEPPERS
@ -440,6 +426,18 @@
#define E_MANUAL EXTRUDERS
#endif
#if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
#undef HOTENDS
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#undef HOTEND_OFFSET_X
#undef HOTEND_OFFSET_Y
#endif
#ifndef HOTENDS
#define HOTENDS EXTRUDERS
#endif
#define DO_SWITCH_EXTRUDER (ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR))
/**

View file

@ -582,12 +582,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
/**
* Single Stepper Dual Extruder with switching servo
*/
#if ENABLED(SWITCHING_EXTRUDER)
#if ENABLED(SINGLENOZZLE)
#error "SWITCHING_EXTRUDER and SINGLENOZZLE are incompatible."
#elif NUM_SERVOS < 1
#error "SWITCHING_EXTRUDER requires NUM_SERVOS >= 1."
#endif
#if ENABLED(SWITCHING_EXTRUDER) && NUM_SERVOS < 1
#error "SWITCHING_EXTRUDER requires NUM_SERVOS >= 1."
#endif
/**

View file

@ -1841,10 +1841,8 @@ uint32_t Stepper::stepper_block_phase_isr() {
current_adv_steps++;
interval = eISR_Rate;
}
else {
interval = ADV_NEVER;
eISR_Rate = ADV_NEVER;
}
else
interval = eISR_Rate = ADV_NEVER;
}
else
interval = ADV_NEVER;

View file

@ -42,6 +42,12 @@
#define SOFT_PWM_SCALE 0
#endif
#if HOTENDS == 1
#define HOTEND_INDEX 0
#else
#define HOTEND_INDEX e
#endif
/**
* States for ADC reading in the ISR
*/