From fbeea120268d66e2deb4a7a6142f753a1059e1ce Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 26 May 2018 23:30:26 -0500 Subject: [PATCH] Correct HOTENDS for SWITCHING_EXTRUDER --- .travis.yml | 1 - Marlin/Conditionals_LCD.h | 22 +++++++++++++--------- Marlin/Marlin_main.cpp | 26 +++++++++++++++++++++----- Marlin/stepper.cpp | 6 ++---- Marlin/temperature.h | 2 -- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca1b14886..ac785633f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -206,7 +206,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 # diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index 2ea7254ad..fb1a4f4f8 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -396,15 +396,6 @@ * 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 - #if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS #if EXTRUDERS > 4 #define E_STEPPERS 3 @@ -413,6 +404,7 @@ #else #define E_STEPPERS 1 #endif + #define HOTENDS E_STEPPERS #define E_MANUAL EXTRUDERS #elif ENABLED(MIXING_EXTRUDER) #define E_STEPPERS MIXING_STEPPERS @@ -422,6 +414,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)) /** diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1ccf7ff5c..08f6313e6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -14005,8 +14005,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) { @@ -14031,11 +14039,19 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { planner.buffer_line_kinematic(current_position, MMM_TO_MMS(EXTRUDER_RUNOUT_SPEED), active_extruder); 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 diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 62324dec1..60c325342 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1804,10 +1804,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; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index c30bb396c..816e214bd 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -51,10 +51,8 @@ #if HOTENDS == 1 #define HOTEND_INDEX 0 - #define EXTRUDER_IDX 0 #else #define HOTEND_INDEX e - #define EXTRUDER_IDX active_extruder #endif /**