Browse Source

Merge pull request #12063 from thinkyhead/bf2_sensitive_pins

Add MS3 pins. Optimize SENSITIVE_PINS.
pull/1/head
Scott Lahteine 6 years ago
committed by GitHub
parent
commit
49d4ed4d3f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      Marlin/src/Marlin.cpp
  2. 14
      Marlin/src/gcode/control/M350_M351.cpp
  3. 46
      Marlin/src/inc/Conditionals_post.h
  4. 2
      Marlin/src/inc/MarlinConfig.h
  5. 264
      Marlin/src/module/stepper.cpp
  6. 2
      Marlin/src/module/stepper.h
  7. 238
      Marlin/src/pins/pins.h
  8. 36
      Marlin/src/pins/pinsDebug_list.h
  9. 3
      Marlin/src/pins/pins_RURAMPS4D_11.h
  10. 516
      Marlin/src/pins/sensitive_pins.h

3
Marlin/src/Marlin.cpp

@ -259,6 +259,9 @@ void setup_powerhold() {
/**
* Sensitive pin test for M42, M226
*/
#include "pins/sensitive_pins.h"
bool pin_is_protected(const pin_t pin) {
static const pin_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
for (uint8_t i = 0; i < COUNT(sensitive_pins); i++) {

14
Marlin/src/gcode/control/M350_M351.cpp

@ -41,17 +41,21 @@ void GcodeSuite::M350() {
/**
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
* S# determines MS1 or MS2, X# sets the pin high/low.
* S# determines MS1, MS2 or MS3, X# sets the pin high/low.
*/
void GcodeSuite::M351() {
if (parser.seenval('S')) switch (parser.value_byte()) {
case 1:
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1);
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1);
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1);
break;
case 2:
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte());
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte());
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1);
break;
case 3:
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte());
break;
}
stepper.microstep_readings();

46
Marlin/src/inc/Conditionals_post.h

@ -236,26 +236,37 @@
#define MAX_AUTORETRACT 99
#endif
// MS1 MS2 Stepper Driver Microstepping mode table
#define MICROSTEP1 LOW,LOW
#if ENABLED(HEROIC_STEPPER_DRIVERS)
#define MICROSTEP128 LOW,HIGH
#else
#define MICROSTEP2 HIGH,LOW
#define MICROSTEP4 LOW,HIGH
#endif
#define MICROSTEP8 HIGH,HIGH
#ifdef __SAM3X8E__
#if MB(ALLIGATOR)
#define MICROSTEP16 LOW,LOW
#define MICROSTEP32 HIGH,HIGH
// MS1 MS2 MS3 Stepper Driver Microstepping mode table
#if DISABLED(MICROSTEP_CUSTOM)
#define MICROSTEP1 LOW,LOW,LOW
#if ENABLED(HEROIC_STEPPER_DRIVERS)
#define MICROSTEP128 LOW,HIGH,LOW
#else
#define MICROSTEP2 HIGH,LOW,LOW
#define MICROSTEP4 LOW,HIGH,LOW
#endif
#define MICROSTEP8 HIGH,HIGH,LOW
#ifdef __SAM3X8E__
#if MB(ALLIGATOR)
#define MICROSTEP16 LOW,LOW,LOW
#define MICROSTEP32 HIGH,HIGH,LOW
#else
#define MICROSTEP16 HIGH,HIGH,LOW
#endif
#else
#define MICROSTEP16 HIGH,HIGH
#define MICROSTEP16 HIGH,HIGH,LOW
#endif
#else
#define MICROSTEP16 HIGH,HIGH
#endif
#define HAS_MICROSTEP1 defined(MICROSTEP1)
#define HAS_MICROSTEP2 defined(MICROSTEP2)
#define HAS_MICROSTEP4 defined(MICROSTEP4)
#define HAS_MICROSTEP8 defined(MICROSTEP8)
#define HAS_MICROSTEP16 defined(MICROSTEP16)
#define HAS_MICROSTEP32 defined(MICROSTEP32)
#define HAS_MICROSTEP64 defined(MICROSTEP64)
#define HAS_MICROSTEP128 defined(MICROSTEP128)
/**
* Override here because this is set in Configuration_adv.h
*/
@ -828,6 +839,7 @@
#define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE))
#define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR))
#define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP))
#define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1))
// Extruder steppers and solenoids
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
@ -1003,7 +1015,7 @@
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
// 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 || HAS_E5_MICROSTEPS)
#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_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))

2
Marlin/src/inc/MarlinConfig.h

@ -31,6 +31,8 @@
#include "../pins/pins.h"
#include HAL_PATH(../HAL, spi_pins.h)
#if defined(__AVR__) && !defined(USBCON)
#define HardwareSerial_h // trick to disable the standard HWserial
#endif

264
Marlin/src/module/stepper.cpp

@ -2504,53 +2504,136 @@ void Stepper::report_positions() {
*/
void Stepper::microstep_init() {
SET_OUTPUT(X_MS1_PIN);
SET_OUTPUT(X_MS2_PIN);
#if HAS_X_MICROSTEPS
SET_OUTPUT(X_MS1_PIN);
SET_OUTPUT(X_MS2_PIN);
#if PIN_EXISTS(X_MS3)
SET_OUTPUT(X_MS3_PIN);
#endif
#endif
#if HAS_X2_MICROSTEPS
SET_OUTPUT(X2_MS1_PIN);
SET_OUTPUT(X2_MS2_PIN);
#if PIN_EXISTS(X2_MS3)
SET_OUTPUT(X2_MS3_PIN);
#endif
#endif
#if HAS_Y_MICROSTEPS
SET_OUTPUT(Y_MS1_PIN);
SET_OUTPUT(Y_MS2_PIN);
#if PIN_EXISTS(Y_MS3)
SET_OUTPUT(Y_MS3_PIN);
#endif
#endif
#if HAS_Y2_MICROSTEPS
SET_OUTPUT(Y2_MS1_PIN);
SET_OUTPUT(Y2_MS2_PIN);
#if PIN_EXISTS(Y2_MS3)
SET_OUTPUT(Y2_MS3_PIN);
#endif
#endif
#if HAS_Z_MICROSTEPS
SET_OUTPUT(Z_MS1_PIN);
SET_OUTPUT(Z_MS2_PIN);
#if PIN_EXISTS(Z_MS3)
SET_OUTPUT(Z_MS3_PIN);
#endif
#endif
#if HAS_Z2_MICROSTEPS
SET_OUTPUT(Z2_MS1_PIN);
SET_OUTPUT(Z2_MS2_PIN);
#if PIN_EXISTS(Z2_MS3)
SET_OUTPUT(Z2_MS3_PIN);
#endif
#endif
#if HAS_Z3_MICROSTEPS
SET_OUTPUT(Z3_MS1_PIN);
SET_OUTPUT(Z3_MS2_PIN);
#if PIN_EXISTS(Z3_MS3)
SET_OUTPUT(Z3_MS3_PIN);
#endif
#endif
#if HAS_E0_MICROSTEPS
SET_OUTPUT(E0_MS1_PIN);
SET_OUTPUT(E0_MS2_PIN);
#if PIN_EXISTS(E0_MS3)
SET_OUTPUT(E0_MS3_PIN);
#endif
#endif
#if HAS_E1_MICROSTEPS
SET_OUTPUT(E1_MS1_PIN);
SET_OUTPUT(E1_MS2_PIN);
#if PIN_EXISTS(E1_MS3)
SET_OUTPUT(E1_MS3_PIN);
#endif
#endif
#if HAS_E2_MICROSTEPS
SET_OUTPUT(E2_MS1_PIN);
SET_OUTPUT(E2_MS2_PIN);
#if PIN_EXISTS(E2_MS3)
SET_OUTPUT(E2_MS3_PIN);
#endif
#endif
#if HAS_E3_MICROSTEPS
SET_OUTPUT(E3_MS1_PIN);
SET_OUTPUT(E3_MS2_PIN);
#if PIN_EXISTS(E3_MS3)
SET_OUTPUT(E3_MS3_PIN);
#endif
#endif
#if HAS_E4_MICROSTEPS
SET_OUTPUT(E4_MS1_PIN);
SET_OUTPUT(E4_MS2_PIN);
#if PIN_EXISTS(E4_MS3)
SET_OUTPUT(E4_MS3_PIN);
#endif
#endif
#if HAS_E5_MICROSTEPS
SET_OUTPUT(E5_MS1_PIN);
SET_OUTPUT(E5_MS2_PIN);
#if PIN_EXISTS(E5_MS3)
SET_OUTPUT(E5_MS3_PIN);
#endif
#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]);
}
void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2) {
void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) {
if (ms1 >= 0) switch (driver) {
case 0: WRITE(X_MS1_PIN, ms1); break;
#if HAS_Y_MICROSTEPS
case 1: WRITE(Y_MS1_PIN, ms1); break;
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
case 0:
#if HAS_X_MICROSTEPS
WRITE(X_MS1_PIN, ms1);
#endif
#if HAS_X2_MICROSTEPS
WRITE(X2_MS1_PIN, ms1);
#endif
break;
#endif
#if HAS_Z_MICROSTEPS
case 2: WRITE(Z_MS1_PIN, ms1); break;
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
case 1:
#if HAS_Y_MICROSTEPS
WRITE(Y_MS1_PIN, ms1);
#endif
#if HAS_Y2_MICROSTEPS
WRITE(Y2_MS1_PIN, ms1);
#endif
break;
#endif
#if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
case 2:
#if HAS_Z_MICROSTEPS
WRITE(Z_MS1_PIN, ms1);
#endif
#if HAS_Z2_MICROSTEPS
WRITE(Z2_MS1_PIN, ms1);
#endif
#if HAS_Z3_MICROSTEPS
WRITE(Z3_MS1_PIN, ms1);
#endif
break;
#endif
#if HAS_E0_MICROSTEPS
case 3: WRITE(E0_MS1_PIN, ms1); break;
@ -2572,12 +2655,38 @@ void Stepper::report_positions() {
#endif
}
if (ms2 >= 0) switch (driver) {
case 0: WRITE(X_MS2_PIN, ms2); break;
#if HAS_Y_MICROSTEPS
case 1: WRITE(Y_MS2_PIN, ms2); break;
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
case 0:
#if HAS_X_MICROSTEPS
WRITE(X_MS2_PIN, ms2);
#endif
#if HAS_X2_MICROSTEPS
WRITE(X2_MS2_PIN, ms2);
#endif
break;
#endif
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
case 1:
#if HAS_Y_MICROSTEPS
WRITE(Y_MS2_PIN, ms2);
#endif
#if HAS_Y2_MICROSTEPS
WRITE(Y2_MS2_PIN, ms2);
#endif
break;
#endif
#if HAS_Z_MICROSTEPS
case 2: WRITE(Z_MS2_PIN, ms2); break;
#if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
case 2:
#if HAS_Z_MICROSTEPS
WRITE(Z_MS2_PIN, ms2);
#endif
#if HAS_Z2_MICROSTEPS
WRITE(Z2_MS2_PIN, ms2);
#endif
#if HAS_Z3_MICROSTEPS
WRITE(Z3_MS2_PIN, ms2);
#endif
break;
#endif
#if HAS_E0_MICROSTEPS
case 3: WRITE(E0_MS2_PIN, ms2); break;
@ -2598,70 +2707,165 @@ void Stepper::report_positions() {
case 8: WRITE(E5_MS2_PIN, ms2); break;
#endif
}
if (ms3 >= 0) switch (driver) {
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
case 0:
#if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3)
WRITE(X_MS3_PIN, ms3);
#endif
#if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3)
WRITE(X2_MS3_PIN, ms3);
#endif
break;
#endif
#if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
case 1:
#if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3)
WRITE(Y_MS3_PIN, ms3);
#endif
#if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3)
WRITE(Y2_MS3_PIN, ms3);
#endif
break;
#endif
#if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
case 2:
#if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3)
WRITE(Z_MS3_PIN, ms3);
#endif
#if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3)
WRITE(Z2_MS3_PIN, ms3);
#endif
#if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3)
WRITE(Z3_MS3_PIN, ms3);
#endif
break;
#endif
#if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3)
case 3: WRITE(E0_MS3_PIN, ms3); break;
#endif
#if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3)
case 4: WRITE(E1_MS3_PIN, ms3); break;
#endif
#if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3)
case 5: WRITE(E2_MS3_PIN, ms3); break;
#endif
#if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3)
case 6: WRITE(E3_MS3_PIN, ms3); break;
#endif
#if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3)
case 7: WRITE(E4_MS3_PIN, ms3); break;
#endif
#if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3)
case 8: WRITE(E5_MS3_PIN, ms3); break;
#endif
}
}
void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) {
switch (stepping_mode) {
case 1: microstep_ms(driver, MICROSTEP1); break;
#if ENABLED(HEROIC_STEPPER_DRIVERS)
case 128: microstep_ms(driver, MICROSTEP128); break;
#else
#if HAS_MICROSTEP1
case 1: microstep_ms(driver, MICROSTEP1); break;
#endif
#if HAS_MICROSTEP2
case 2: microstep_ms(driver, MICROSTEP2); break;
#endif
#if HAS_MICROSTEP4
case 4: microstep_ms(driver, MICROSTEP4); break;
#endif
case 8: microstep_ms(driver, MICROSTEP8); break;
case 16: microstep_ms(driver, MICROSTEP16); break;
#if MB(ALLIGATOR)
#if HAS_MICROSTEP8
case 8: microstep_ms(driver, MICROSTEP8); break;
#endif
#if HAS_MICROSTEP16
case 16: microstep_ms(driver, MICROSTEP16); break;
#endif
#if HAS_MICROSTEP32
case 32: microstep_ms(driver, MICROSTEP32); break;
#endif
#if HAS_MICROSTEP64
case 64: microstep_ms(driver, MICROSTEP64); break;
#endif
#if HAS_MICROSTEP128
case 128: microstep_ms(driver, MICROSTEP128); break;
#endif
default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break;
}
}
void Stepper::microstep_readings() {
SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins");
SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins");
SERIAL_PROTOCOLPGM("X: ");
SERIAL_PROTOCOL(READ(X_MS1_PIN));
SERIAL_PROTOCOLLN(READ(X_MS2_PIN));
#if HAS_X_MICROSTEPS
SERIAL_PROTOCOL(READ(X_MS1_PIN));
SERIAL_PROTOCOL(READ(X_MS2_PIN));
#if PIN_EXISTS(X_MS3)
SERIAL_PROTOCOLLN(READ(X_MS3_PIN));
#endif
#endif
#if HAS_Y_MICROSTEPS
SERIAL_PROTOCOLPGM("Y: ");
SERIAL_PROTOCOL(READ(Y_MS1_PIN));
SERIAL_PROTOCOLLN(READ(Y_MS2_PIN));
SERIAL_PROTOCOL(READ(Y_MS2_PIN));
#if PIN_EXISTS(Y_MS3)
SERIAL_PROTOCOLLN(READ(Y_MS3_PIN));
#endif
#endif
#if HAS_Z_MICROSTEPS
SERIAL_PROTOCOLPGM("Z: ");
SERIAL_PROTOCOL(READ(Z_MS1_PIN));
SERIAL_PROTOCOLLN(READ(Z_MS2_PIN));
SERIAL_PROTOCOL(READ(Z_MS2_PIN));
#if PIN_EXISTS(Z_MS3)
SERIAL_PROTOCOLLN(READ(Z_MS3_PIN));
#endif
#endif
#if HAS_E0_MICROSTEPS
SERIAL_PROTOCOLPGM("E0: ");
SERIAL_PROTOCOL(READ(E0_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E0_MS2_PIN));
SERIAL_PROTOCOL(READ(E0_MS2_PIN));
#if PIN_EXISTS(E0_MS3)
SERIAL_PROTOCOLLN(READ(E0_MS3_PIN));
#endif
#endif
#if HAS_E1_MICROSTEPS
SERIAL_PROTOCOLPGM("E1: ");
SERIAL_PROTOCOL(READ(E1_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
SERIAL_PROTOCOL(READ(E1_MS2_PIN));
#if PIN_EXISTS(E1_MS3)
SERIAL_PROTOCOLLN(READ(E1_MS3_PIN));
#endif
#endif
#if HAS_E2_MICROSTEPS
SERIAL_PROTOCOLPGM("E2: ");
SERIAL_PROTOCOL(READ(E2_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E2_MS2_PIN));
SERIAL_PROTOCOL(READ(E2_MS2_PIN));
#if PIN_EXISTS(E2_MS3)
SERIAL_PROTOCOLLN(READ(E2_MS3_PIN));
#endif
#endif
#if HAS_E3_MICROSTEPS
SERIAL_PROTOCOLPGM("E3: ");
SERIAL_PROTOCOL(READ(E3_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E3_MS2_PIN));
SERIAL_PROTOCOL(READ(E3_MS2_PIN));
#if PIN_EXISTS(E3_MS3)
SERIAL_PROTOCOLLN(READ(E3_MS3_PIN));
#endif
#endif
#if HAS_E4_MICROSTEPS
SERIAL_PROTOCOLPGM("E4: ");
SERIAL_PROTOCOL(READ(E4_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));
SERIAL_PROTOCOL(READ(E4_MS2_PIN));
#if PIN_EXISTS(E4_MS3)
SERIAL_PROTOCOLLN(READ(E4_MS3_PIN));
#endif
#endif
#if HAS_E5_MICROSTEPS
SERIAL_PROTOCOLPGM("E5: ");
SERIAL_PROTOCOL(READ(E5_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E5_MS2_PIN));
#if PIN_EXISTS(E5_MS3)
SERIAL_PROTOCOLLN(READ(E5_MS3_PIN));
#endif
#endif
}

2
Marlin/src/module/stepper.h

@ -413,7 +413,7 @@ class Stepper {
#endif
#if HAS_MICROSTEPS
static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2);
static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3);
static void microstep_mode(const uint8_t driver, const uint8_t stepping);
static void microstep_readings();
#endif

238
Marlin/src/pins/pins.h

@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Include pins definitions
@ -32,9 +33,6 @@
* These numbers are the same in any pin mapping.
*/
#ifndef __PINS_H__
#define __PINS_H__
#define MAX_EXTRUDERS 6
#if MB(RAMPS_13_EFB) || MB(RAMPS_14_EFB) || MB(RAMPS_PLUS_EFB) || MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_SMART_EFB) || MB(RAMPS_DUO_EFB) || MB(RAMPS4DUE_EFB)
@ -427,12 +425,18 @@
#ifndef X_MS2_PIN
#define X_MS2_PIN -1
#endif
#ifndef X_MS3_PIN
#define X_MS3_PIN -1
#endif
#ifndef Y_MS1_PIN
#define Y_MS1_PIN -1
#endif
#ifndef Y_MS2_PIN
#define Y_MS2_PIN -1
#endif
#ifndef Y_MS3_PIN
#define Y_MS3_PIN -1
#endif
#ifndef Z_MS1_PIN
#define Z_MS1_PIN -1
#endif
@ -448,18 +452,27 @@
#ifndef E0_MS2_PIN
#define E0_MS2_PIN -1
#endif
#ifndef E0_MS3_PIN
#define E0_MS3_PIN -1
#endif
#ifndef E1_MS1_PIN
#define E1_MS1_PIN -1
#endif
#ifndef E1_MS2_PIN
#define E1_MS2_PIN -1
#endif
#ifndef E1_MS3_PIN
#define E1_MS3_PIN -1
#endif
#ifndef E2_MS1_PIN
#define E2_MS1_PIN -1
#endif
#ifndef E2_MS2_PIN
#define E2_MS2_PIN -1
#endif
#ifndef E2_MS3_PIN
#define E2_MS3_PIN -1
#endif
#ifndef E3_MS1_PIN
#define E3_MS1_PIN -1
#endif
@ -650,7 +663,8 @@
#ifndef LED_PIN
#define LED_PIN -1
#endif
#ifndef PS_ON_PIN
#if POWER_SUPPLY == 0 || !defined(PS_ON_PIN)
#undef PS_ON_PIN
#define PS_ON_PIN -1
#endif
#ifndef KILL_PIN
@ -717,94 +731,6 @@
#endif
#endif
// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN,
#define _E1_PINS
#define _E2_PINS
#define _E3_PINS
#define _E4_PINS
#define _E5_PINS
#if ENABLED(SWITCHING_EXTRUDER)
// Tools 0 and 1 use E0
#if EXTRUDERS > 2 // Tools 2 and 3 use E1
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if EXTRUDERS > 4 // Tools 4 and 5 use E2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#endif
#endif
#elif EXTRUDERS > 1
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if EXTRUDERS > 2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#if EXTRUDERS > 3
#undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_MS3_PIN, E3_CS_PIN,
#if EXTRUDERS > 4
#undef _E4_PINS
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_MS3_PIN, E4_CS_PIN,
#if EXTRUDERS > 5
#undef _E5_PINS
#define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, E5_MS1_PIN, E5_MS2_PIN, E5_MS3_PIN, E5_CS_PIN,
#endif // EXTRUDERS > 5
#endif // EXTRUDERS > 4
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN),
#define _H1_PINS
#define _H2_PINS
#define _H3_PINS
#define _H4_PINS
#define _H5_PINS
#if HOTENDS > 1
#undef _H1_PINS
#define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN),
#if HOTENDS > 2
#undef _H2_PINS
#define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN),
#if HOTENDS > 3
#undef _H3_PINS
#define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN),
#if HOTENDS > 4
#undef _H4_PINS
#define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN),
#if HOTENDS > 5
#undef _H5_PINS
#define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN),
#endif // HOTENDS > 5
#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, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
#if MIXING_STEPPERS > 2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
#if MIXING_STEPPERS > 3
#undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_CS_PIN,
#if MIXING_STEPPERS > 4
#undef _E4_PINS
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_CS_PIN,
#if MIXING_STEPPERS > 5
#undef _E5_PINS
#define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, E5_MS1_PIN, E5_MS2_PIN, E5_CS_PIN,
#endif // MIXING_STEPPERS > 5
#endif // MIXING_STEPPERS > 4
#endif // MIXING_STEPPERS > 3
#endif // MIXING_STEPPERS > 2
#endif // MIXING_STEPPERS > 1
#define BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
//
// Assign endstop pins for boards with only 3 connectors
//
@ -841,7 +767,7 @@
//
// Disable unused endstop / probe pins
//
#if DISABLED(Z_MIN_PROBE_ENDSTOP)
#if !HAS_BED_PROBE || DISABLED(Z_MIN_PROBE_ENDSTOP)
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
#endif
@ -889,14 +815,13 @@
#define LCD_PINS_D7 -1
#endif
//
// Dual X-carriage, Dual Y, Dual Z support
//
#define _X2_PINS
#define _Y2_PINS
#define _Z2_PINS
#define _Z3_PINS
/**
* Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers
*
* By default X2 is assigned to the next open E plug
* on the board, then in order, Y2, Z2, Z3. These can be
* overridden in Configuration.h or Configuration_adv.h.
*/
#define __EPIN(p,q) E##p##_##q##_PIN
#define _EPIN(p,q) __EPIN(p,q)
@ -907,19 +832,21 @@
#define X2_STEP_PIN _EPIN(E_STEPPERS, STEP)
#define X2_DIR_PIN _EPIN(E_STEPPERS, DIR)
#define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
#ifndef X2_CS_PIN
#define X2_CS_PIN _EPIN(E_STEPPERS, CS)
#endif
#if E_STEPPERS > MAX_EXTRUDERS || !PIN_EXISTS(X2_ENABLE)
#if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP)
#error "No E stepper plug left for X2!"
#endif
#endif
#undef _X2_PINS
#define __X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
#ifdef X2_CS_PIN
#define _X2_PINS __X2_PINS X2_CS_PIN,
#else
#define _X2_PINS __X2_PINS
#ifndef X2_CS_PIN
#define X2_CS_PIN _EPIN(E_STEPPERS, CS)
#endif
#ifndef X2_MS1_PIN
#define X2_MS1_PIN _EPIN(E_STEPPERS, MS1)
#endif
#ifndef X2_MS2_PIN
#define X2_MS2_PIN _EPIN(E_STEPPERS, MS2)
#endif
#ifndef X2_MS3_PIN
#define X2_MS3_PIN _EPIN(E_STEPPERS, MS3)
#endif
#define Y2_E_INDEX INCREMENT(E_STEPPERS)
#else
@ -932,19 +859,21 @@
#define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
#define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
#define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
#ifndef Y2_CS_PIN
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
#endif
#if Y2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Y2_ENABLE)
#if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_STEP)
#error "No E stepper plug left for Y2!"
#endif
#endif
#undef _Y2_PINS
#define __Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
#ifdef Y2_CS_PIN
#define _Y2_PINS __Y2_PINS Y2_CS_PIN,
#else
#define _Y2_PINS __Y2_PINS
#ifndef Y2_CS_PIN
#define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
#endif
#ifndef Y2_MS1_PIN
#define Y2_MS1_PIN _EPIN(Y2_E_INDEX, MS1)
#endif
#ifndef Y2_MS2_PIN
#define Y2_MS2_PIN _EPIN(Y2_E_INDEX, MS2)
#endif
#ifndef Y2_MS3_PIN
#define Y2_MS3_PIN _EPIN(Y2_E_INDEX, MS3)
#endif
#define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
#else
@ -957,19 +886,21 @@
#define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
#define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
#define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
#ifndef Z2_CS_PIN
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
#endif
#if Z2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Z2_ENABLE)
#if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_STEP)
#error "No E stepper plug left for Z2!"
#endif
#endif
#undef _Z2_PINS
#define __Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,
#ifdef Z2_CS_PIN
#define _Z2_PINS __Z2_PINS Z2_CS_PIN,
#else
#define _Z2_PINS __Z2_PINS
#ifndef Z2_CS_PIN
#define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
#endif
#ifndef Z2_MS1_PIN
#define Z2_MS1_PIN _EPIN(Z2_E_INDEX, MS1)
#endif
#ifndef Z2_MS2_PIN
#define Z2_MS2_PIN _EPIN(Z2_E_INDEX, MS2)
#endif
#ifndef Z2_MS3_PIN
#define Z2_MS3_PIN _EPIN(Z2_E_INDEX, MS3)
#endif
#define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
#else
@ -981,41 +912,20 @@
#define Z3_STEP_PIN _EPIN(Z3_E_INDEX, STEP)
#define Z3_DIR_PIN _EPIN(Z3_E_INDEX, DIR)
#define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
#ifndef Z3_CS_PIN
#define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS)
#endif
#if Z3_E_INDEX > 4 || !PIN_EXISTS(Z3_ENABLE)
#if Z3_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z3_STEP)
#error "No E stepper plug left for Z3!"
#endif
#endif
#undef _Z3_PINS
#define __Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN,
#ifdef Z3_CS_PIN
#define _Z3_PINS __Z3_PINS Z3_CS_PIN,
#else
#define _Z3_PINS __Z3_PINS
#ifndef Z3_CS_PIN
#define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS)
#endif
#ifndef Z3_MS1_PIN
#define Z3_MS1_PIN _EPIN(Z3_E_INDEX, MS1)
#endif
#ifndef Z3_MS2_PIN
#define Z3_MS2_PIN _EPIN(Z3_E_INDEX, MS2)
#endif
#ifndef Z3_MS3_PIN
#define Z3_MS3_PIN _EPIN(Z3_E_INDEX, MS3)
#endif
#endif
#ifndef HAL_SENSITIVE_PINS
#define HAL_SENSITIVE_PINS
#endif
#define SENSITIVE_PINS { \
X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, X_MS1_PIN, X_MS2_PIN, X_CS_PIN, \
Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Y_MS1_PIN, Y_MS2_PIN, Y_CS_PIN, \
Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MS1_PIN, Z_MS2_PIN, Z_MS3_PIN, Z_CS_PIN, Z_MIN_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS BED_PINS \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS \
_X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS \
HAL_SENSITIVE_PINS \
}
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
// Note: default SPI pins are defined in the HAL
#include HAL_PATH(../HAL, spi_pins.h)
#endif // __PINS_H__

36
Marlin/src/pins/pinsDebug_list.h

@ -268,6 +268,9 @@
#if PIN_EXISTS(E0_MS2)
REPORT_NAME_DIGITAL(__LINE__, E0_MS2_PIN)
#endif
#if PIN_EXISTS(E0_MS3)
REPORT_NAME_DIGITAL(__LINE__, E0_MS3_PIN)
#endif
#if PIN_EXISTS(E0_STEP)
REPORT_NAME_DIGITAL(__LINE__, E0_STEP_PIN)
#endif
@ -289,6 +292,9 @@
#if PIN_EXISTS(E1_MS2)
REPORT_NAME_DIGITAL(__LINE__, E1_MS2_PIN)
#endif
#if PIN_EXISTS(E1_MS3)
REPORT_NAME_DIGITAL(__LINE__, E1_MS3_PIN)
#endif
#if PIN_EXISTS(E1_STEP)
REPORT_NAME_DIGITAL(__LINE__, E1_STEP_PIN)
#endif
@ -310,6 +316,9 @@
#if PIN_EXISTS(E2_MS2)
REPORT_NAME_DIGITAL(__LINE__, E2_MS2_PIN)
#endif
#if PIN_EXISTS(E2_MS3)
REPORT_NAME_DIGITAL(__LINE__, E2_MS3_PIN)
#endif
#if PIN_EXISTS(E2_STEP)
REPORT_NAME_DIGITAL(__LINE__, E2_STEP_PIN)
#endif
@ -881,6 +890,9 @@
#if PIN_EXISTS(X_MS2)
REPORT_NAME_DIGITAL(__LINE__, X_MS2_PIN)
#endif
#if PIN_EXISTS(X_MS3)
REPORT_NAME_DIGITAL(__LINE__, X_MS3_PIN)
#endif
#if PIN_EXISTS(X_STEP)
REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN)
#endif
@ -893,6 +905,15 @@
#if PIN_EXISTS(X2_ENABLE)
REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN)
#endif
#if PIN_EXISTS(X2_MS1)
REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN)
#endif
#if PIN_EXISTS(X2_MS2)
REPORT_NAME_DIGITAL(__LINE__, X2_MS2_PIN)
#endif
#if PIN_EXISTS(X2_MS3)
REPORT_NAME_DIGITAL(__LINE__, X2_MS3_PIN)
#endif
#if PIN_EXISTS(X2_STEP)
REPORT_NAME_DIGITAL(__LINE__, X2_STEP_PIN)
#endif
@ -920,6 +941,9 @@
#if PIN_EXISTS(Y_MS2)
REPORT_NAME_DIGITAL(__LINE__, Y_MS2_PIN)
#endif
#if PIN_EXISTS(Y_MS3)
REPORT_NAME_DIGITAL(__LINE__, Y_MS3_PIN)
#endif
#if PIN_EXISTS(Y_STEP)
REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN)
#endif
@ -932,6 +956,15 @@
#if PIN_EXISTS(Y2_ENABLE)
REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN)
#endif
#if PIN_EXISTS(Y2_MS1)
REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN)
#endif
#if PIN_EXISTS(Y2_MS2)
REPORT_NAME_DIGITAL(__LINE__, Y2_MS2_PIN)
#endif
#if PIN_EXISTS(Y2_MS3)
REPORT_NAME_DIGITAL(__LINE__, Y2_MS3_PIN)
#endif
#if PIN_EXISTS(Y2_STEP)
REPORT_NAME_DIGITAL(__LINE__, Y2_STEP_PIN)
#endif
@ -962,6 +995,9 @@
#if PIN_EXISTS(Z_MS2)
REPORT_NAME_DIGITAL(__LINE__, Z_MS2_PIN)
#endif
#if PIN_EXISTS(Z_MS3)
REPORT_NAME_DIGITAL(__LINE__, Z_MS3_PIN)
#endif
#if PIN_EXISTS(Z_STEP)
REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN)
#endif

3
Marlin/src/pins/pins_RURAMPS4D_11.h

@ -119,9 +119,6 @@
//#define E3_MS1_PIN ?
//#define E3_MS2_PIN ?
//#define E3_MS3_PIN ?
//#define Z2_MS1_PIN ? // shared with E3_MS1_PIN
//#define Z2_MS2_PIN ? // shared with E3_MS2_PIN
//#define Z2_MS3_PIN ? // shared with E3_MS3_PIN
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#define Z_MIN_PROBE_PIN 49

516
Marlin/src/pins/sensitive_pins.h

@ -0,0 +1,516 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
//
// Prepare a list of protected pins for M42/M43
//
#if PIN_EXISTS(X_MIN)
#define _X_MIN X_MIN_PIN,
#else
#define _X_MIN
#endif
#if PIN_EXISTS(X_MAX)
#define _X_MAX X_MAX_PIN,
#else
#define _X_MAX
#endif
#if PIN_EXISTS(X_CS)
#define _X_CS X_CS_PIN,
#else
#define _X_CS
#endif
#if PIN_EXISTS(X_MS1)
#define _X_MS1 X_MS1_PIN,
#else
#define _X_MS1
#endif
#if PIN_EXISTS(X_MS2)
#define _X_MS2 X_MS2_PIN,
#else
#define _X_MS2
#endif
#if PIN_EXISTS(X_MS3)
#define _X_MS3 X_MS3_PIN,
#else
#define _X_MS3
#endif
#define _X_PINS X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, _X_MIN _X_MAX _X_MS1 _X_MS2 _X_MS3 _X_CS
#if PIN_EXISTS(Y_MIN)
#define _Y_MIN Y_MIN_PIN,
#else
#define _Y_MIN
#endif
#if PIN_EXISTS(Y_MAX)
#define _Y_MAX Y_MAX_PIN,
#else
#define _Y_MAX
#endif
#if PIN_EXISTS(Y_CS)
#define _Y_CS Y_CS_PIN,
#else
#define _Y_CS
#endif
#if PIN_EXISTS(Y_MS1)
#define _Y_MS1 Y_MS1_PIN,
#else
#define _Y_MS1
#endif
#if PIN_EXISTS(Y_MS2)
#define _Y_MS2 Y_MS2_PIN,
#else
#define _Y_MS2
#endif
#if PIN_EXISTS(Y_MS3)
#define _Y_MS3 Y_MS3_PIN,
#else
#define _Y_MS3
#endif
#define _Y_PINS Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, _Y_MIN _Y_MAX _Y_MS1 _Y_MS2 _Y_MS3 _Y_CS
#if PIN_EXISTS(Z_MIN)
#define _Z_MIN Z_MIN_PIN,
#else
#define _Z_MIN
#endif
#if PIN_EXISTS(Z_MAX)
#define _Z_MAX Z_MAX_PIN,
#else
#define _Z_MAX
#endif
#if PIN_EXISTS(Z_CS)
#define _Z_CS Z_CS_PIN,
#else
#define _Z_CS
#endif
#if PIN_EXISTS(Z_MS1)
#define _Z_MS1 Z_MS1_PIN,
#else
#define _Z_MS1
#endif
#if PIN_EXISTS(Z_MS2)
#define _Z_MS2 Z_MS2_PIN,
#else
#define _Z_MS2
#endif
#if PIN_EXISTS(Z_MS3)
#define _Z_MS3 Z_MS3_PIN,
#else
#define _Z_MS3
#endif
#define _Z_PINS Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, _Z_MIN _Z_MAX _Z_MS1 _Z_MS2 _Z_MS3 _Z_CS
//
// Extruder Chip Select, Digital Micro-steps
//
// Mixing stepper, Switching stepper, or regular stepper
#define E_NEEDED(N) (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > N) \
|| (ENABLED(SWITCHING_EXTRUDER) && E_STEPPERS > N) \
|| (DISABLED(SWITCHING_EXTRUDER) && DISABLED(MIXING_EXTRUDER) && EXTRUDERS > N)
#if PIN_EXISTS(E0_CS)
#define _E0_CS E0_CS_PIN,
#else
#define _E0_CS
#endif
#if PIN_EXISTS(E0_MS1)
#define _E0_MS1 E0_MS1_PIN,
#else
#define _E0_MS1
#endif
#if PIN_EXISTS(E0_MS2)
#define _E0_MS2 E0_MS2_PIN,
#else
#define _E0_MS2
#endif
#if PIN_EXISTS(E0_MS3)
#define _E0_MS3 E0_MS3_PIN,
#else
#define _E0_MS3
#endif
#define _E1_CS
#define _E1_MS1
#define _E1_MS2
#define _E1_MS3
#if E_NEEDED(1)
#if PIN_EXISTS(E1_CS)
#undef _E1_CS
#define _E1_CS E1_CS_PIN,
#endif
#if PIN_EXISTS(E1_MS1)
#undef _E1_MS1
#define _E1_MS1 E1_MS1_PIN,
#endif
#if PIN_EXISTS(E1_MS2)
#undef _E1_MS2
#define _E1_MS2 E1_MS2_PIN,
#endif
#if PIN_EXISTS(E1_MS3)
#undef _E1_MS3
#define _E1_MS3 E1_MS3_PIN,
#endif
#endif
#define _E2_CS
#define _E2_MS1
#define _E2_MS2
#define _E2_MS3
#if E_NEEDED(2)
#if PIN_EXISTS(E2_CS)
#undef _E2_CS
#define _E2_CS E2_CS_PIN,
#endif
#if PIN_EXISTS(E2_MS1)
#undef _E2_MS1
#define _E2_MS1 E2_MS1_PIN,
#endif
#if PIN_EXISTS(E2_MS2)
#undef _E2_MS2
#define _E2_MS2 E2_MS2_PIN,
#endif
#if PIN_EXISTS(E2_MS3)
#undef _E2_MS3
#define _E2_MS3 E2_MS3_PIN,
#endif
#endif
#define _E3_CS
#define _E3_MS1
#define _E3_MS2
#define _E3_MS3
#if E_NEEDED(3)
#if PIN_EXISTS(E3_CS)
#undef _E3_CS
#define _E3_CS E3_CS_PIN,
#endif
#if PIN_EXISTS(E3_MS1)
#undef _E3_MS1
#define _E3_MS1 E3_MS1_PIN,
#endif
#if PIN_EXISTS(E3_MS2)
#undef _E3_MS2
#define _E3_MS2 E3_MS2_PIN,
#endif
#if PIN_EXISTS(E3_MS3)
#undef _E3_MS3
#define _E3_MS3 E3_MS3_PIN,
#endif
#endif
#define _E4_CS
#define _E4_MS1
#define _E4_MS2
#define _E4_MS3
#if E_NEEDED(4)
#if PIN_EXISTS(E4_CS)
#undef _E4_CS
#define _E4_CS E4_CS_PIN,
#endif
#if PIN_EXISTS(E4_MS1)
#undef _E4_MS1
#define _E4_MS1 E4_MS1_PIN,
#endif
#if PIN_EXISTS(E4_MS2)
#undef _E4_MS2
#define _E4_MS2 E4_MS2_PIN,
#endif
#if PIN_EXISTS(E4_MS3)
#undef _E4_MS3
#define _E4_MS3 E4_MS3_PIN,
#endif
#endif
#define _E5_CS
#define _E5_MS1
#define _E5_MS2
#define _E5_MS3
#if E_NEEDED(5)
#if PIN_EXISTS(E5_CS)
#undef _E5_CS
#define _E5_CS E5_CS_PIN,
#endif
#if PIN_EXISTS(E5_MS1)
#undef _E5_MS1
#define _E5_MS1 E5_MS1_PIN,
#endif
#if PIN_EXISTS(E5_MS2)
#undef _E5_MS2
#define _E5_MS2 E5_MS2_PIN,
#endif
#if PIN_EXISTS(E5_MS3)
#undef _E5_MS3
#define _E5_MS3 E5_MS3_PIN,
#endif
#endif
//
// E Steppers
//
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3
#define _E1_PINS
#define _E2_PINS
#define _E3_PINS
#define _E4_PINS
#define _E5_PINS
#if ENABLED(SWITCHING_EXTRUDER)
// Tools 0 and 1 use E0
#if EXTRUDERS > 2 // Tools 2 and 3 use E1
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
#if EXTRUDERS > 4 // Tools 4 and 5 use E2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
#endif
#endif
#elif EXTRUDERS > 1 || ENABLED(MIXING_EXTRUDER)
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
#if EXTRUDERS > 2 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 2)
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
#if EXTRUDERS > 3 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 3)
#undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, _E3_CS _E3_MS1 _E3_MS2 _E3_MS3
#if EXTRUDERS > 4 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 4)
#undef _E4_PINS
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, _E4_CS _E4_MS1 _E4_MS2 _E4_MS3
#if EXTRUDERS > 5 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 5)
#undef _E5_PINS
#define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, _E5_CS _E5_MS1 _E5_MS2 _E5_MS3
#endif // EXTRUDERS > 5 || MIXING_EXTRUDER > 5
#endif // EXTRUDERS > 4 || MIXING_EXTRUDER > 4
#endif // EXTRUDERS > 3 || MIXING_EXTRUDER > 3
#endif // EXTRUDERS > 2 || MIXING_EXTRUDER > 2
#endif // EXTRUDERS > 1 || MIXING_EXTRUDER
//
// Heaters, Fans, Temp Sensors
//
#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN),
#define _H1_PINS
#define _H2_PINS
#define _H3_PINS
#define _H4_PINS
#define _H5_PINS
#if HOTENDS > 1
#undef _H1_PINS
#define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN),
#if HOTENDS > 2
#undef _H2_PINS
#define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN),
#if HOTENDS > 3
#undef _H3_PINS
#define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN),
#if HOTENDS > 4
#undef _H4_PINS
#define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN),
#if HOTENDS > 5
#undef _H5_PINS
#define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN),
#endif // HOTENDS > 5
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2
#endif // HOTENDS > 1
#define _BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
//
// Dual X, Dual Y, Multi-Z
// Chip Select and Digital Micro-stepping
//
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
#if PIN_EXISTS(X2_CS)
#define _X2_CS X2_CS_PIN,
#else
#define _X2_CS
#endif
#if PIN_EXISTS(X2_MS1)
#define _X2_MS1 X2_MS1_PIN,
#else
#define _X2_MS1
#endif
#if PIN_EXISTS(X2_MS2)
#define _X2_MS2 X2_MS2_PIN,
#else
#define _X2_MS2
#endif
#if PIN_EXISTS(X2_MS3)
#define _X2_MS3 X2_MS3_PIN,
#else
#define _X2_MS3
#endif
#define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, _X2_CS _X2_MS1 _X2_MS2 _X2_MS3
#else
#define _X2_PINS
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if PIN_EXISTS(Y2_CS)
#define _Y2_CS Y2_CS_PIN,
#else
#define _Y2_CS
#endif
#if PIN_EXISTS(Y2_MS1)
#define _Y2_MS1 Y2_MS1_PIN,
#else
#define _Y2_MS1
#endif
#if PIN_EXISTS(Y2_MS2)
#define _Y2_MS2 Y2_MS2_PIN,
#else
#define _Y2_MS2
#endif
#if PIN_EXISTS(Y2_MS3)
#define _Y2_MS3 Y2_MS3_PIN,
#else
#define _Y2_MS3
#endif
#define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, _Y2_CS _Y2_MS1 _Y2_MS2 _Y2_MS3
#else
#define _Y2_PINS
#endif
#if Z_MULTI_STEPPER_DRIVERS
#if PIN_EXISTS(Z2_CS)
#define _Z2_CS Z2_CS_PIN,
#else
#define _Z2_CS
#endif
#if PIN_EXISTS(Z2_MS1)
#define _Z2_MS1 Z2_MS1_PIN,
#else
#define _Z2_MS1
#endif
#if PIN_EXISTS(Z2_MS2)
#define _Z2_MS2 Z2_MS2_PIN,
#else
#define _Z2_MS2
#endif
#if PIN_EXISTS(Z2_MS3)
#define _Z2_MS3 Z2_MS3_PIN,
#else
#define _Z2_MS3
#endif
#define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, _Z2_CS _Z2_MS1 _Z2_MS2 _Z2_MS3
#else
#define _Z2_PINS
#endif
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
#if PIN_EXISTS(Z3_CS)
#define _Z3_CS Z3_CS_PIN,
#else
#define _Z3_CS
#endif
#if PIN_EXISTS(Z3_MS1)
#define _Z3_MS1 Z3_MS1_PIN,
#else
#define _Z3_MS1
#endif
#if PIN_EXISTS(Z3_MS2)
#define _Z3_MS2 Z3_MS2_PIN,
#else
#define _Z3_MS2
#endif
#if PIN_EXISTS(Z3_MS3)
#define _Z3_MS3 Z3_MS3_PIN,
#else
#define _Z3_MS3
#endif
#define _Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN, _Z3_CS _Z3_MS1 _Z3_MS2 _Z3_MS3
#else
#define _Z3_PINS
#endif
//
// Generate the final Sensitive Pins array,
// keeping the array as small as possible.
//
#if PIN_EXISTS(PS_ON)
#define _PS_ON PS_ON_PIN,
#else
#define _PS_ON
#endif
#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
#define _Z_PROBE Z_MIN_PROBE_PIN,
#else
#define _Z_PROBE
#endif
#if TEMP_SENSOR_BED && PIN_EXISTS(HEATER_BED)
#define _HEATER_BED HEATER_BED_PIN,
#else
#define _HEATER_BED
#endif
#if PIN_EXISTS(FAN)
#define _FAN0 FAN_PIN,
#else
#define _FAN0
#endif
#if PIN_EXISTS(FAN1)
#define _FAN1 FAN1_PIN,
#else
#define _FAN1
#endif
#if PIN_EXISTS(FAN2)
#define _FAN2 FAN2_PIN,
#else
#define _FAN2
#endif
#if PIN_EXISTS(CONTROLLER_FAN)
#define _FANC CONTROLLER_FAN_PIN,
#else
#define _FANC
#endif
#ifndef HAL_SENSITIVE_PINS
#define HAL_SENSITIVE_PINS
#endif
#define SENSITIVE_PINS { \
_X_PINS _Y_PINS _Z_PINS _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS _Z_PROBE \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS _BED_PINS \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS \
_PS_ON _HEATER_BED _FAN0 _FAN1 _FAN2 _FANC \
HAL_SENSITIVE_PINS \
}
Loading…
Cancel
Save