From 3e079660b0bf1fa4be133535bc96057ab690cb97 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 1 Mar 2017 14:46:44 -0600 Subject: [PATCH 1/8] Never define SLED_PIN --- Marlin/pins_MEGATRONICS_3.h | 2 -- Marlin/pins_RAMBO.h | 4 ---- Marlin/pins_RAMPS.h | 2 -- Marlin/pins_SANGUINOLOLU_11.h | 7 ------- Marlin/pins_SCOOVO_X9H.h | 2 -- 5 files changed, 17 deletions(-) diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index cc1c947bd4..419f80ba59 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -61,8 +61,6 @@ #define Z_MIN_PROBE_PIN 19 #endif -#define SLED_PIN -1 - // // Steppers // diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index 8289940752..e4df16677f 100755 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -63,10 +63,6 @@ #define Z_MIN_PROBE_PIN 30 #endif -#if ENABLED(Z_PROBE_SLED) - #define SLED_PIN -1 -#endif - // // Limit Switches // diff --git a/Marlin/pins_RAMPS.h b/Marlin/pins_RAMPS.h index da14a6dab2..767e990857 100644 --- a/Marlin/pins_RAMPS.h +++ b/Marlin/pins_RAMPS.h @@ -85,8 +85,6 @@ #define Z_MIN_PROBE_PIN 32 #endif -#define SLED_PIN -1 - // // Steppers // diff --git a/Marlin/pins_SANGUINOLOLU_11.h b/Marlin/pins_SANGUINOLOLU_11.h index b7315fba75..62d92b61e8 100644 --- a/Marlin/pins_SANGUINOLOLU_11.h +++ b/Marlin/pins_SANGUINOLOLU_11.h @@ -41,13 +41,6 @@ #define Y_STOP_PIN 19 #define Z_STOP_PIN 20 -// -// Z Probe (when not Z_MIN_PIN) -// -#if ENABLED(Z_PROBE_SLED) - #define SLED_PIN -1 -#endif - // // Steppers // diff --git a/Marlin/pins_SCOOVO_X9H.h b/Marlin/pins_SCOOVO_X9H.h index dcb36a24a9..a5ef15236b 100644 --- a/Marlin/pins_SCOOVO_X9H.h +++ b/Marlin/pins_SCOOVO_X9H.h @@ -57,8 +57,6 @@ #define Z_MIN_PROBE_PIN 30 #endif -#define SLED_PIN -1 - // // Steppers // From 19d0c6a0c05d7fc3b67bb8300805a458727ec4f5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 16:54:53 -0500 Subject: [PATCH 2/8] Patch to init W with RGBW_LED --- Marlin/Marlin_main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 36fcc70c30..a4e4e188fb 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -11451,10 +11451,13 @@ void setup() { OUT_WRITE(STAT_LED_BLUE_PIN, LOW); // turn it off #endif - #if ENABLED(RGB_LED) + #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) SET_OUTPUT(RGB_LED_R_PIN); SET_OUTPUT(RGB_LED_G_PIN); SET_OUTPUT(RGB_LED_B_PIN); + #if ENABLED(RGBW_LED) + SET_OUTPUT(RGB_LED_W_PIN); + #endif #endif lcd_init(); From ea734f910bb2ed28817c83403fbf3814b68e0208 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 16:36:12 -0500 Subject: [PATCH 3/8] Use direct pin manipulation whenever possible --- Marlin/Marlin_main.cpp | 12 ++++++------ Marlin/stepper.cpp | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a4e4e188fb..593181b58c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -963,15 +963,15 @@ void servo_init() { // This variant uses 3 separate pins for the RGB components. // If the pins can do PWM then their intensity will be set. - digitalWrite(RGB_LED_R_PIN, r ? HIGH : LOW); - digitalWrite(RGB_LED_G_PIN, g ? HIGH : LOW); - digitalWrite(RGB_LED_B_PIN, b ? HIGH : LOW); + WRITE(RGB_LED_R_PIN, r ? HIGH : LOW); + WRITE(RGB_LED_G_PIN, g ? HIGH : LOW); + WRITE(RGB_LED_B_PIN, b ? HIGH : LOW); analogWrite(RGB_LED_R_PIN, r); analogWrite(RGB_LED_G_PIN, g); analogWrite(RGB_LED_B_PIN, b); #if ENABLED(RGBW_LED) - digitalWrite(RGB_LED_W_PIN, w ? HIGH : LOW); + WRITE(RGB_LED_W_PIN, w ? HIGH : LOW); analogWrite(RGB_LED_W_PIN, w); #endif @@ -8548,7 +8548,7 @@ inline void gcode_M907() { uint8_t case_light_brightness = 255; void update_case_light() { - digitalWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW); + WRITE(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? HIGH : LOW); analogWrite(CASE_LIGHT_PIN, case_light_on != INVERT_CASE_LIGHT ? case_light_brightness : 0); } @@ -10739,7 +10739,7 @@ void prepare_move_to_destination() { uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; // allows digital or PWM fan output to be used (see M42 handling) - digitalWrite(CONTROLLERFAN_PIN, speed); + WRITE(CONTROLLERFAN_PIN, speed); analogWrite(CONTROLLERFAN_PIN, speed); } } diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index ed235ca345..339e6bf9b9 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1484,33 +1484,33 @@ void Stepper::report_positions() { void Stepper::microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { if (ms1 >= 0) switch (driver) { - case 0: digitalWrite(X_MS1_PIN, ms1); break; + case 0: WRITE(X_MS1_PIN, ms1); break; #if HAS_MICROSTEPS_Y - case 1: digitalWrite(Y_MS1_PIN, ms1); break; + case 1: WRITE(Y_MS1_PIN, ms1); break; #endif #if HAS_MICROSTEPS_Z - case 2: digitalWrite(Z_MS1_PIN, ms1); break; + case 2: WRITE(Z_MS1_PIN, ms1); break; #endif #if HAS_MICROSTEPS_E0 - case 3: digitalWrite(E0_MS1_PIN, ms1); break; + case 3: WRITE(E0_MS1_PIN, ms1); break; #endif #if HAS_MICROSTEPS_E1 - case 4: digitalWrite(E1_MS1_PIN, ms1); break; + case 4: WRITE(E1_MS1_PIN, ms1); break; #endif } if (ms2 >= 0) switch (driver) { - case 0: digitalWrite(X_MS2_PIN, ms2); break; + case 0: WRITE(X_MS2_PIN, ms2); break; #if HAS_MICROSTEPS_Y - case 1: digitalWrite(Y_MS2_PIN, ms2); break; + case 1: WRITE(Y_MS2_PIN, ms2); break; #endif #if HAS_MICROSTEPS_Z - case 2: digitalWrite(Z_MS2_PIN, ms2); break; + case 2: WRITE(Z_MS2_PIN, ms2); break; #endif #if HAS_MICROSTEPS_E0 - case 3: digitalWrite(E0_MS2_PIN, ms2); break; + case 3: WRITE(E0_MS2_PIN, ms2); break; #endif #if HAS_MICROSTEPS_E1 - case 4: digitalWrite(E1_MS2_PIN, ms2); break; + case 4: WRITE(E1_MS2_PIN, ms2); break; #endif } } From 5803ba43a9663a8f54d157e3280666fb8996abbc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 17:21:19 -0500 Subject: [PATCH 4/8] Expose EXT_SOLENOID as an advanced option --- Marlin/Configuration_adv.h | 6 +++++- Marlin/example_configurations/Cartesio/Configuration_adv.h | 6 +++++- Marlin/example_configurations/Felix/Configuration_adv.h | 6 +++++- Marlin/example_configurations/Hephestos/Configuration_adv.h | 6 +++++- .../example_configurations/Hephestos_2/Configuration_adv.h | 6 +++++- Marlin/example_configurations/K8200/Configuration_adv.h | 6 +++++- Marlin/example_configurations/K8400/Configuration_adv.h | 6 +++++- Marlin/example_configurations/RigidBot/Configuration_adv.h | 6 +++++- Marlin/example_configurations/SCARA/Configuration_adv.h | 6 +++++- Marlin/example_configurations/TAZ4/Configuration_adv.h | 6 +++++- Marlin/example_configurations/TinyBoy2/Configuration_adv.h | 6 +++++- Marlin/example_configurations/WITBOX/Configuration_adv.h | 6 +++++- .../delta/flsun_kossel_mini/Configuration_adv.h | 6 +++++- .../delta/generic/Configuration_adv.h | 6 +++++- .../delta/kossel_mini/Configuration_adv.h | 6 +++++- .../delta/kossel_pro/Configuration_adv.h | 6 +++++- .../delta/kossel_xl/Configuration_adv.h | 6 +++++- Marlin/example_configurations/makibox/Configuration_adv.h | 6 +++++- .../tvrrug/Round2/Configuration_adv.h | 6 +++++- Marlin/example_configurations/wt150/Configuration_adv.h | 6 +++++- 20 files changed, 100 insertions(+), 20 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 6c77f907c9..e04620dcaa 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 649bf4e869..bfaa39d4c4 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index b470e2f21a..3c2610e831 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 9aa2652edb..95c0c5c05e 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 0d23aa8c00..c5d3f5c6c8 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index edf8e4dd46..6616b12bfb 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -340,7 +340,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index 0ab0ebdf0e..7db7af3110 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index e1c9e74dd1..2badf51885 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index a98ad89af9..ba87a8daa1 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 68a12319ac..e3fcad9811 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -335,7 +335,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h index 8042ed2e01..4133091a0d 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration_adv.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 9aa2652edb..95c0c5c05e 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h index a529d6f5a5..6faad15106 100644 --- a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d06c258dd3..b95998e397 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d06c258dd3..b95998e397 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index e7a2485c80..c984b940fa 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -332,7 +332,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 492677ea2b..d7fb200cb0 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index a9020e110f..c22d6add27 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index d2fe7ae861..c85d848d00 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing diff --git a/Marlin/example_configurations/wt150/Configuration_adv.h b/Marlin/example_configurations/wt150/Configuration_adv.h index b64d491527..605eaee934 100644 --- a/Marlin/example_configurations/wt150/Configuration_adv.h +++ b/Marlin/example_configurations/wt150/Configuration_adv.h @@ -327,7 +327,11 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif //DUAL_X_CARRIAGE +#endif // DUAL_X_CARRIAGE + +// Activate a solenoid on the active extruder with M380. Disable all with M381. +// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. +//#define EXT_SOLENOID // @section homing From fd2a0784ba077abeec262cf4f023ff32baa93a28 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 16:36:02 -0500 Subject: [PATCH 5/8] Add support for SOLENOID_PROBE --- Marlin/Conditionals_LCD.h | 2 +- Marlin/Configuration.h | 3 +++ Marlin/Marlin_main.cpp | 20 ++++++++++++------- Marlin/SanityCheck.h | 16 +++++++++++++++ .../Cartesio/Configuration.h | 3 +++ .../Felix/Configuration.h | 3 +++ .../Felix/DUAL/Configuration.h | 3 +++ .../Hephestos/Configuration.h | 3 +++ .../Hephestos_2/Configuration.h | 3 +++ .../K8200/Configuration.h | 3 +++ .../K8400/Configuration.h | 3 +++ .../K8400/Dual-head/Configuration.h | 3 +++ .../RepRapWorld/Megatronics/Configuration.h | 3 +++ .../RigidBot/Configuration.h | 3 +++ .../SCARA/Configuration.h | 3 +++ .../TAZ4/Configuration.h | 3 +++ .../TinyBoy2/Configuration.h | 3 +++ .../WITBOX/Configuration.h | 3 +++ .../adafruit/ST7565/Configuration.h | 3 +++ .../delta/flsun_kossel_mini/Configuration.h | 3 +++ .../delta/generic/Configuration.h | 3 +++ .../delta/kossel_mini/Configuration.h | 3 +++ .../delta/kossel_pro/Configuration.h | 3 +++ .../delta/kossel_xl/Configuration.h | 3 +++ .../makibox/Configuration.h | 3 +++ .../tvrrug/Round2/Configuration.h | 3 +++ .../wt150/Configuration.h | 3 +++ 27 files changed, 102 insertions(+), 8 deletions(-) diff --git a/Marlin/Conditionals_LCD.h b/Marlin/Conditionals_LCD.h index d69b1b1ec7..734df230fe 100644 --- a/Marlin/Conditionals_LCD.h +++ b/Marlin/Conditionals_LCD.h @@ -374,7 +374,7 @@ /** * Set a flag for any enabled probe */ - #define PROBE_SELECTED (ENABLED(PROBE_MANUALLY) || ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED)) + #define PROBE_SELECTED (ENABLED(PROBE_MANUALLY) || ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) /** * Clear probe pin settings when no probe is selected diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index cc57bff662..0fca8aa5b0 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -593,6 +593,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 593181b58c..6b9152cd8d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1854,8 +1854,8 @@ static void clean_up_after_endstop_or_probe_move() { // Dock sled a bit closer to ensure proper capturing do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET - ((stow) ? 1 : 0)); - #if PIN_EXISTS(SLED) - digitalWrite(SLED_PIN, !stow); // switch solenoid + #if HAS_SOLENOID_1 && DISABLED(EXT_SOLENOID) + WRITE(SOL1_PIN, !stow); // switch solenoid #endif } @@ -2123,7 +2123,13 @@ static void clean_up_after_endstop_or_probe_move() { // otherwise an Allen-Key probe can't be stowed. #endif - #if ENABLED(Z_PROBE_SLED) + #if ENABLED(SOLENOID_PROBE) + + #if HAS_SOLENOID_1 + WRITE(SOL1_PIN, deploy); + #endif + + #elif ENABLED(Z_PROBE_SLED) dock_sled(!deploy); @@ -7588,7 +7594,7 @@ inline void gcode_M303() { #if ENABLED(EXT_SOLENOID) - void enable_solenoid(uint8_t num) { + void enable_solenoid(const uint8_t num) { switch (num) { case 0: OUT_WRITE(SOL0_PIN, HIGH); @@ -11437,9 +11443,9 @@ void setup() { dac_init(); #endif - #if ENABLED(Z_PROBE_SLED) && PIN_EXISTS(SLED) - OUT_WRITE(SLED_PIN, LOW); // turn it off - #endif // Z_PROBE_SLED + #if (ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) && HAS_SOLENOID_1 + OUT_WRITE(SOL1_PIN, LOW); // turn it off + #endif setup_homepin(); diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 34b00ceebd..8f4c295421 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -172,6 +172,8 @@ #error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN. Please update your Configuration_adv.h." #elif defined(min_software_endstops) || defined(max_software_endstops) #error "(min|max)_software_endstops are now (MIN|MAX)_SOFTWARE_ENDSTOPS. Please update your configuration." +#elif ENABLED(Z_PROBE_SLED) && defined(SLED_PIN) + #error "Replace SLED_PIN with SOL1_PIN (applies to both Z_PROBE_SLED and SOLENOID_PROBE)." #endif /** @@ -459,6 +461,9 @@ static_assert(1 >= 0 #if ENABLED(Z_PROBE_SLED) + 1 #endif + #if ENABLED(SOLENOID_PROBE) + + 1 + #endif , "Please enable only one probe: PROBE_MANUALLY, FIX_MOUNTED_PROBE, Z Servo, BLTOUCH, Z_PROBE_ALLEN_KEY, or Z_PROBE_SLED." ); @@ -472,6 +477,17 @@ static_assert(1 >= 0 #error "You cannot use Z_PROBE_SLED with DELTA." #endif + /** + * SOLENOID_PROBE requirements + */ + #if ENABLED(SOLENOID_PROBE) + #if ENABLED(EXT_SOLENOID) + #error "SOLENOID_PROBE is incompatible with EXT_SOLENOID." + #elif !HAS_SOLENOID_1 + #error "SOLENOID_PROBE requires SOL1_PIN. It can be added to your Configuration.h." + #endif + #endif + /** * NUM_SERVOS is required for a Z servo probe */ diff --git a/Marlin/example_configurations/Cartesio/Configuration.h b/Marlin/example_configurations/Cartesio/Configuration.h index 6a2382fa46..26fd884122 100644 --- a/Marlin/example_configurations/Cartesio/Configuration.h +++ b/Marlin/example_configurations/Cartesio/Configuration.h @@ -592,6 +592,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index f7cf0e3241..2062fc3431 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -576,6 +576,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 96b9eb19c8..45a8ac6b26 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -576,6 +576,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 5488cf6e7c..e3a844f8d3 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -584,6 +584,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 277bf53645..2b3d2487cc 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -587,6 +587,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index be48f771d3..cd6e3bf763 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -622,6 +622,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/K8400/Configuration.h b/Marlin/example_configurations/K8400/Configuration.h index 9456590004..07a368c823 100644 --- a/Marlin/example_configurations/K8400/Configuration.h +++ b/Marlin/example_configurations/K8400/Configuration.h @@ -593,6 +593,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/K8400/Dual-head/Configuration.h b/Marlin/example_configurations/K8400/Dual-head/Configuration.h index 4a4d29dc13..43ce27098a 100644 --- a/Marlin/example_configurations/K8400/Dual-head/Configuration.h +++ b/Marlin/example_configurations/K8400/Dual-head/Configuration.h @@ -593,6 +593,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 6b521ff03a..5fbea32d9b 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -593,6 +593,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index b5b3363169..d75440d73d 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -592,6 +592,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index b116d9f9ab..9b6eb56da4 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -608,6 +608,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 4960cf1d5c..ab7bb0df6e 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -613,6 +613,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/TinyBoy2/Configuration.h b/Marlin/example_configurations/TinyBoy2/Configuration.h index 8fce9fa979..6581f68897 100644 --- a/Marlin/example_configurations/TinyBoy2/Configuration.h +++ b/Marlin/example_configurations/TinyBoy2/Configuration.h @@ -644,6 +644,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index ffa1fe60ab..7fa675e8d2 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -584,6 +584,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index eaf532eb26..d89067b9b2 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -593,6 +593,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h index d66f45e2f0..c8d085fadb 100644 --- a/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/flsun_kossel_mini/Configuration.h @@ -662,6 +662,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 4716101a37..3d088639b1 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -649,6 +649,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index dd3f38b56b..5a47dd7588 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -642,6 +642,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 78717d4283..71f8f62edc 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -643,6 +643,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 60610f7dce..eb3e3e4309 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -662,6 +662,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 25090738e9..ceb7951240 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -596,6 +596,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 9fe6a9160f..a6da3cb7a9 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -589,6 +589,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. diff --git a/Marlin/example_configurations/wt150/Configuration.h b/Marlin/example_configurations/wt150/Configuration.h index 83f517fa63..9740a45d71 100644 --- a/Marlin/example_configurations/wt150/Configuration.h +++ b/Marlin/example_configurations/wt150/Configuration.h @@ -598,6 +598,9 @@ * is enabled then it also applies to Z_PROBE_SPEED_SLOW. */ +// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) +//#define SOLENOID_PROBE + // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell. //#define Z_PROBE_SLED //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. From 0ac2b5c0455a13c0464e3bc14f5c427541154ea3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 17:14:14 -0500 Subject: [PATCH 6/8] Additional 5 extruders support (solenoids, microstepping) --- Marlin/Conditionals_post.h | 4 ++++ Marlin/Marlin_main.cpp | 26 ++++++++++++++++----- Marlin/stepper.cpp | 48 ++++++++++++++++++++++++++++++++++++++ Marlin/thermistortables.h | 9 +++++++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index e96ffb7b9f..4dc5b423a8 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -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)) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6b9152cd8d..2ca660c991 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -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); - OUT_WRITE(SOL1_PIN, LOW); - OUT_WRITE(SOL2_PIN, LOW); - OUT_WRITE(SOL3_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 } /** diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 339e6bf9b9..16594b5f60 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -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 diff --git a/Marlin/thermistortables.h b/Marlin/thermistortables.h index 05ec9a30a9..3777cf2e42 100644 --- a/Marlin/thermistortables.h +++ b/Marlin/thermistortables.h @@ -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 From 5135be14eac09a9be7bf5c9b61a65d4c14ff49fb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 17:16:32 -0500 Subject: [PATCH 7/8] Include Travis CI tests for 5 extruders / e-steppers --- .travis.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12b4af9963..6a33a19367 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,18 +83,23 @@ script: - opt_set TEMP_SENSOR_1 1 - build_marlin # - # Test 3 extruders on RUMBA (can use any board with >=3 extruders defined) + # Test 5 extruders on AZTEEG_X3_PRO (can use any board with >=5 extruders defined) # Include a test for LIN_ADVANCE here also # - - opt_set MOTHERBOARD BOARD_RUMBA - - opt_set EXTRUDERS 3 - - opt_set TEMP_SENSOR_2 1 + - opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO + - opt_set EXTRUDERS 5 + - opt_set TEMP_SENSOR_1 1 + - opt_set TEMP_SENSOR_2 5 + - opt_set TEMP_SENSOR_3 20 + - opt_set TEMP_SENSOR_4 999 + - opt_set TEMP_SENSOR_BED 1 - opt_enable_adv LIN_ADVANCE - build_marlin # # Test PIDTEMPBED # - restore_configs + - opt_set TEMP_SENSOR_BED 1 - opt_enable PIDTEMPBED - build_marlin # @@ -158,11 +163,12 @@ script: - opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT - build_marlin # - # Mixing Extruder + # Mixing Extruder with 5 steppers # - restore_configs + - opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO - opt_enable MIXING_EXTRUDER - - opt_set MIXING_STEPPERS 2 + - opt_set MIXING_STEPPERS 5 - build_marlin # # Test DUAL_X_CARRIAGE From f4685c28b74ef1602175e5a9853e31ad9eafc515 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 14 Apr 2017 18:00:33 -0500 Subject: [PATCH 8/8] Reorder Conditionals_post.h and add comments --- Marlin/Conditionals_post.h | 159 ++++++++++++++++++++++--------------- Marlin/stepper.cpp | 56 ++++++------- 2 files changed, 122 insertions(+), 93 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 4dc5b423a8..78a73b27c2 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -435,18 +435,100 @@ /** * Shorthand for pin tests, used wherever needed */ + + // Steppers + #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE)) + #define HAS_X_DIR (PIN_EXISTS(X_DIR)) + #define HAS_X_STEP (PIN_EXISTS(X_STEP)) + #define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1)) + + #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE)) + #define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) + #define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) + #define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1)) + + #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE)) + #define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) + #define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) + #define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1)) + + #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE)) + #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) + #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) + + #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE)) + #define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) + #define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) + + #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE)) + #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) + #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) + + // Extruder steppers and solenoids + #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) + #define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) + #define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) + #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1)) + #define HAS_SOLENOID_0 (PIN_EXISTS(SOL0)) + + #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE)) + #define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) + #define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) + #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1)) + #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) + + #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE)) + #define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) + #define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) + #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1)) + #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) + + #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE)) + #define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) + #define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) + #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1)) + #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) + + #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE)) + #define HAS_E4_DIR (PIN_EXISTS(E4_DIR)) + #define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) + #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1)) + #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4)) + + // Endstops and bed probe + #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN)) + #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN)) + #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN)) + #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN)) + #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN)) + #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN)) + #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)) + + // Thermistors #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2) #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2) #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2) #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2) #define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2) + #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)) #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2) + + // Heaters #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1)) #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) + + // Thermal protection + #define HAS_THERMALLY_PROTECTED_BED (ENABLED(THERMAL_PROTECTION_BED) && HAS_TEMP_BED && HAS_HEATER_BED) + #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) + #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) + + // Auto fans #define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN)) #define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN)) #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN)) @@ -463,91 +545,38 @@ #define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) #define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) #define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) + + // Other fans #define HAS_FAN0 (PIN_EXISTS(FAN)) #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN) #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && E0_AUTO_FAN_PIN != FAN2_PIN && E1_AUTO_FAN_PIN != FAN2_PIN && E2_AUTO_FAN_PIN != FAN2_PIN && E3_AUTO_FAN_PIN != FAN2_PIN) #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN)) + + // Servos #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0) #define HAS_SERVO_0 (PIN_EXISTS(SERVO0)) #define HAS_SERVO_1 (PIN_EXISTS(SERVO1)) #define HAS_SERVO_2 (PIN_EXISTS(SERVO2)) #define HAS_SERVO_3 (PIN_EXISTS(SERVO3)) + + // Sensors #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH)) #define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT)) + + // User Interface #define HAS_HOME (PIN_EXISTS(HOME)) #define HAS_KILL (PIN_EXISTS(KILL)) #define HAS_SUICIDE (PIN_EXISTS(SUICIDE)) #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH)) - #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN)) - #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN)) - #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN)) - #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN)) - #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN)) - #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN)) - #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)) - #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE)) - #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE)) - #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE)) - #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE)) - #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE)) - #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) - #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE)) - #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE)) - #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE)) - #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE)) - #define HAS_X_DIR (PIN_EXISTS(X_DIR)) - #define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) - #define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) - #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) - #define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) - #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) - #define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) - #define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) - #define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) - #define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) - #define HAS_E4_DIR (PIN_EXISTS(E4_DIR)) - #define HAS_X_STEP (PIN_EXISTS(X_STEP)) - #define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) - #define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) - #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) - #define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) - #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) - #define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) - #define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) - #define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) - #define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) - #define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) - #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER)) #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT)) + // Digital control + #define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS) + #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET)) + #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E)) - #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)) - - #define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED)) - - #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) - #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) - /** * This setting is also used by M109 when trying to calculate * a ballpark safe margin to prevent wait-forever situation. diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 16594b5f60..11d20251f3 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1464,31 +1464,31 @@ void Stepper::report_positions() { void Stepper::microstep_init() { SET_OUTPUT(X_MS1_PIN); SET_OUTPUT(X_MS2_PIN); - #if HAS_MICROSTEPS_Y + #if HAS_Y_MICROSTEPS SET_OUTPUT(Y_MS1_PIN); SET_OUTPUT(Y_MS2_PIN); #endif - #if HAS_MICROSTEPS_Z + #if HAS_Z_MICROSTEPS SET_OUTPUT(Z_MS1_PIN); SET_OUTPUT(Z_MS2_PIN); #endif - #if HAS_MICROSTEPS_E0 + #if HAS_E0_MICROSTEPS SET_OUTPUT(E0_MS1_PIN); SET_OUTPUT(E0_MS2_PIN); #endif - #if HAS_MICROSTEPS_E1 + #if HAS_E1_MICROSTEPS SET_OUTPUT(E1_MS1_PIN); SET_OUTPUT(E1_MS2_PIN); #endif - #if HAS_MICROSTEPS_E2 + #if HAS_E2_MICROSTEPS SET_OUTPUT(E2_MS1_PIN); SET_OUTPUT(E2_MS2_PIN); #endif - #if HAS_MICROSTEPS_E3 + #if HAS_E3_MICROSTEPS SET_OUTPUT(E3_MS1_PIN); SET_OUTPUT(E3_MS2_PIN); #endif - #if HAS_MICROSTEPS_E4 + #if HAS_E4_MICROSTEPS SET_OUTPUT(E4_MS1_PIN); SET_OUTPUT(E4_MS2_PIN); #endif @@ -1500,49 +1500,49 @@ void Stepper::report_positions() { void Stepper::microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) { if (ms1 >= 0) switch (driver) { case 0: WRITE(X_MS1_PIN, ms1); break; - #if HAS_MICROSTEPS_Y + #if HAS_Y_MICROSTEPS case 1: WRITE(Y_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_Z + #if HAS_Z_MICROSTEPS case 2: WRITE(Z_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_E0 + #if HAS_E0_MICROSTEPS case 3: WRITE(E0_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_E1 + #if HAS_E1_MICROSTEPS case 4: WRITE(E1_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_E2 + #if HAS_E2_MICROSTEPS case 5: WRITE(E2_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_E3 + #if HAS_E3_MICROSTEPS case 6: WRITE(E3_MS1_PIN, ms1); break; #endif - #if HAS_MICROSTEPS_E4 + #if HAS_E4_MICROSTEPS case 7: WRITE(E4_MS1_PIN, ms1); break; #endif } if (ms2 >= 0) switch (driver) { case 0: WRITE(X_MS2_PIN, ms2); break; - #if HAS_MICROSTEPS_Y + #if HAS_Y_MICROSTEPS case 1: WRITE(Y_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_Z + #if HAS_Z_MICROSTEPS case 2: WRITE(Z_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_E0 + #if HAS_E0_MICROSTEPS case 3: WRITE(E0_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_E1 + #if HAS_E1_MICROSTEPS case 4: WRITE(E1_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_E2 + #if HAS_E2_MICROSTEPS case 5: WRITE(E2_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_E3 + #if HAS_E3_MICROSTEPS case 6: WRITE(E3_MS2_PIN, ms2); break; #endif - #if HAS_MICROSTEPS_E4 + #if HAS_E4_MICROSTEPS case 7: WRITE(E4_MS2_PIN, ms2); break; #endif } @@ -1563,37 +1563,37 @@ void Stepper::report_positions() { SERIAL_PROTOCOLPGM("X: "); SERIAL_PROTOCOL(READ(X_MS1_PIN)); SERIAL_PROTOCOLLN(READ(X_MS2_PIN)); - #if HAS_MICROSTEPS_Y + #if HAS_Y_MICROSTEPS SERIAL_PROTOCOLPGM("Y: "); SERIAL_PROTOCOL(READ(Y_MS1_PIN)); SERIAL_PROTOCOLLN(READ(Y_MS2_PIN)); #endif - #if HAS_MICROSTEPS_Z + #if HAS_Z_MICROSTEPS SERIAL_PROTOCOLPGM("Z: "); SERIAL_PROTOCOL(READ(Z_MS1_PIN)); SERIAL_PROTOCOLLN(READ(Z_MS2_PIN)); #endif - #if HAS_MICROSTEPS_E0 + #if HAS_E0_MICROSTEPS SERIAL_PROTOCOLPGM("E0: "); SERIAL_PROTOCOL(READ(E0_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E0_MS2_PIN)); #endif - #if HAS_MICROSTEPS_E1 + #if HAS_E1_MICROSTEPS SERIAL_PROTOCOLPGM("E1: "); SERIAL_PROTOCOL(READ(E1_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E1_MS2_PIN)); #endif - #if HAS_MICROSTEPS_E2 + #if HAS_E2_MICROSTEPS SERIAL_PROTOCOLPGM("E2: "); SERIAL_PROTOCOL(READ(E2_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E2_MS2_PIN)); #endif - #if HAS_MICROSTEPS_E3 + #if HAS_E3_MICROSTEPS SERIAL_PROTOCOLPGM("E3: "); SERIAL_PROTOCOL(READ(E3_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E3_MS2_PIN)); #endif - #if HAS_MICROSTEPS_E4 + #if HAS_E4_MICROSTEPS SERIAL_PROTOCOLPGM("E4: "); SERIAL_PROTOCOL(READ(E4_MS1_PIN)); SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));