From 04050237f0e0faa015b7a32109a0e014f48927af Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 6 Apr 2017 16:46:30 -0500 Subject: [PATCH] Header and pins changes to support 5 extruders --- Marlin/Marlin.h | 10 ++++++++++ Marlin/enum.h | 2 ++ Marlin/language.h | 5 +++++ Marlin/macros.h | 10 ++++++---- Marlin/pins.h | 27 +++++++++++++++------------ Marlin/pins_AZTEEG_X3_PRO.h | 4 ++++ Marlin/stepper_indirection.h | 10 +++++++++- Marlin/thermistortable_20.h | 4 ++++ Marlin/thermistortables.h | 12 +++++++++++- 9 files changed, 66 insertions(+), 18 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index d2b168b42..da2d4d9ea 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -113,6 +113,8 @@ void manage_inactivity(bool ignore_stepper_queue = false); #define disable_e2() NOOP #define enable_e3() NOOP #define disable_e3() NOOP + #define enable_e4() NOOP + #define disable_e4() NOOP #else // !MIXING_EXTRUDER @@ -148,6 +150,14 @@ void manage_inactivity(bool ignore_stepper_queue = false); #define disable_e3() NOOP #endif + #if E_STEPPERS > 4 && HAS_E4_ENABLE + #define enable_e4() E4_ENABLE_WRITE( E_ENABLE_ON) + #define disable_e4() E4_ENABLE_WRITE(!E_ENABLE_ON) + #else + #define enable_e4() NOOP + #define disable_e4() NOOP + #endif + #endif // !MIXING_EXTRUDER #if ENABLED(G38_PROBE_TARGET) diff --git a/Marlin/enum.h b/Marlin/enum.h index 542f10f8d..bad4b4dcf 100755 --- a/Marlin/enum.h +++ b/Marlin/enum.h @@ -106,6 +106,8 @@ enum TempState { MeasureTemp_2, PrepareTemp_3, MeasureTemp_3, + PrepareTemp_4, + MeasureTemp_4, Prepare_FILWIDTH, Measure_FILWIDTH, StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle diff --git a/Marlin/language.h b/Marlin/language.h index b415adf1b..96865fb2f 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -268,22 +268,27 @@ #define MSG_H2 "2" #define MSG_H3 "3" #define MSG_H4 "4" +#define MSG_H5 "5" #define MSG_N1 " 1" #define MSG_N2 " 2" #define MSG_N3 " 3" #define MSG_N4 " 4" +#define MSG_N5 " 5" #define MSG_E1 "E1" #define MSG_E2 "E2" #define MSG_E3 "E3" #define MSG_E4 "E4" +#define MSG_E5 "E5" #define MSG_MOVE_E1 "1" #define MSG_MOVE_E2 "2" #define MSG_MOVE_E3 "3" #define MSG_MOVE_E4 "4" +#define MSG_MOVE_E5 "5" #define MSG_DIAM_E1 " 1" #define MSG_DIAM_E2 " 2" #define MSG_DIAM_E3 " 3" #define MSG_DIAM_E4 " 4" +#define MSG_DIAM_E5 " 5" #include INCLUDE_LANGUAGE diff --git a/Marlin/macros.h b/Marlin/macros.h index 18c5364a1..d84c277d5 100644 --- a/Marlin/macros.h +++ b/Marlin/macros.h @@ -128,10 +128,12 @@ #define CEILING(x,y) (((x) + (y) - 1) / (y)) -#define MIN3(a, b, c) min(min(a, b), c) -#define MIN4(a, b, c, d) min(min(a, b), min(c, d)) -#define MAX3(a, b, c) max(max(a, b), c) -#define MAX4(a, b, c, d) max(max(a, b), max(c, d)) +#define MIN3(a, b, c) min(min(a, b), c) +#define MIN4(a, b, c, d) min(MIN3(a, b, c), d) +#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e) +#define MAX3(a, b, c) max(max(a, b), c) +#define MAX4(a, b, c, d) max(MAX3(a, b, c), d) +#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e) #define UNEAR_ZERO(x) ((x) < 0.000001) #define NEAR_ZERO(x) WITHIN(x, -0.000001, 0.000001) diff --git a/Marlin/pins.h b/Marlin/pins.h index 6548bec46..1e2030a86 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -252,6 +252,9 @@ #ifndef TEMP_3_PIN #define TEMP_3_PIN -1 #endif +#ifndef TEMP_4_PIN + #define TEMP_4_PIN -1 +#endif #ifndef TEMP_BED_PIN #define TEMP_BED_PIN -1 #endif @@ -279,7 +282,7 @@ #endif #ifndef MAX_EXTRUDERS - #define MAX_EXTRUDERS 4 + #define MAX_EXTRUDERS 5 #endif // Marlin needs to account for pins that equal -1 @@ -320,10 +323,10 @@ #if EXTRUDERS > 4 #undef _E4_PINS #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, - #endif - #endif - #endif -#endif + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 +#endif // EXTRUDERS > 1 #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN), #define _H1_PINS @@ -343,9 +346,9 @@ #if HOTENDS > 4 #undef _H4_PINS #define _H4_PINS HEATER_4_PIN, marlinAnalogInputToDigitalPin(TEMP_4_PIN), - #endif - #endif - #endif + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 #elif ENABLED(MIXING_EXTRUDER) #undef _E1_PINS #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, @@ -358,10 +361,10 @@ #if MIXING_STEPPERS > 4 #undef _E4_PINS #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, - #endif - #endif - #endif -#endif + #endif // MIXING_STEPPERS > 4 + #endif // MIXING_STEPPERS > 3 + #endif // MIXING_STEPPERS > 2 +#endif // MIXING_STEPPERS > 1 #define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN), diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index 06c293410..2d57a588d 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -24,6 +24,10 @@ * AZTEEG_X3_PRO (Arduino Mega) pin assignments */ +#if HOTENDS > 5 || E_STEPPERS > 5 + #error "Azteeg X3 Pro supports up to 5 hotends / E-steppers. Comment out this line to continue." +#endif + #define BOARD_NAME "Azteeg X3 Pro" #include "pins_RAMPS.h" diff --git a/Marlin/stepper_indirection.h b/Marlin/stepper_indirection.h index 5b9a1715f..22056072c 100644 --- a/Marlin/stepper_indirection.h +++ b/Marlin/stepper_indirection.h @@ -388,6 +388,10 @@ #define E_STEP_WRITE(v) E0_STEP_WRITE(v) #define NORM_E_DIR() E0_DIR_WRITE(current_block->active_extruder ? INVERT_E0_DIR : !INVERT_E0_DIR) #define REV_E_DIR() E0_DIR_WRITE(current_block->active_extruder ? !INVERT_E0_DIR : INVERT_E0_DIR) +#elif EXTRUDERS > 4 + #define E_STEP_WRITE(v) { switch (current_block->active_extruder) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); break; case 4: E4_STEP_WRITE(v); } } + #define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(!INVERT_E4_DIR); } } + #define REV_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(INVERT_E4_DIR); } } #elif EXTRUDERS > 3 #define E_STEP_WRITE(v) { switch (current_block->active_extruder) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); } } #define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); } } @@ -408,7 +412,11 @@ #endif #elif ENABLED(MIXING_EXTRUDER) #define E_STEP_WRITE(v) NOOP /* not used for mixing extruders! */ - #if MIXING_STEPPERS > 3 + #if MIXING_STEPPERS > 4 + #define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); break; case 4: E4_STEP_WRITE(v); } } + #define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); E2_DIR_WRITE(!INVERT_E2_DIR); E3_DIR_WRITE(!INVERT_E3_DIR); E4_DIR_WRITE(!INVERT_E4_DIR); } + #define REV_E_DIR() { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); E2_DIR_WRITE( INVERT_E2_DIR); E3_DIR_WRITE( INVERT_E3_DIR); E4_DIR_WRITE( INVERT_E4_DIR); } + #elif MIXING_STEPPERS > 3 #define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); } } #define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); E2_DIR_WRITE(!INVERT_E2_DIR); E3_DIR_WRITE(!INVERT_E3_DIR); } #define REV_E_DIR() { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); E2_DIR_WRITE( INVERT_E2_DIR); E3_DIR_WRITE( INVERT_E3_DIR); } diff --git a/Marlin/thermistortable_20.h b/Marlin/thermistortable_20.h index 65f77cebd..9ec51d238 100644 --- a/Marlin/thermistortable_20.h +++ b/Marlin/thermistortable_20.h @@ -39,6 +39,10 @@ #define HEATER_3_RAW_HI_TEMP 16383 #define HEATER_3_RAW_LO_TEMP 0 #endif +#if (THERMISTORHEATER_4 == 20) + #define HEATER_4_RAW_HI_TEMP 16383 + #define HEATER_4_RAW_LO_TEMP 0 +#endif #if (THERMISTORBED == 20) #define HEATER_BED_RAW_HI_TEMP 16383 #define HEATER_BED_RAW_LO_TEMP 0 diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 421cfb7b7..05ec9a30a 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -28,7 +28,7 @@ #define OVERSAMPLENR 16 -#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORBED == n) +#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n) // Pt1000 and Pt100 handling // @@ -168,6 +168,16 @@ #define HEATER_3_TEMPTABLE_LEN 0 #endif +#ifdef THERMISTORHEATER_4 + #define HEATER_4_TEMPTABLE TT_NAME(THERMISTORHEATER_4) + #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE) +#elif defined(HEATER_4_USES_THERMISTOR) + #error "No heater 4 thermistor table specified" +#else + #define HEATER_4_TEMPTABLE NULL + #define HEATER_4_TEMPTABLE_LEN 0 +#endif + #ifdef THERMISTORBED #define BEDTEMPTABLE TT_NAME(THERMISTORBED) #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)