From 84a11cfedccfeb2df5110565b5d7e404b632131f Mon Sep 17 00:00:00 2001 From: Bob-the-Kuhn Date: Mon, 31 Jul 2017 01:31:14 -0500 Subject: [PATCH] HAL compatible pinsDebug & misc Re-ARM has been tested. AVR has not been tested. 1) moved all cpu specific items to files in the low level HAL directory for that CPU (pinDebug_Re-ARM.h & pinsDebug_AVR_8_bit.h 2) added pinsDebug.h to the top level directory 3) modified HAL_pinsDebug.h to select the correct support file for the selected CPU 4) Patched sanitycheck to stop throwing false errors. A long term solution will be done 5) misc changes & bug fixes arduino.cpp - included macros.h to fix a missing definition pinmap_re-arm.h - removed a duplicated line. pinmapping.h - changed from "ENABLED" to "defined" to fix a compile error ====================================================================== split SanityCheck up, improve pinsDebug system ====================================================================== switch to latest pins_RAMPS_RE_ARM.h --- Marlin/Marlin_main.cpp | 2 +- Marlin/SanityCheck.h | 72 +-- .../HAL_pinsDebug.h => pinsDebug.h} | 147 ++--- Marlin/pinsDebug_list.h | 522 ++++++++++-------- Marlin/pins_RAMPS_RE_ARM.h | 54 +- .../src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h | 102 ++++ Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h | 397 +++++++++++++ .../src/HAL/HAL_AVR/pinsDebug_Teensyduino.h | 26 +- Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h | 29 + .../src/HAL/HAL_LPC1768/SanityCheck_Re_ARM.h | 71 +++ Marlin/src/HAL/HAL_LPC1768/arduino.cpp | 2 +- Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h | 15 +- Marlin/src/HAL/HAL_LPC1768/pinmapping.h | 2 +- Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h | 54 +- Marlin/src/HAL/HAL_SanityCheck.h | 37 ++ .../SanityCheck_Teensy_35_36.h | 29 + Marlin/src/HAL/HAL_pinsDebug.h | 24 +- 17 files changed, 1151 insertions(+), 434 deletions(-) rename Marlin/{src/HAL/HAL_LPC1768/HAL_pinsDebug.h => pinsDebug.h} (63%) create mode 100644 Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h create mode 100644 Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h create mode 100644 Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h create mode 100644 Marlin/src/HAL/HAL_LPC1768/SanityCheck_Re_ARM.h create mode 100644 Marlin/src/HAL/HAL_SanityCheck.h create mode 100644 Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4b5ebe917..b652b0ff3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6632,7 +6632,7 @@ inline void gcode_M42() { #if ENABLED(PINS_DEBUGGING) - #include "src/HAL/HAL_pinsDebug.h" + #include "pinsDebug.h" inline void toggle_pins() { const bool I_flag = parser.boolval('I'); diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 79ced8bf8..151c1d1f3 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -1283,16 +1283,6 @@ static_assert(1 >= 0 #error "HAVE_L6470DRIVER requires at least one L6470 stepper to be set." #endif -/** - * Digipot requirement - */ -#if ENABLED(DIGIPOT_MCP4018) - #if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \ - || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1) - #error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined." - #endif -#endif - /** * Require 4 or more elements in per-axis initializers */ @@ -1306,63 +1296,5 @@ static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has to static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements."); static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements."); -/** - * Sanity checks for Spindle / Laser - */ -#if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." - #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) - #error "SPINDLE_DIR_PIN not defined." - #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) - #if !(WITHIN(SPINDLE_LASER_PWM_PIN, 2, 13) || WITHIN(SPINDLE_LASER_PWM_PIN, 44, 46)) - #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." - #elif SPINDLE_LASER_POWERUP_DELAY < 1 - #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." - #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 - #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." - #elif !defined(SPINDLE_LASER_PWM_INVERT) - #error "SPINDLE_LASER_PWM_INVERT missing." - #elif !defined(SPEED_POWER_SLOPE) || !defined(SPEED_POWER_INTERCEPT) || !defined(SPEED_POWER_MIN) || !defined(SPEED_POWER_MAX) - #error "SPINDLE_LASER_PWM equation constant(s) missing." - #elif SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13) - #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt." - #elif PIN_EXISTS(X_MAX) && X_MAX_PIN == SPINDLE_LASER_PWM_PIN - #error "SPINDLE_LASER_PWM pin is in use by X_MAX endstop." - #elif PIN_EXISTS(X_MIN) && X_MIN_PIN == SPINDLE_LASER_PWM_PIN - #error "SPINDLE_LASER_PWM pin is in use by X_MIN endstop." - #elif PIN_EXISTS(Z_STEP) && Z_STEP_PIN == SPINDLE_LASER_PWM_PIN - #error "SPINDLE_LASER_PWM pin in use by Z_STEP." - #elif NUM_SERVOS > 0 && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5) - #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system." - #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN - #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT_PIN." - #elif PIN_EXISTS(E0_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E0_AUTO_FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by E0_AUTO_FAN_PIN." - #elif PIN_EXISTS(E1_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E1_AUTO_FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by E1_AUTO_FAN_PIN." - #elif PIN_EXISTS(E2_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E2_AUTO_FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by E2_AUTO_FAN_PIN." - #elif PIN_EXISTS(E3_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E3_AUTO_FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by E3_AUTO_FAN_PIN." - #elif PIN_EXISTS(E4_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E4_AUTO_FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by E4_AUTO_FAN_PIN." - #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." - #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." - #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN - #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." - #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN - #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." - #elif PIN_EXISTS(MOTOR_CURRENT_PWM_XY) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_XY_PIN - #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_XY." - #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_Z_PIN - #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_Z." - #elif PIN_EXISTS(MOTOR_CURRENT_PWM_E) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_E_PIN - #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_E." - #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN - #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT." - #endif - #endif -#endif // SPINDLE_LASER_ENABLE + +#include "src/HAL/HAL_SanityCheck.h" // get CPU specific checks diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_pinsDebug.h b/Marlin/pinsDebug.h similarity index 63% rename from Marlin/src/HAL/HAL_LPC1768/HAL_pinsDebug.h rename to Marlin/pinsDebug.h index 03dc0674a..8d0599ce6 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -44,8 +44,14 @@ bool endstop_monitor_flag = false; #define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER) #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER) -#include "../../../pinsDebug_list.h" -#line 51 +#include "pinsDebug_list.h" +#line 49 + +// manually add pins that have names that are macros which don't play well with these macros +#if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY) + static const char RXD_NAME[] PROGMEM = { "RXD" }; + static const char TXD_NAME[] PROGMEM = { "TXD" }; +#endif ///////////////////////////////////////////////////////////////////////////// @@ -81,41 +87,34 @@ const PinInfo pin_array[] PROGMEM = { // manually add pins ... #if SERIAL_PORT == 0 - + #if AVR_ATmega2560_FAMILY + { RXD_NAME, 0, true }, + { TXD_NAME, 1, true }, + #elif AVR_ATmega1284_FAMILY + { RXD_NAME, 8, true }, + { TXD_NAME, 9, true }, + #endif #endif - #include "../../../pinsDebug_list.h" - #line 102 + #include "pinsDebug_list.h" + #line 101 }; -#define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \ -|| MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \ -|| MOTHERBOARD == BOARD_MINIRAMBO \ -|| MOTHERBOARD == BOARD_SCOOVO_X9H) - -#include "pinsDebug_Re_ARM.h" +#include "src/HAL/HAL_pinsDebug.h" // get the correct support file for this CPU -#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), V); SERIAL_ECHO(buffer); }while(0) -#define PWM_CASE(N,Z) \ - case TIMER##N##Z: \ - if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \ - PWM_PRINT(OCR##N##Z); \ - return true; \ - } else return false - -bool PWM_ok = true; static void print_input_or_output(const bool isout) { serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = ")); } + // pretty report with PWM info inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false, const char *start_string = "") { - uint8_t temp_char; - char *name_mem_pointer, buffer[30]; // for the sprintf statements + char buffer[30]; // for the sprintf statements bool found = false, multi_name_pin = false; + for (uint8_t x = 0; x < COUNT(pin_array); x++) { // scan entire array and report all instances of this pin if (GET_ARRAY_PIN(x) == pin) { GET_PIN_INFO(pin); @@ -140,35 +139,42 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f if (pin_is_protected(pin) && !ignore) SERIAL_ECHOPGM("protected "); else { -//SERIAL_PROTOCOLPAIR(" GET_ARRAY_IS_DIGITAL(x) 0 = analog : ", GET_ARRAY_IS_DIGITAL(x)); - - if (!GET_ARRAY_IS_DIGITAL(x)) { - sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); - SERIAL_ECHO(buffer); - } - else { - -//MYSERIAL.printf(" GET_PINMODE(pin) 1 = output : %d ", GET_PINMODE(pin)); - if (!GET_PINMODE(pin)) { - //pinMode(pin, INPUT_PULLUP); // make sure input isn't floating - stopped doing this - // because this could interfere with inductive/capacitive - // sensors (high impedance voltage divider) and with PT100 amplifier - print_input_or_output(false); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + #if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO + if (pin == 46 || pin == 47) { + if (pin == 46) { + print_input_or_output(GET_OUTPUT(46)); + SERIAL_PROTOCOL(READ(46)); + } + else if (pin == 47) { + print_input_or_output(GET_OUTPUT(47)); + SERIAL_PROTOCOL(READ(47)); + } + } + else + #endif + { + if (!GET_ARRAY_IS_DIGITAL(x)) { + sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); + SERIAL_ECHO(buffer); } - #if PWM_ok + else { + if (!GET_PINMODE(pin)) { + //pinMode(pin, INPUT_PULLUP); // make sure input isn't floating - stopped doing this + // because this could interfere with inductive/capacitive + // sensors (high impedance voltage divider) and with PT100 amplifier + print_input_or_output(false); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } else if (pwm_status(pin)) { // do nothing } - #endif - else { - print_input_or_output(true); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + else { + print_input_or_output(true); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } } - } - #if PWM_ok if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report - #endif + } } } SERIAL_EOL(); @@ -176,7 +182,6 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f } // end of for loop if (!found) { - GET_PIN_INFO(pin); sprintf_P(buffer, PSTR("%sPIN: %3d "), start_string, pin); SERIAL_ECHO(buffer); PRINT_PORT(pin); @@ -188,27 +193,41 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f SERIAL_ECHO_SP(8); // add padding if not an analog pin SERIAL_ECHOPGM(""); if (extended) { - if (GET_PINMODE(pin)) { - SERIAL_PROTOCOL_SP(MAX_NAME_LENGTH - 16); - print_input_or_output(true); - SERIAL_PROTOCOL(digitalRead_mod(pin)); - } - else { - if (IS_ANALOG(pin)) { - sprintf_P(buffer, PSTR(" Analog in = %5d"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); - SERIAL_ECHO(buffer); - SERIAL_ECHOPGM(" "); + #if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO + if (pin == 46 || pin == 47) { + SERIAL_PROTOCOL_SP(12); + if (pin == 46) { + print_input_or_output(GET_OUTPUT(46)); + SERIAL_PROTOCOL(READ(46)); + } + else { + print_input_or_output(GET_OUTPUT(47)); + SERIAL_PROTOCOL(READ(47)); + } } else - SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); // add padding if not an analog pin + #endif + { + if (GET_PINMODE(pin)) { + SERIAL_PROTOCOL_SP(MAX_NAME_LENGTH - 16); + print_input_or_output(true); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + else { + if (IS_ANALOG(pin)) { + sprintf_P(buffer, PSTR(" Analog in = %5d"), analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin))); + SERIAL_ECHO(buffer); + SERIAL_ECHOPGM(" "); + } + else + SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); // add padding if not an analog pin - print_input_or_output(false); - SERIAL_PROTOCOL(digitalRead_mod(pin)); - } - //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin - #if PWM_ok + print_input_or_output(false); + SERIAL_PROTOCOL(digitalRead_mod(pin)); + } + //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report - #endif + } } SERIAL_EOL(); } diff --git a/Marlin/pinsDebug_list.h b/Marlin/pinsDebug_list.h index a197b93ee..a3240f6ff 100644 --- a/Marlin/pinsDebug_list.h +++ b/Marlin/pinsDebug_list.h @@ -11,7 +11,7 @@ * (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 + * 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. * @@ -25,77 +25,119 @@ // Following this pattern is a must. // If the new pin name is over 28 characters long then pinsDebug.h will need to be modified. -// Pin list updated from 18 FEB 2017 RCBugfix branch - max length of pin name is 24 +// Pin list updated from 25 JUL 2017 Re-ARM branch - max length of pin name is 24 #line 0 // set __LINE__ to a known value for both passes -#if PIN_EXISTS(ADC_KEYPAD) && ADC_KEYPAD_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(ADC_KEYPAD_PIN, __LINE__ ) +#if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(EXT_AUX_A0, __LINE__ ) +#endif +#if defined(EXT_AUX_A1) && EXT_AUX_A1 >= 0 && EXT_AUX_A1 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(EXT_AUX_A1, __LINE__ ) +#endif +#if defined(EXT_AUX_A2) && EXT_AUX_A2 >= 0 && EXT_AUX_A2 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(EXT_AUX_A2, __LINE__ ) +#endif +#if defined(EXT_AUX_A3) && EXT_AUX_A3 >= 0 && EXT_AUX_A3 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(EXT_AUX_A3, __LINE__ ) +#endif +#if defined(EXT_AUX_A4) && EXT_AUX_A4 >= 0 && EXT_AUX_A4 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(EXT_AUX_A4, __LINE__ ) +#endif +#if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && MAIN_VOLTAGE_MEASURE_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(MAIN_VOLTAGE_MEASURE_PIN, __LINE__ ) +#endif +#if defined(TC1) && TC1 >= 0 && TC1 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TC1, __LINE__ ) +#endif +#if defined(TC2) && TC2 >= 0 && TC2 < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TC2, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_0) && TEMP_0_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_0_PIN, __LINE__ ) #endif -#if defined(__FD) && __FD >= 0 +#if PIN_EXISTS(TEMP_1) && TEMP_1_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_1_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_2) && TEMP_2_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_2_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_3) && TEMP_3_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_3_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_4) && TEMP_4_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_4_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_BED) && TEMP_BED_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_BED_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_CHAMBER) && TEMP_CHAMBER_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_CHAMBER_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(TEMP_X) && TEMP_X_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(TEMP_X_PIN, __LINE__ ) +#endif +#if defined(__FD) && __FD >= 0 REPORT_NAME_DIGITAL(__FD, __LINE__ ) #endif -#if defined(__FS) && __FS >= 0 +#if defined(__FS) && __FS >= 0 REPORT_NAME_DIGITAL(__FS, __LINE__ ) #endif -#if defined(__GD) && __GD >= 0 +#if defined(__GD) && __GD >= 0 REPORT_NAME_DIGITAL(__GD, __LINE__ ) #endif -#if defined(__GS) && __GS >= 0 +#if defined(__GS) && __GS >= 0 REPORT_NAME_DIGITAL(__GS, __LINE__ ) #endif #if PIN_EXISTS(ADC_KEYPAD) - REPORT_NAME_ANALOG(ADC_KEYPAD_PIN, __LINE__ ) + REPORT_NAME_DIGITAL(ADC_KEYPAD_PIN, __LINE__ ) #endif -#if PIN_EXISTS(AVR_MISO) - REPORT_NAME_DIGITAL(AVR_MISO_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(AVR_MOSI) - REPORT_NAME_DIGITAL(AVR_MOSI_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(AVR_SCK) - REPORT_NAME_DIGITAL(AVR_SCK_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(AVR_SS) - REPORT_NAME_DIGITAL(AVR_SS_PIN, __LINE__ ) +#if PIN_EXISTS(ALARM) + REPORT_NAME_DIGITAL(ALARM_PIN, __LINE__ ) #endif #if PIN_EXISTS(BEEPER) REPORT_NAME_DIGITAL(BEEPER_PIN, __LINE__ ) #endif -#if defined(BTN_CENTER) && BTN_CENTER >= 0 +#if defined(BTN_BACK) && BTN_BACK >= 0 + REPORT_NAME_DIGITAL(BTN_BACK, __LINE__ ) +#endif +#if defined(BTN_CENTER) && BTN_CENTER >= 0 REPORT_NAME_DIGITAL(BTN_CENTER, __LINE__ ) #endif -#if defined(BTN_DOWN) && BTN_DOWN >= 0 +#if defined(BTN_DOWN) && BTN_DOWN >= 0 REPORT_NAME_DIGITAL(BTN_DOWN, __LINE__ ) #endif -#if defined(BTN_DWN) && BTN_DWN >= 0 +#if defined(BTN_DWN) && BTN_DWN >= 0 REPORT_NAME_DIGITAL(BTN_DWN, __LINE__ ) #endif -#if defined(BTN_EN1) && BTN_EN1 >= 0 +#if defined(BTN_EN1) && BTN_EN1 >= 0 REPORT_NAME_DIGITAL(BTN_EN1, __LINE__ ) #endif -#if defined(BTN_EN2) && BTN_EN2 >= 0 +#if defined(BTN_EN2) && BTN_EN2 >= 0 REPORT_NAME_DIGITAL(BTN_EN2, __LINE__ ) #endif -#if defined(BTN_ENC) && BTN_ENC >= 0 +#if defined(BTN_ENC) && BTN_ENC >= 0 REPORT_NAME_DIGITAL(BTN_ENC, __LINE__ ) #endif -#if defined(BTN_HOME) && BTN_HOME >= 0 +#if defined(BTN_HOME) && BTN_HOME >= 0 REPORT_NAME_DIGITAL(BTN_HOME, __LINE__ ) #endif -#if defined(BTN_LEFT) && BTN_LEFT >= 0 +#if defined(BTN_LEFT) && BTN_LEFT >= 0 REPORT_NAME_DIGITAL(BTN_LEFT, __LINE__ ) #endif -#if defined(BTN_LFT) && BTN_LFT >= 0 +#if defined(BTN_LFT) && BTN_LFT >= 0 REPORT_NAME_DIGITAL(BTN_LFT, __LINE__ ) #endif -#if defined(BTN_RIGHT) && BTN_RIGHT >= 0 +#if defined(BTN_RIGHT) && BTN_RIGHT >= 0 REPORT_NAME_DIGITAL(BTN_RIGHT, __LINE__ ) #endif -#if defined(BTN_RT) && BTN_RT >= 0 +#if defined(BTN_RT) && BTN_RT >= 0 REPORT_NAME_DIGITAL(BTN_RT, __LINE__ ) #endif -#if defined(BTN_UP) && BTN_UP >= 0 +#if defined(BTN_UP) && BTN_UP >= 0 REPORT_NAME_DIGITAL(BTN_UP, __LINE__ ) #endif #if PIN_EXISTS(CASE_LIGHT) @@ -110,54 +152,72 @@ #if PIN_EXISTS(CUTOFF_TEST) REPORT_NAME_DIGITAL(CUTOFF_TEST_PIN, __LINE__ ) #endif +#if defined(D57) && D57 >= 0 + REPORT_NAME_DIGITAL(D57, __LINE__ ) +#endif +#if defined(D58) && D58 >= 0 + REPORT_NAME_DIGITAL(D58, __LINE__ ) +#endif #if PIN_EXISTS(DAC_DISABLE) REPORT_NAME_DIGITAL(DAC_DISABLE_PIN, __LINE__ ) #endif -#if defined(DAC_STEPPER_VREF) && DAC_STEPPER_VREF >= 0 - REPORT_NAME_DIGITAL(DAC_STEPPER_VREF, __LINE__ ) +#if defined(DAC0_SYNC) && DAC0_SYNC >= 0 + REPORT_NAME_DIGITAL(DAC0_SYNC, __LINE__ ) +#endif +#if defined(DAC1_SYNC) && DAC1_SYNC >= 0 + REPORT_NAME_DIGITAL(DAC1_SYNC, __LINE__ ) #endif #if PIN_EXISTS(DEBUG) REPORT_NAME_DIGITAL(DEBUG_PIN, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SCL) && DIGIPOTS_I2C_SCL >= 0 +#if defined(DIGIPOTS_I2C_SCL) && DIGIPOTS_I2C_SCL >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SCL, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SDA_E0) && DIGIPOTS_I2C_SDA_E0 >= 0 +#if defined(DIGIPOTS_I2C_SDA_E0) && DIGIPOTS_I2C_SDA_E0 >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SDA_E0, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SDA_E1) && DIGIPOTS_I2C_SDA_E1 >= 0 +#if defined(DIGIPOTS_I2C_SDA_E1) && DIGIPOTS_I2C_SDA_E1 >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SDA_E1, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SDA_X) && DIGIPOTS_I2C_SDA_X >= 0 +#if defined(DIGIPOTS_I2C_SDA_X) && DIGIPOTS_I2C_SDA_X >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SDA_X, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SDA_Y) && DIGIPOTS_I2C_SDA_Y >= 0 +#if defined(DIGIPOTS_I2C_SDA_Y) && DIGIPOTS_I2C_SDA_Y >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SDA_Y, __LINE__ ) #endif -#if defined(DIGIPOTS_I2C_SDA_Z) && DIGIPOTS_I2C_SDA_Z >= 0 +#if defined(DIGIPOTS_I2C_SDA_Z) && DIGIPOTS_I2C_SDA_Z >= 0 REPORT_NAME_DIGITAL(DIGIPOTS_I2C_SDA_Z, __LINE__ ) #endif #if PIN_EXISTS(DIGIPOTSS) REPORT_NAME_DIGITAL(DIGIPOTSS_PIN, __LINE__ ) #endif -#if defined(DOGLCD_A0) && DOGLCD_A0 >= 0 +#if defined(DOGLCD_A0) && DOGLCD_A0 >= 0 REPORT_NAME_DIGITAL(DOGLCD_A0, __LINE__ ) #endif -#if defined(DOGLCD_CS) && DOGLCD_CS >= 0 +#if defined(DOGLCD_CS) && DOGLCD_CS >= 0 REPORT_NAME_DIGITAL(DOGLCD_CS, __LINE__ ) #endif -#if defined(DOGLCD_MOSI) && DOGLCD_MOSI >= 0 +#if defined(DOGLCD_MOSI) && DOGLCD_MOSI >= 0 REPORT_NAME_DIGITAL(DOGLCD_MOSI, __LINE__ ) #endif -#if defined(DOGLCD_SCK) && DOGLCD_SCK >= 0 +#if defined(DOGLCD_SCK) && DOGLCD_SCK >= 0 REPORT_NAME_DIGITAL(DOGLCD_SCK, __LINE__ ) #endif +#if PIN_EXISTS(E_MUX0) + REPORT_NAME_DIGITAL(E_MUX0_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(E_MUX1) + REPORT_NAME_DIGITAL(E_MUX1_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(E_MUX2) + REPORT_NAME_DIGITAL(E_MUX2_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(E_STOP) + REPORT_NAME_DIGITAL(E_STOP_PIN, __LINE__ ) +#endif #if PIN_EXISTS(E0_ATT) REPORT_NAME_DIGITAL(E0_ATT_PIN, __LINE__ ) #endif -#if PIN_EXISTS(E0_AUTO_FAN) - REPORT_NAME_DIGITAL(E0_AUTO_FAN_PIN, __LINE__ ) -#endif #if PIN_EXISTS(E0_CS) REPORT_NAME_DIGITAL(E0_CS_PIN, __LINE__ ) #endif @@ -176,9 +236,6 @@ #if PIN_EXISTS(E0_STEP) REPORT_NAME_DIGITAL(E0_STEP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(E1_AUTO_FAN) - REPORT_NAME_DIGITAL(E1_AUTO_FAN_PIN, __LINE__ ) -#endif #if PIN_EXISTS(E1_CS) REPORT_NAME_DIGITAL(E1_CS_PIN, __LINE__ ) #endif @@ -197,8 +254,8 @@ #if PIN_EXISTS(E1_STEP) REPORT_NAME_DIGITAL(E1_STEP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(E2_AUTO_FAN) - REPORT_NAME_DIGITAL(E2_AUTO_FAN_PIN, __LINE__ ) +#if PIN_EXISTS(E2_CS) + REPORT_NAME_DIGITAL(E2_CS_PIN, __LINE__ ) #endif #if PIN_EXISTS(E2_DIR) REPORT_NAME_DIGITAL(E2_DIR_PIN, __LINE__ ) @@ -209,8 +266,8 @@ #if PIN_EXISTS(E2_STEP) REPORT_NAME_DIGITAL(E2_STEP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(E3_AUTO_FAN) - REPORT_NAME_DIGITAL(E3_AUTO_FAN_PIN, __LINE__ ) +#if PIN_EXISTS(E3_CS) + REPORT_NAME_DIGITAL(E3_CS_PIN, __LINE__ ) #endif #if PIN_EXISTS(E3_DIR) REPORT_NAME_DIGITAL(E3_DIR_PIN, __LINE__ ) @@ -218,12 +275,18 @@ #if PIN_EXISTS(E3_ENABLE) REPORT_NAME_DIGITAL(E3_ENABLE_PIN, __LINE__ ) #endif +#if PIN_EXISTS(E3_MS1) + REPORT_NAME_DIGITAL(E3_MS1_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(E3_MS2) + REPORT_NAME_DIGITAL(E3_MS2_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(E3_MS3) + REPORT_NAME_DIGITAL(E3_MS3_PIN, __LINE__ ) +#endif #if PIN_EXISTS(E3_STEP) REPORT_NAME_DIGITAL(E3_STEP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(E4_AUTO_FAN) - REPORT_NAME_DIGITAL(E4_AUTO_FAN_PIN, __LINE__ ) -#endif #if PIN_EXISTS(E4_DIR) REPORT_NAME_DIGITAL(E4_DIR_PIN, __LINE__ ) #endif @@ -233,86 +296,83 @@ #if PIN_EXISTS(E4_STEP) REPORT_NAME_DIGITAL(E4_STEP_PIN, __LINE__ ) #endif -#if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(EXT_AUX_A0, __LINE__ ) +#if defined(ENET_CRS) && ENET_CRS >= 0 + REPORT_NAME_DIGITAL(ENET_CRS, __LINE__ ) #endif -#if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 >= NUM_ANALOG_INPUTS - REPORT_NAME_DIGITAL(EXT_AUX_A0, __LINE__ ) +#if defined(ENET_MDIO) && ENET_MDIO >= 0 + REPORT_NAME_DIGITAL(ENET_MDIO, __LINE__ ) #endif -#if defined(EXT_AUX_A0_IO) && EXT_AUX_A0_IO >= 0 - REPORT_NAME_DIGITAL(EXT_AUX_A0_IO, __LINE__ ) +#if defined(ENET_MOC) && ENET_MOC >= 0 + REPORT_NAME_DIGITAL(ENET_MOC, __LINE__ ) #endif -#if defined(EXT_AUX_A1) && EXT_AUX_A1 >= 0 && EXT_AUX_A1 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(EXT_AUX_A1, __LINE__ ) +#if defined(ENET_RX_ER) && ENET_RX_ER >= 0 + REPORT_NAME_DIGITAL(ENET_RX_ER, __LINE__ ) #endif -#if defined(EXT_AUX_A1) && EXT_AUX_A1 >= 0 && EXT_AUX_A1 >= NUM_ANALOG_INPUTS - REPORT_NAME_DIGITAL(EXT_AUX_A1, __LINE__ ) +#if defined(ENET_RXD0) && ENET_RXD0 >= 0 + REPORT_NAME_DIGITAL(ENET_RXD0, __LINE__ ) #endif -#if defined(EXT_AUX_A1_IO) && EXT_AUX_A1_IO >= 0 - REPORT_NAME_DIGITAL(EXT_AUX_A1_IO, __LINE__ ) +#if defined(ENET_RXD1) && ENET_RXD1 >= 0 + REPORT_NAME_DIGITAL(ENET_RXD1, __LINE__ ) #endif -#if defined(EXT_AUX_A2) && EXT_AUX_A2 >= 0 && EXT_AUX_A2 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(EXT_AUX_A2, __LINE__ ) +#if defined(ENET_TX_EN) && ENET_TX_EN >= 0 + REPORT_NAME_DIGITAL(ENET_TX_EN, __LINE__ ) #endif -#if defined(EXT_AUX_A2) && EXT_AUX_A2 >= 0 && EXT_AUX_A2 >= NUM_ANALOG_INPUTS - REPORT_NAME_DIGITAL(EXT_AUX_A2, __LINE__ ) +#if defined(ENET_TXD0) && ENET_TXD0 >= 0 + REPORT_NAME_DIGITAL(ENET_TXD0, __LINE__ ) #endif -#if defined(EXT_AUX_A2_IO) && EXT_AUX_A2_IO >= 0 - REPORT_NAME_DIGITAL(EXT_AUX_A2_IO, __LINE__ ) +#if defined(ENET_TXD1) && ENET_TXD1 >= 0 + REPORT_NAME_DIGITAL(ENET_TXD1, __LINE__ ) #endif -#if defined(EXT_AUX_A3) && EXT_AUX_A3 >= 0 && EXT_AUX_A3 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(EXT_AUX_A3, __LINE__ ) +#if PIN_EXISTS(EXP_VOLTAGE_LEVEL) + REPORT_NAME_DIGITAL(EXP_VOLTAGE_LEVEL_PIN, __LINE__ ) #endif -#if defined(EXT_AUX_A3) && EXT_AUX_A3 >= 0 && EXT_AUX_A3 >= NUM_ANALOG_INPUTS - REPORT_NAME_DIGITAL(EXT_AUX_A3, __LINE__ ) +#if defined(EXT_AUX_A0_IO) && EXT_AUX_A0_IO >= 0 + REPORT_NAME_DIGITAL(EXT_AUX_A0_IO, __LINE__ ) #endif -#if defined(EXT_AUX_A3_IO) && EXT_AUX_A3_IO >= 0 - REPORT_NAME_DIGITAL(EXT_AUX_A3_IO, __LINE__ ) +#if defined(EXT_AUX_A1_IO) && EXT_AUX_A1_IO >= 0 + REPORT_NAME_DIGITAL(EXT_AUX_A1_IO, __LINE__ ) #endif -#if defined(EXT_AUX_A4) && EXT_AUX_A4 >= 0 && EXT_AUX_A4 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(EXT_AUX_A4, __LINE__ ) +#if defined(EXT_AUX_A2_IO) && EXT_AUX_A2_IO >= 0 + REPORT_NAME_DIGITAL(EXT_AUX_A2_IO, __LINE__ ) #endif -#if defined(EXT_AUX_A4) && EXT_AUX_A4 >= 0 && EXT_AUX_A4 >= NUM_ANALOG_INPUTS - REPORT_NAME_DIGITAL(EXT_AUX_A4, __LINE__ ) +#if defined(EXT_AUX_A3_IO) && EXT_AUX_A3_IO >= 0 + REPORT_NAME_DIGITAL(EXT_AUX_A3_IO, __LINE__ ) #endif -#if defined(EXT_AUX_A4_IO) && EXT_AUX_A4_IO >= 0 +#if defined(EXT_AUX_A4_IO) && EXT_AUX_A4_IO >= 0 REPORT_NAME_DIGITAL(EXT_AUX_A4_IO, __LINE__ ) #endif -#if defined(EXT_AUX_PWM_D24) && EXT_AUX_PWM_D24 >= 0 +#if defined(EXT_AUX_PWM_D24) && EXT_AUX_PWM_D24 >= 0 REPORT_NAME_DIGITAL(EXT_AUX_PWM_D24, __LINE__ ) #endif -#if defined(EXT_AUX_RX1_D2) && EXT_AUX_RX1_D2 >= 0 +#if defined(EXT_AUX_RX1_D2) && EXT_AUX_RX1_D2 >= 0 REPORT_NAME_DIGITAL(EXT_AUX_RX1_D2, __LINE__ ) #endif -#if defined(EXT_AUX_SCL_D0) && EXT_AUX_SCL_D0 >= 0 +#if defined(EXT_AUX_SCL_D0) && EXT_AUX_SCL_D0 >= 0 REPORT_NAME_DIGITAL(EXT_AUX_SCL_D0, __LINE__ ) #endif -#if defined(EXT_AUX_SDA_D1) && EXT_AUX_SDA_D1 >= 0 +#if defined(EXT_AUX_SDA_D1) && EXT_AUX_SDA_D1 >= 0 REPORT_NAME_DIGITAL(EXT_AUX_SDA_D1, __LINE__ ) #endif -#if defined(EXT_AUX_TX1_D3) && EXT_AUX_TX1_D3 >= 0 +#if defined(EXT_AUX_TX1_D3) && EXT_AUX_TX1_D3 >= 0 REPORT_NAME_DIGITAL(EXT_AUX_TX1_D3, __LINE__ ) #endif -#if defined(EXTRUDER_0_AUTO_FAN) && EXTRUDER_0_AUTO_FAN >= 0 - REPORT_NAME_DIGITAL(EXTRUDER_0_AUTO_FAN, __LINE__ ) -#endif -#if defined(EXTRUDER_1_AUTO_FAN) && EXTRUDER_1_AUTO_FAN >= 0 - REPORT_NAME_DIGITAL(EXTRUDER_1_AUTO_FAN, __LINE__ ) -#endif #if PIN_EXISTS(FAN) REPORT_NAME_DIGITAL(FAN_PIN, __LINE__ ) -#endif +#endif #if PIN_EXISTS(FAN1) REPORT_NAME_DIGITAL(FAN1_PIN, __LINE__ ) #endif #if PIN_EXISTS(FAN2) REPORT_NAME_DIGITAL(FAN2_PIN, __LINE__ ) #endif +#if PIN_EXISTS(FAN3) + REPORT_NAME_DIGITAL(FAN3_PIN, __LINE__ ) +#endif #if PIN_EXISTS(FIL_RUNOUT) REPORT_NAME_DIGITAL(FIL_RUNOUT_PIN, __LINE__ ) #endif -#if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ ) +#if defined(GEN7_VERSION) && GEN7_VERSION >= 0 + REPORT_NAME_DIGITAL(GEN7_VERSION, __LINE__ ) #endif #if PIN_EXISTS(HEATER_0) REPORT_NAME_DIGITAL(HEATER_0_PIN, __LINE__ ) @@ -344,6 +404,9 @@ #if PIN_EXISTS(HOME) REPORT_NAME_DIGITAL(HOME_PIN, __LINE__ ) #endif +#if defined(I2C_EEPROM) && I2C_EEPROM >= 0 + REPORT_NAME_DIGITAL(I2C_EEPROM, __LINE__ ) +#endif #if PIN_EXISTS(I2C_SCL) REPORT_NAME_DIGITAL(I2C_SCL_PIN, __LINE__ ) #endif @@ -356,53 +419,56 @@ #if PIN_EXISTS(LCD_BACKLIGHT) REPORT_NAME_DIGITAL(LCD_BACKLIGHT_PIN, __LINE__ ) #endif -#if defined(LCD_CONTRAST) && LCD_CONTRAST >= 0 - REPORT_NAME_DIGITAL(LCD_CONTRAST, __LINE__ ) -#endif -#if defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_D4, __LINE__ ) #endif -#if defined(LCD_PINS_D5) && LCD_PINS_D5 >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_D5, __LINE__ ) #endif -#if defined(LCD_PINS_D6) && LCD_PINS_D6 >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_D6, __LINE__ ) #endif -#if defined(LCD_PINS_D7) && LCD_PINS_D7 >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_D7, __LINE__ ) #endif -#if defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_ENABLE, __LINE__ ) #endif -#if defined(LCD_PINS_RS) && LCD_PINS_RS >= 0 +#if PIN_EXISTS(LCD) REPORT_NAME_DIGITAL(LCD_PINS_RS, __LINE__ ) #endif -#if defined(LCD_SDSS) && LCD_SDSS >= 0 +#if defined(LCD_SDSS) && LCD_SDSS >= 0 REPORT_NAME_DIGITAL(LCD_SDSS, __LINE__ ) #endif +#if PIN_EXISTS(LED_GREEN) + REPORT_NAME_DIGITAL(LED_GREEN_PIN, __LINE__ ) +#endif #if PIN_EXISTS(LED) REPORT_NAME_DIGITAL(LED_PIN, __LINE__ ) #endif -#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && MAIN_VOLTAGE_MEASURE_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(MAIN_VOLTAGE_MEASURE_PIN, __LINE__ ) +#if PIN_EXISTS(LED_RED) + REPORT_NAME_DIGITAL(LED_RED_PIN, __LINE__ ) #endif -#if defined(MAX6675_SS) && MAX6675_SS >= 0 - REPORT_NAME_DIGITAL(MAX6675_SS, __LINE__ ) +#if PIN_EXISTS(MAX) + REPORT_NAME_DIGITAL(MAX_PIN, __LINE__ ) #endif -#if PIN_EXISTS(MISO) - REPORT_NAME_DIGITAL(MISO_PIN, __LINE__ ) +#if PIN_EXISTS(MAX6675_DO) + REPORT_NAME_DIGITAL(MAX6675_DO_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(MAX6675_SCK) + REPORT_NAME_DIGITAL(MAX6675_SCK_PIN, __LINE__ ) #endif -#if PIN_EXISTS(MOSFET_A) - REPORT_NAME_DIGITAL(MOSFET_A_PIN, __LINE__ ) +#if defined(MAX6675_SS) && MAX6675_SS >= 0 + REPORT_NAME_DIGITAL(MAX6675_SS, __LINE__ ) #endif -#if PIN_EXISTS(MOSFET_B) - REPORT_NAME_DIGITAL(MOSFET_B_PIN, __LINE__ ) +#if defined(MISO) && MISO >= 0 + REPORT_NAME_DIGITAL(MISO, __LINE__ ) #endif -#if PIN_EXISTS(MOSFET_C) - REPORT_NAME_DIGITAL(MOSFET_C_PIN, __LINE__ ) +#if PIN_EXISTS(MISO) + REPORT_NAME_DIGITAL(MISO_PIN, __LINE__ ) #endif -#if PIN_EXISTS(MOSFET_D) - REPORT_NAME_DIGITAL(MOSFET_D_PIN, __LINE__ ) +#if defined(MOSI) && MOSI >= 0 + REPORT_NAME_DIGITAL(MOSI, __LINE__ ) #endif #if PIN_EXISTS(MOSI) REPORT_NAME_DIGITAL(MOSI_PIN, __LINE__ ) @@ -416,6 +482,12 @@ #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) REPORT_NAME_DIGITAL(MOTOR_CURRENT_PWM_Z_PIN, __LINE__ ) #endif +#if PIN_EXISTS(MOTOR_FAULT) + REPORT_NAME_DIGITAL(MOTOR_FAULT_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(NUM_DIGITAL) + REPORT_NAME_DIGITAL(NUM_DIGITAL_PINS, __LINE__ ) +#endif #if PIN_EXISTS(ORIG_E0_AUTO_FAN) REPORT_NAME_DIGITAL(ORIG_E0_AUTO_FAN_PIN, __LINE__ ) #endif @@ -428,9 +500,6 @@ #if PIN_EXISTS(ORIG_E3_AUTO_FAN) REPORT_NAME_DIGITAL(ORIG_E3_AUTO_FAN_PIN, __LINE__ ) #endif -#if PIN_EXISTS(ORIG_E4_AUTO_FAN) - REPORT_NAME_DIGITAL(ORIG_E4_AUTO_FAN_PIN, __LINE__ ) -#endif #if PIN_EXISTS(PHOTOGRAPH) REPORT_NAME_DIGITAL(PHOTOGRAPH_PIN, __LINE__ ) #endif @@ -443,26 +512,8 @@ #if PIN_EXISTS(PWM_2) REPORT_NAME_DIGITAL(PWM_2_PIN, __LINE__ ) #endif -#if PIN_EXISTS(RAMPS_D10) - REPORT_NAME_DIGITAL(RAMPS_D10_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RAMPS_D8) - REPORT_NAME_DIGITAL(RAMPS_D8_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RAMPS_D9) - REPORT_NAME_DIGITAL(RAMPS_D9_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RGB_LED_R) - REPORT_NAME_DIGITAL(RGB_LED_R_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RGB_LED_G) - REPORT_NAME_DIGITAL(RGB_LED_G_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RGB_LED_B) - REPORT_NAME_DIGITAL(RGB_LED_B_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(RGB_LED_W) - REPORT_NAME_DIGITAL(RGB_LED_W_PIN, __LINE__ ) +#if defined(REF_CLK) && REF_CLK >= 0 + REPORT_NAME_DIGITAL(REF_CLK, __LINE__ ) #endif #if PIN_EXISTS(RX_ENABLE) REPORT_NAME_DIGITAL(RX_ENABLE_PIN, __LINE__ ) @@ -470,24 +521,24 @@ #if PIN_EXISTS(SAFETY_TRIGGERED) REPORT_NAME_DIGITAL(SAFETY_TRIGGERED_PIN, __LINE__ ) #endif +#if defined(SCK) && SCK >= 0 + REPORT_NAME_DIGITAL(SCK, __LINE__ ) +#endif #if PIN_EXISTS(SCK) REPORT_NAME_DIGITAL(SCK_PIN, __LINE__ ) #endif -#if defined(SCL) && SCL >= 0 - REPORT_NAME_DIGITAL(SCL, __LINE__ ) -#endif #if PIN_EXISTS(SD_DETECT) REPORT_NAME_DIGITAL(SD_DETECT_PIN, __LINE__ ) #endif -#if defined(SDA) && SDA >= 0 - REPORT_NAME_DIGITAL(SDA, __LINE__ ) -#endif -#if defined(SDPOWER) && SDPOWER >= 0 +#if defined(SDPOWER) && SDPOWER >= 0 REPORT_NAME_DIGITAL(SDPOWER, __LINE__ ) #endif -#if defined(SDSS) && SDSS >= 0 +#if defined(SDSS) && SDSS >= 0 REPORT_NAME_DIGITAL(SDSS, __LINE__ ) #endif +#if defined(SERVO0) && SERVO0 >= 0 + REPORT_NAME_DIGITAL(SERVO0, __LINE__ ) +#endif #if PIN_EXISTS(SERVO0) REPORT_NAME_DIGITAL(SERVO0_PIN, __LINE__ ) #endif @@ -500,45 +551,54 @@ #if PIN_EXISTS(SERVO3) REPORT_NAME_DIGITAL(SERVO3_PIN, __LINE__ ) #endif -#if defined(SHIFT_CLK) && SHIFT_CLK >= 0 +#if defined(SHIFT_CLK) && SHIFT_CLK >= 0 REPORT_NAME_DIGITAL(SHIFT_CLK, __LINE__ ) #endif -#if defined(SHIFT_EN) && SHIFT_EN >= 0 +#if defined(SHIFT_EN) && SHIFT_EN >= 0 REPORT_NAME_DIGITAL(SHIFT_EN, __LINE__ ) #endif -#if defined(SHIFT_LD) && SHIFT_LD >= 0 +#if defined(SHIFT_LD) && SHIFT_LD >= 0 REPORT_NAME_DIGITAL(SHIFT_LD, __LINE__ ) #endif -#if defined(SHIFT_OUT) && SHIFT_OUT >= 0 +#if defined(SHIFT_OUT) && SHIFT_OUT >= 0 REPORT_NAME_DIGITAL(SHIFT_OUT, __LINE__ ) #endif -#if PIN_EXISTS(SLED) - REPORT_NAME_DIGITAL(SLED_PIN, __LINE__ ) -#endif #if PIN_EXISTS(SLEEP_WAKE) REPORT_NAME_DIGITAL(SLEEP_WAKE_PIN, __LINE__ ) #endif -#if PIN_EXISTS(SOL0) - REPORT_NAME_DIGITAL(SOL0_PIN, __LINE__ ) -#endif #if PIN_EXISTS(SOL1) REPORT_NAME_DIGITAL(SOL1_PIN, __LINE__ ) #endif #if PIN_EXISTS(SOL2) REPORT_NAME_DIGITAL(SOL2_PIN, __LINE__ ) #endif -#if PIN_EXISTS(SOL3) - REPORT_NAME_DIGITAL(SOL3_PIN, __LINE__ ) +#if defined(SPARE_IO) && SPARE_IO >= 0 + REPORT_NAME_DIGITAL(SPARE_IO, __LINE__ ) #endif -#if PIN_EXISTS(SOL4) - REPORT_NAME_DIGITAL(SOL4_PIN, __LINE__ ) +#if defined(SPI_CHAN_DAC) && SPI_CHAN_DAC >= 0 + REPORT_NAME_DIGITAL(SPI_CHAN_DAC, __LINE__ ) #endif -#if defined(SPARE_IO) && SPARE_IO >= 0 - REPORT_NAME_DIGITAL(SPARE_IO, __LINE__ ) +#if defined(SPI_CHAN_EEPROM1) && SPI_CHAN_EEPROM1 >= 0 + REPORT_NAME_DIGITAL(SPI_CHAN_EEPROM1, __LINE__ ) +#endif +#if defined(SPI_EEPROM) && SPI_EEPROM >= 0 + REPORT_NAME_DIGITAL(SPI_EEPROM, __LINE__ ) +#endif +#if defined(SPI_EEPROM1_CS) && SPI_EEPROM1_CS >= 0 + REPORT_NAME_DIGITAL(SPI_EEPROM1_CS, __LINE__ ) +#endif +#if defined(SPI_EEPROM2_CS) && SPI_EEPROM2_CS >= 0 + REPORT_NAME_DIGITAL(SPI_EEPROM2_CS, __LINE__ ) +#endif +#if defined(SPI_FLASH_CS) && SPI_FLASH_CS >= 0 + REPORT_NAME_DIGITAL(SPI_FLASH_CS, __LINE__ ) #endif #if PIN_EXISTS(SPINDLE_DIR) REPORT_NAME_DIGITAL(SPINDLE_DIR_PIN, __LINE__ ) #endif +#if PIN_EXISTS(SPINDLE_ENABLE) + REPORT_NAME_DIGITAL(SPINDLE_ENABLE_PIN, __LINE__ ) +#endif #if PIN_EXISTS(SPINDLE_LASER_ENABLE) REPORT_NAME_DIGITAL(SPINDLE_LASER_ENABLE_PIN, __LINE__ ) #endif @@ -554,12 +614,12 @@ #if PIN_EXISTS(SR_STROBE) REPORT_NAME_DIGITAL(SR_STROBE_PIN, __LINE__ ) #endif -#if PIN_EXISTS(SS) - REPORT_NAME_DIGITAL(SS_PIN, __LINE__ ) -#endif #if PIN_EXISTS(STAT_LED_BLUE) REPORT_NAME_DIGITAL(STAT_LED_BLUE_PIN, __LINE__ ) #endif +#if defined(STAT_LED_RED_LED) && STAT_LED_RED_LED >= 0 + REPORT_NAME_DIGITAL(STAT_LED_RED_LED, __LINE__ ) +#endif #if PIN_EXISTS(STAT_LED_RED) REPORT_NAME_DIGITAL(STAT_LED_RED_PIN, __LINE__ ) #endif @@ -569,47 +629,11 @@ #if PIN_EXISTS(SUICIDE) REPORT_NAME_DIGITAL(SUICIDE_PIN, __LINE__ ) #endif -#if defined(TC1) && TC1 >= 0 && TC1 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TC1, __LINE__ ) -#endif -#if defined(TC2) && TC2 >= 0 && TC2 < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TC2, __LINE__ ) -#endif -#if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_0) && TEMP_0_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_0_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_1) && TEMP_1_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_1_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_2) && TEMP_2_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_2_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_3) && TEMP_3_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_3_PIN, __LINE__ ) +#if defined(THERMO_CS1) && THERMO_CS1 >= 0 + REPORT_NAME_DIGITAL(THERMO_CS1, __LINE__ ) #endif -#if PIN_EXISTS(TEMP_4) && TEMP_4_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_4_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_5) && TEMP_5_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_5_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_6) && TEMP_6_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_6_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_7) && TEMP_7_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_7_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_BED) && TEMP_BED_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_BED_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_CHAMBER) && TEMP_CHAMBER_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_CHAMBER_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(TEMP_X) && TEMP_X_PIN < NUM_ANALOG_INPUTS - REPORT_NAME_ANALOG(TEMP_X_PIN, __LINE__ ) +#if defined(THERMO_CS2) && THERMO_CS2 >= 0 + REPORT_NAME_DIGITAL(THERMO_CS2, __LINE__ ) #endif #if PIN_EXISTS(THERMO_DO) REPORT_NAME_DIGITAL(THERMO_DO_PIN, __LINE__ ) @@ -617,18 +641,42 @@ #if PIN_EXISTS(THERMO_SCK) REPORT_NAME_DIGITAL(THERMO_SCK_PIN, __LINE__ ) #endif +#if defined(TLC_BLANK_BIT) && TLC_BLANK_BIT >= 0 + REPORT_NAME_DIGITAL(TLC_BLANK_BIT, __LINE__ ) +#endif #if PIN_EXISTS(TLC_BLANK) REPORT_NAME_DIGITAL(TLC_BLANK_PIN, __LINE__ ) #endif +#if defined(TLC_BLANK_PORT) && TLC_BLANK_PORT >= 0 + REPORT_NAME_DIGITAL(TLC_BLANK_PORT, __LINE__ ) +#endif +#if defined(TLC_CLOCK_BIT) && TLC_CLOCK_BIT >= 0 + REPORT_NAME_DIGITAL(TLC_CLOCK_BIT, __LINE__ ) +#endif #if PIN_EXISTS(TLC_CLOCK) REPORT_NAME_DIGITAL(TLC_CLOCK_PIN, __LINE__ ) #endif +#if defined(TLC_CLOCK_PORT) && TLC_CLOCK_PORT >= 0 + REPORT_NAME_DIGITAL(TLC_CLOCK_PORT, __LINE__ ) +#endif +#if defined(TLC_DATA_BIT) && TLC_DATA_BIT >= 0 + REPORT_NAME_DIGITAL(TLC_DATA_BIT, __LINE__ ) +#endif #if PIN_EXISTS(TLC_DATA) REPORT_NAME_DIGITAL(TLC_DATA_PIN, __LINE__ ) #endif +#if defined(TLC_DATA_PORT) && TLC_DATA_PORT >= 0 + REPORT_NAME_DIGITAL(TLC_DATA_PORT, __LINE__ ) +#endif +#if defined(TLC_XLAT_BIT) && TLC_XLAT_BIT >= 0 + REPORT_NAME_DIGITAL(TLC_XLAT_BIT, __LINE__ ) +#endif #if PIN_EXISTS(TLC_XLAT) REPORT_NAME_DIGITAL(TLC_XLAT_PIN, __LINE__ ) #endif +#if defined(TLC_XLAT_PORT) && TLC_XLAT_PORT >= 0 + REPORT_NAME_DIGITAL(TLC_XLAT_PORT, __LINE__ ) +#endif #if PIN_EXISTS(TOOL_0) REPORT_NAME_DIGITAL(TOOL_0_PIN, __LINE__ ) #endif @@ -659,13 +707,13 @@ #if PIN_EXISTS(TX_ENABLE) REPORT_NAME_DIGITAL(TX_ENABLE_PIN, __LINE__ ) #endif -#if defined(UI1) && UI1 >= 0 +#if defined(UI1) && UI1 >= 0 REPORT_NAME_DIGITAL(UI1, __LINE__ ) #endif -#if defined(UI2) && UI2 >= 0 +#if defined(UI2) && UI2 >= 0 REPORT_NAME_DIGITAL(UI2, __LINE__ ) #endif -#if defined(UNUSED_PWM) && UNUSED_PWM >= 0 +#if defined(UNUSED_PWM) && UNUSED_PWM >= 0 REPORT_NAME_DIGITAL(UNUSED_PWM, __LINE__ ) #endif #if PIN_EXISTS(X_ATT) @@ -698,15 +746,6 @@ #if PIN_EXISTS(X_STOP) REPORT_NAME_DIGITAL(X_STOP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(X2_DIR) - REPORT_NAME_DIGITAL(X2_DIR_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(X2_ENABLE) - REPORT_NAME_DIGITAL(X2_ENABLE_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(X2_STEP) - REPORT_NAME_DIGITAL(X2_STEP_PIN, __LINE__ ) -#endif #if PIN_EXISTS(Y_ATT) REPORT_NAME_DIGITAL(Y_ATT_PIN, __LINE__ ) #endif @@ -737,15 +776,6 @@ #if PIN_EXISTS(Y_STOP) REPORT_NAME_DIGITAL(Y_STOP_PIN, __LINE__ ) #endif -#if PIN_EXISTS(Y2_DIR) - REPORT_NAME_DIGITAL(Y2_DIR_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(Y2_ENABLE) - REPORT_NAME_DIGITAL(Y2_ENABLE_PIN, __LINE__ ) -#endif -#if PIN_EXISTS(Y2_STEP) - REPORT_NAME_DIGITAL(Y2_STEP_PIN, __LINE__ ) -#endif #if PIN_EXISTS(Z_ATT) REPORT_NAME_DIGITAL(Z_ATT_PIN, __LINE__ ) #endif @@ -773,19 +803,39 @@ #if PIN_EXISTS(Z_MS2) REPORT_NAME_DIGITAL(Z_MS2_PIN, __LINE__ ) #endif +#if defined(Z_probe_pin) && Z_probe_pin >= 0 + REPORT_NAME_DIGITAL(Z_probe_pin, __LINE__ ) +#endif #if PIN_EXISTS(Z_STEP) REPORT_NAME_DIGITAL(Z_STEP_PIN, __LINE__ ) #endif #if PIN_EXISTS(Z_STOP) REPORT_NAME_DIGITAL(Z_STOP_PIN, __LINE__ ) #endif +#if PIN_EXISTS(Z2_CS) + REPORT_NAME_DIGITAL(Z2_CS_PIN, __LINE__ ) +#endif #if PIN_EXISTS(Z2_DIR) REPORT_NAME_DIGITAL(Z2_DIR_PIN, __LINE__ ) #endif #if PIN_EXISTS(Z2_ENABLE) REPORT_NAME_DIGITAL(Z2_ENABLE_PIN, __LINE__ ) #endif +#if PIN_EXISTS(Z2_MS1) + REPORT_NAME_DIGITAL(Z2_MS1_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(Z2_MS2) + REPORT_NAME_DIGITAL(Z2_MS2_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(Z2_MS3) + REPORT_NAME_DIGITAL(Z2_MS3_PIN, __LINE__ ) +#endif #if PIN_EXISTS(Z2_STEP) REPORT_NAME_DIGITAL(Z2_STEP_PIN, __LINE__ ) #endif - +#if PIN_EXISTS(ZRIB_V20_D6) + REPORT_NAME_DIGITAL(ZRIB_V20_D6_PIN, __LINE__ ) +#endif +#if PIN_EXISTS(ZRIB_V20_D9) + REPORT_NAME_DIGITAL(ZRIB_V20_D9_PIN, __LINE__ ) +#endif diff --git a/Marlin/pins_RAMPS_RE_ARM.h b/Marlin/pins_RAMPS_RE_ARM.h index 520f884df..9afa514c0 100644 --- a/Marlin/pins_RAMPS_RE_ARM.h +++ b/Marlin/pins_RAMPS_RE_ARM.h @@ -194,11 +194,9 @@ // #if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) #if !defined(NUM_SERVOS) || NUM_SERVOS == 1 // must use servo connector - #undef SERVO0 #undef SERVO1 #undef SERVO2 #undef SERVO3 - #define SERVO0 4 #define SPINDLE_LASER_ENABLE_PIN 6 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 @@ -214,16 +212,20 @@ /** * LCD / Controller * + * All controllers can use J3 and J5 on the Re-ARM board. Custom cabling will be required. + */ + +/** + * Smart LCD adapter + * * The Smart LCD adapter can be used for the two 10 pin LCD controllers such as * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use * DOGLCD_A0, DOGLCD_CS, LCD_PINS_D5, LCD_PINS_D6 or LCD_PINS_D7. A custom cable * is needed to pick up 5V for the EXP1 connection. * - * All controllers can use J3 and J5 on the Re-ARM board. Custom cabling will be required. - * - * SD card on the LCD is not yet supported. - * - * SD card on the LCD uses the same SPI signals as the LCD. + * SD card on the LCD uses the same SPI signals as the LCD. This results in garbage/lines + * on the LCD display during accesses of the SD card. The menus/code has been arranged so + * that the garbage/lines are erased immediately after the SD card accesses are completed. */ #if ENABLED(ULTRA_LCD) @@ -243,6 +245,24 @@ //#define SHIFT_EN 41 // J5-4 & AUX-4 #endif + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && ENABLED(SDSUPPORT) + #define SDCARD_SORT_ALPHA // Using SORT feature to keep one directory level in RAM + // When going up/down directory levels the SD card is + // accessed but the garbage/lines are removed when the + // LCD updates + + // SD Card Sorting options + #if ENABLED(SDCARD_SORT_ALPHA) + #define SDSORT_LIMIT 255 // Maximum number of sorted items (10-256). + #define FOLDER_SORTING -1 // -1=above 0=none 1=below + #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. + #define SDSORT_USES_RAM true // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) + #define SDSORT_CACHE_NAMES true // Keep sorted items in RAM longer for speedy performance. Most expensive option. + #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! + #endif + #endif + #define BTN_EN1 31 // J3-2 & AUX-4 #define BTN_EN2 33 // J3-4 & AUX-4 #define BTN_ENC 35 // J3-3 & AUX-4 @@ -300,6 +320,26 @@ #define ENET_TXD0 78 // J12-11 #define ENET_TXD1 79 // J12-12 +/** + * PWMS + * + * There are 6 PWMS. Each PWM can be assigned to one of two pins. + * + * SERVO2 does NOT have a PWM assigned to it. + * + * PWM1.1 DIO4 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM + * PWM1.1 DIO26 E0_STEP_PIN + * PWM1.2 DIO11 SERVO0_PIN + * PWM1.2 DIO54 X_STEP_PIN + * PWM1.3 DIO6 SERVO1_PIN J5-1 + * PWM1.3 DIO60 Y_STEP_PIN + * PWM1.4 DIO53 SDSS(SSEL0) J3-5 AUX-3 + * PWM1.4 DIO46 Z_STEP_PIN + * PWM1.5 DIO3 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.5 DIO9 RAMPS_D9_PIN + * PWM1.6 DIO14 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.6 DIO10 RAMPS_D10_PIN + */ /** * The following pins are NOT available in a Re-ARM system diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h new file mode 100644 index 000000000..a8bad153e --- /dev/null +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h @@ -0,0 +1,102 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 . + * + */ + +/** + * Test AVR specific configuration values for errors at compile-time. + */ + +/** + * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. + */ + + +/** + * Digipot requirement + */ + #if ENABLED(DIGIPOT_MCP4018) + #if !defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) \ + || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1) + #error "DIGIPOT_MCP4018 requires DIGIPOTS_I2C_SDA_* pins to be defined." + #endif +#endif + + + +/** + * Sanity checks for Spindle / Laser + */ + +#if ENABLED(SPINDLE_LASER_ENABLE) + #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) + #error "SPINDLE_DIR_PIN not defined." + #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) + #if !(WITHIN(SPINDLE_LASER_PWM_PIN, 2, 13) || WITHIN(SPINDLE_LASER_PWM_PIN, 44, 46)) + #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." + #elif SPINDLE_LASER_POWERUP_DELAY < 1 + #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." + #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 + #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." + #elif !defined(SPINDLE_LASER_PWM_INVERT) + #error "SPINDLE_LASER_PWM_INVERT missing." + #elif !defined(SPEED_POWER_SLOPE) || !defined(SPEED_POWER_INTERCEPT) || !defined(SPEED_POWER_MIN) || !defined(SPEED_POWER_MAX) + #error "SPINDLE_LASER_PWM equation constant(s) missing." + #elif SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13) + #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt." + #elif PIN_EXISTS(X_MAX) && X_MAX_PIN == SPINDLE_LASER_PWM_PIN + #error "SPINDLE_LASER_PWM pin is in use by X_MAX endstop." + #elif PIN_EXISTS(X_MIN) && X_MIN_PIN == SPINDLE_LASER_PWM_PIN + #error "SPINDLE_LASER_PWM pin is in use by X_MIN endstop." + #elif PIN_EXISTS(Z_STEP) && Z_STEP_PIN == SPINDLE_LASER_PWM_PIN + #error "SPINDLE_LASER_PWM pin in use by Z_STEP." + #elif NUM_SERVOS > 0 && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5) + #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system." + #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT_PIN." + #elif PIN_EXISTS(E0_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E0_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E0_AUTO_FAN_PIN." + #elif PIN_EXISTS(E1_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E1_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E1_AUTO_FAN_PIN." + #elif PIN_EXISTS(E2_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E2_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E2_AUTO_FAN_PIN." + #elif PIN_EXISTS(E3_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E3_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E3_AUTO_FAN_PIN." + #elif PIN_EXISTS(E4_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E4_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E4_AUTO_FAN_PIN." + #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." + #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." + #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." + #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." + #elif PIN_EXISTS(MOTOR_CURRENT_PWM_XY) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_XY_PIN + #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_XY." + #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_Z_PIN + #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_Z." + #elif PIN_EXISTS(MOTOR_CURRENT_PWM_E) && SPINDLE_LASER_PWM_PIN == MOTOR_CURRENT_PWM_E_PIN + #error "SPINDLE_LASER_PWM_PIN is used by MOTOR_CURRENT_PWM_E." + #endif + #endif +#endif // SPINDLE_LASER_ENABLE diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h new file mode 100644 index 000000000..a65b28f51 --- /dev/null +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h @@ -0,0 +1,397 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 . + * + */ + +/** + * PWM print routines for Atmel 8 bit AVR CPUs + */ + + +#define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \ +|| MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \ +|| MOTHERBOARD == BOARD_MINIRAMBO \ +|| MOTHERBOARD == BOARD_SCOOVO_X9H) + +#if AVR_AT90USB1286_FAMILY + // Working with Teensyduino extension so need to re-define some things + #include "pinsDebug_Teensyduino.h" + // Can't use the "digitalPinToPort" function from the Teensyduino type IDEs + // portModeRegister takes a different argument + #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) + #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) + #define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p) + #define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin)) +#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70 + #include "pinsDebug_plus_70.h" + #define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p) + #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p) + #define digitalPinToPort_DEBUG(p) digitalPinToPort_plus_70(p) + bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); } + +#else + #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) + #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) + #define digitalPinToPort_DEBUG(p) digitalPinToPort(p) + bool GET_PINMODE(int8_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); } + #define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin) +#endif + +#define VALID_PIN(pin)) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0) +#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0)) +#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && ((P) <= analogInputToDigitalPin(15) || (P) <= analogInputToDigitalPin(7))) +#define GET_ARRAY_PIN(p) pgm_read_byte(&pin_array[p].pin) + +void PRINT_ARRAY_NAME(uint8_t x) { + char *name_mem_pointer = (char*)pgm_read_word(&pin_array[x].name); + for (uint8_t y = 0; y < MAX_NAME_LENGTH; y++) { + char temp_char = pgm_read_byte(name_mem_pointer + y); + if (temp_char != 0) + MYSERIAL.write(temp_char); + else { + for (uint8_t i = 0; i < MAX_NAME_LENGTH - y; i++) MYSERIAL.write(' '); + break; + } + } +} + +#define GET_ARRAY_IS_DIGITAL(x) pgm_read_byte(&pin_array[x].is_digital) + + +#if defined(__AVR_ATmega1284P__) // 1284 IDE extensions set this to the number of + #undef NUM_DIGITAL_PINS // digital only pins while all other CPUs have it + #define NUM_DIGITAL_PINS 32 // set to digital only + digital/analog +#endif + +#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), V); SERIAL_ECHO(buffer); }while(0) +#define PWM_CASE(N,Z) \ + case TIMER##N##Z: \ + if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \ + PWM_PRINT(OCR##N##Z); \ + return true; \ + } else return false + + + +/** + * Print a pin's PWM status. + * Return true if it's currently a PWM pin. + */ +static bool pwm_status(uint8_t pin) { + char buffer[20]; // for the sprintf statements + + switch (digitalPinToTimer_DEBUG(pin)) { + + #if defined(TCCR0A) && defined(COM0A1) + #ifdef TIMER0A + #if !AVR_AT90USB1286_FAMILY // not available in Teensyduino type IDEs + PWM_CASE(0, A); + #endif + #endif + PWM_CASE(0, B); + #endif + + #if defined(TCCR1A) && defined(COM1A1) + PWM_CASE(1, A); + PWM_CASE(1, B); + #if defined(COM1C1) && defined(TIMER1C) + PWM_CASE(1, C); + #endif + #endif + + #if defined(TCCR2A) && defined(COM2A1) + PWM_CASE(2, A); + PWM_CASE(2, B); + #endif + + #if defined(TCCR3A) && defined(COM3A1) + PWM_CASE(3, A); + PWM_CASE(3, B); + #ifdef COM3C1 + PWM_CASE(3, C); + #endif + #endif + + #ifdef TCCR4A + PWM_CASE(4, A); + PWM_CASE(4, B); + PWM_CASE(4, C); + #endif + + #if defined(TCCR5A) && defined(COM5A1) + PWM_CASE(5, A); + PWM_CASE(5, B); + PWM_CASE(5, C); + #endif + + case NOT_ON_TIMER: + default: + return false; + } + SERIAL_PROTOCOL_SP(2); +} // pwm_status + + +const volatile uint8_t* const PWM_other[][3] PROGMEM = { + { &TCCR0A, &TCCR0B, &TIMSK0 }, + { &TCCR1A, &TCCR1B, &TIMSK1 }, + #if defined(TCCR2A) && defined(COM2A1) + { &TCCR2A, &TCCR2B, &TIMSK2 }, + #endif + #if defined(TCCR3A) && defined(COM3A1) + { &TCCR3A, &TCCR3B, &TIMSK3 }, + #endif + #ifdef TCCR4A + { &TCCR4A, &TCCR4B, &TIMSK4 }, + #endif + #if defined(TCCR5A) && defined(COM5A1) + { &TCCR5A, &TCCR5B, &TIMSK5 }, + #endif +}; + + +const volatile uint8_t* const PWM_OCR[][3] PROGMEM = { + + #ifdef TIMER0A + { &OCR0A, &OCR0B, 0 }, + #else + { 0, &OCR0B, 0 }, + #endif + + #if defined(COM1C1) && defined(TIMER1C) + { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, (const uint8_t*)&OCR1C }, + #else + { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, 0 }, + #endif + + #if defined(TCCR2A) && defined(COM2A1) + { &OCR2A, &OCR2B, 0 }, + #endif + + #if defined(TCCR3A) && defined(COM3A1) + #ifdef COM3C1 + { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, (const uint8_t*)&OCR3C }, + #else + { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, 0 }, + #endif + #endif + + #ifdef TCCR4A + { (const uint8_t*)&OCR4A, (const uint8_t*)&OCR4B, (const uint8_t*)&OCR4C }, + #endif + + #if defined(TCCR5A) && defined(COM5A1) + { (const uint8_t*)&OCR5A, (const uint8_t*)&OCR5B, (const uint8_t*)&OCR5C }, + #endif +}; + + +#define TCCR_A(T) pgm_read_word(&PWM_other[T][0]) +#define TCCR_B(T) pgm_read_word(&PWM_other[T][1]) +#define TIMSK(T) pgm_read_word(&PWM_other[T][2]) +#define CS_0 0 +#define CS_1 1 +#define CS_2 2 +#define WGM_0 0 +#define WGM_1 1 +#define WGM_2 3 +#define WGM_3 4 +#define TOIE 0 + +#define OCR_VAL(T, L) pgm_read_word(&PWM_OCR[T][L]) + +static void err_is_counter() { SERIAL_PROTOCOLPGM(" non-standard PWM mode"); } +static void err_is_interrupt() { SERIAL_PROTOCOLPGM(" compare interrupt enabled"); } +static void err_prob_interrupt() { SERIAL_PROTOCOLPGM(" overflow interrupt enabled"); } +static void print_is_also_tied() { SERIAL_PROTOCOLPGM(" is also tied to this pin"); SERIAL_PROTOCOL_SP(14); } + +void com_print(uint8_t N, uint8_t Z) { + const uint8_t *TCCRA = (uint8_t*)TCCR_A(N); + SERIAL_PROTOCOLPGM(" COM"); + SERIAL_PROTOCOLCHAR(N + '0'); + switch (Z) { + case 'A': + SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6)); + break; + case 'B': + SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4)); + break; + case 'C': + SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2)); + break; + } +} + +void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout + char buffer[20]; // for the sprintf statements + const uint8_t *TCCRB = (uint8_t*)TCCR_B(T), + *TCCRA = (uint8_t*)TCCR_A(T); + uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1)))); + if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1); + + SERIAL_PROTOCOLPGM(" TIMER"); + SERIAL_PROTOCOLCHAR(T + '0'); + SERIAL_PROTOCOLCHAR(L); + SERIAL_PROTOCOL_SP(3); + + if (N == 3) { + const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A'); + PWM_PRINT(*OCRVAL8); + } + else { + const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A'); + PWM_PRINT(*OCRVAL16); + } + SERIAL_PROTOCOLPAIR(" WGM: ", WGM); + com_print(T,L); + SERIAL_PROTOCOLPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) )); + + SERIAL_PROTOCOLPGM(" TCCR"); + SERIAL_PROTOCOLCHAR(T + '0'); + SERIAL_PROTOCOLPAIR("A: ", *TCCRA); + + SERIAL_PROTOCOLPGM(" TCCR"); + SERIAL_PROTOCOLCHAR(T + '0'); + SERIAL_PROTOCOLPAIR("B: ", *TCCRB); + + const uint8_t *TMSK = (uint8_t*)TIMSK(T); + SERIAL_PROTOCOLPGM(" TIMSK"); + SERIAL_PROTOCOLCHAR(T + '0'); + SERIAL_PROTOCOLPAIR(": ", *TMSK); + + const uint8_t OCIE = L - 'A' + 1; + if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); } + else { if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter(); } + if (TEST(*TMSK, OCIE)) err_is_interrupt(); + if (TEST(*TMSK, TOIE)) err_prob_interrupt(); +} + +static void pwm_details(uint8_t pin) { + switch (digitalPinToTimer_DEBUG(pin)) { + + #if defined(TCCR0A) && defined(COM0A1) + #ifdef TIMER0A + #if !AVR_AT90USB1286_FAMILY // not available in Teensyduino type IDEs + case TIMER0A: timer_prefix(0, 'A', 3); break; + #endif + #endif + case TIMER0B: timer_prefix(0, 'B', 3); break; + #endif + + #if defined(TCCR1A) && defined(COM1A1) + case TIMER1A: timer_prefix(1, 'A', 4); break; + case TIMER1B: timer_prefix(1, 'B', 4); break; + #if defined(COM1C1) && defined(TIMER1C) + case TIMER1C: timer_prefix(1, 'C', 4); break; + #endif + #endif + + #if defined(TCCR2A) && defined(COM2A1) + case TIMER2A: timer_prefix(2, 'A', 3); break; + case TIMER2B: timer_prefix(2, 'B', 3); break; + #endif + + #if defined(TCCR3A) && defined(COM3A1) + case TIMER3A: timer_prefix(3, 'A', 4); break; + case TIMER3B: timer_prefix(3, 'B', 4); break; + #ifdef COM3C1 + case TIMER3C: timer_prefix(3, 'C', 4); break; + #endif + #endif + + #ifdef TCCR4A + case TIMER4A: timer_prefix(4, 'A', 4); break; + case TIMER4B: timer_prefix(4, 'B', 4); break; + case TIMER4C: timer_prefix(4, 'C', 4); break; + #endif + + #if defined(TCCR5A) && defined(COM5A1) + case TIMER5A: timer_prefix(5, 'A', 4); break; + case TIMER5B: timer_prefix(5, 'B', 4); break; + case TIMER5C: timer_prefix(5, 'C', 4); break; + #endif + + case NOT_ON_TIMER: break; + + } + SERIAL_PROTOCOLPGM(" "); + + // on pins that have two PWMs, print info on second PWM + #if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY + // looking for port B7 - PWMs 0A and 1C + if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask_DEBUG(pin)) { + #if !AVR_AT90USB1286_FAMILY + SERIAL_PROTOCOLPGM("\n ."); + SERIAL_PROTOCOL_SP(18); + SERIAL_PROTOCOLPGM("TIMER1C"); + print_is_also_tied(); + timer_prefix(1, 'C', 4); + #else + SERIAL_PROTOCOLPGM("\n ."); + SERIAL_PROTOCOL_SP(18); + SERIAL_PROTOCOLPGM("TIMER0A"); + print_is_also_tied(); + timer_prefix(0, 'A', 3); + #endif + } + #endif +} // pwm_details + + +#ifndef digitalRead_mod // Use Teensyduino's version of digitalRead - it doesn't disable the PWMs + int digitalRead_mod(const int8_t pin) { // same as digitalRead except the PWM stop section has been removed + const uint8_t port = digitalPinToPort_DEBUG(pin); + return (port != NOT_A_PIN) && (*portInputRegister(port) & digitalPinToBitMask_DEBUG(pin)) ? HIGH : LOW; + } +#endif + +#ifndef PRINT_PORT(p) + void print_port(int8_t pin) { // print port number + #ifdef digitalPinToPort_DEBUG + uint8_t x; + SERIAL_PROTOCOLPGM(" Port: "); + #if AVR_AT90USB1286_FAMILY + x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; + #else + x = digitalPinToPort_DEBUG(pin) + 64; + #endif + SERIAL_CHAR(x); + + #if AVR_AT90USB1286_FAMILY + if (pin == 46) + x = '2'; + else if (pin == 47) + x = '3'; + else { + uint8_t temp = digitalPinToBitMask_DEBUG(pin); + for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; + } + #else + uint8_t temp = digitalPinToBitMask_DEBUG(pin); + for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1; + #endif + SERIAL_CHAR(x); + #else + SERIAL_PROTOCOL_SP(10); + #endif + } + + #define PRINT_PORT(p) print_port(p) +#endif diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h index 797a2cd71..187c190f6 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h @@ -25,16 +25,21 @@ // do not function the same as the other Arduino extensions // -#ifndef __PINSDEBUG_TEENSYDUINO_H__ -#define __PINSDEBUG_TEENSYDUINO_H__ -#undef NUM_DIGITAL_PINS -#define NUM_DIGITAL_PINS 48 // Teensy says 46 but FASTIO is 48 +#define TEENSYDUINO_IDE -// "digitalPinToPort" function just returns the pin number so need to create our own. -// Can't use the name "digitalPinToPort" for our own because it interferes with the -// FAST_PWM_FAN function if we do +//digitalPinToTimer(pin) function works like Arduino but Timers are not defined +#define TIMER0B 1 +#define TIMER1A 7 +#define TIMER1B 8 +#define TIMER1C 9 +#define TIMER2A 6 +#define TIMER2B 2 +#define TIMER3A 5 +#define TIMER3B 4 +#define TIMER3C 3 +// digitalPinToPort function just returns the pin number so need to create our own #define PA 1 #define PB 2 #define PC 3 @@ -42,8 +47,9 @@ #define PE 5 #define PF 6 +#undef digitalPinToPort -const uint8_t PROGMEM digital_pin_to_port_PGM_Teensy[] = { +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PD, // 0 - PD0 - INT0 - PWM PD, // 1 - PD1 - INT1 - PWM PD, // 2 - PD2 - INT2 - RX @@ -94,7 +100,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_Teensy[] = { PE, // 47 - PE3 (not defined in teensyduino) }; -#define digitalPinToPort_Teensy(P) ( pgm_read_byte( digital_pin_to_port_PGM_Teensy + (P) ) ) +#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) // digitalPinToBitMask(pin) is OK @@ -102,5 +108,3 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_Teensy[] = { // disable the PWMs so we can use it as is // portModeRegister(pin) is OK - -#endif // __PINSDEBUG_TEENSYDUINO_H__ diff --git a/Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h b/Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h new file mode 100644 index 000000000..f3905d940 --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/SanityCheck_Due.h @@ -0,0 +1,29 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 . + * + */ + +/** + * Test Arduino Due specific configuration values for errors at compile-time. + */ + +/** + * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. + */ diff --git a/Marlin/src/HAL/HAL_LPC1768/SanityCheck_Re_ARM.h b/Marlin/src/HAL/HAL_LPC1768/SanityCheck_Re_ARM.h new file mode 100644 index 000000000..cce367d20 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/SanityCheck_Re_ARM.h @@ -0,0 +1,71 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 . + * + */ + +/** + * Test Re-ARM specific configuration values for errors at compile-time. + */ + +/** + * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. + */ + +#if ENABLED(SPINDLE_LASER_ENABLE) + #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) + #error "SPINDLE_DIR_PIN not defined." + #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) + #if !PWM_PIN(SPINDLE_LASER_PWM_PIN) + #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." + #elif !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) + #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" + #elif SPINDLE_LASER_POWERUP_DELAY < 1 + #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." + #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 + #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." + #elif !defined(SPINDLE_LASER_PWM_INVERT) + #error "SPINDLE_LASER_PWM_INVERT missing." + #elif !defined(SPEED_POWER_SLOPE) || !defined(SPEED_POWER_INTERCEPT) || !defined(SPEED_POWER_MIN) || !defined(SPEED_POWER_MAX) + #error "SPINDLE_LASER_PWM equation constant(s) missing." + #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT_PIN." + #elif PIN_EXISTS(E0_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E0_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E0_AUTO_FAN_PIN." + #elif PIN_EXISTS(E1_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E1_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E1_AUTO_FAN_PIN." + #elif PIN_EXISTS(E2_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E2_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E2_AUTO_FAN_PIN." + #elif PIN_EXISTS(E3_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E3_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E3_AUTO_FAN_PIN." + #elif PIN_EXISTS(E4_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E4_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E4_AUTO_FAN_PIN." + #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." + #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." + #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." + #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." + #endif + #endif +#endif // SPINDLE_LASER_ENABLE \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp index 9d1632ca7..0d32ea193 100644 --- a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp @@ -22,8 +22,8 @@ #ifdef TARGET_LPC1768 #include -#include "../../../macros.h" #include "HAL.h" +#include "../../macros.h" // Interrupts void cli(void) { __disable_irq(); } // Disable diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h b/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h index 52ebad924..65c57ada4 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h @@ -63,7 +63,6 @@ const adc_pin_data adc_pin_map[] = { #define VALID_PIN(r) (r < 0 ? 0 :\ r == 7 ? 0 :\ r == 17 ? 0 :\ - r == 17 ? 0 :\ r == 22 ? 0 :\ r == 23 ? 0 :\ r == 25 ? 0 :\ @@ -82,6 +81,20 @@ const adc_pin_data adc_pin_map[] = { r == 66 ? 0 :\ r >= NUM_DIGITAL_PINS ? 0 : 1) +#define PWM_PIN(r) (r < 0 ? 0 :\ + r == 3 ? 1 :\ + r == 4 ? 1 :\ + r == 6 ? 1 :\ + r == 9 ? 1 :\ + r == 10 ? 1 :\ + r == 11 ? 1 :\ + r == 14 ? 1 :\ + r == 26 ? 1 :\ + r == 46 ? 1 :\ + r == 53 ? 1 :\ + r == 54 ? 1 :\ + r == 60 ? 1 : 0) + const pin_data pin_map[] = { // pin map for variable pin function {0,3}, // DIO0 RXD0 A6 J4-4 AUX-1 {0,2}, // DIO1 TXD0 A7 J4-5 AUX-1 diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h index 9df354daa..d3fd53f77 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h @@ -27,7 +27,7 @@ struct pin_data { uint8_t port, pin; }; struct adc_pin_data { uint8_t port, pin, adc; }; -#if ENABLED(IS_REARM) +#if defined(IS_REARM) #include "pinmap_re_arm.h" #else #error "HAL: LPC1768: No defined pin-mapping" diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h index 560fba607..a919d80aa 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h @@ -1,5 +1,5 @@ /** - * Marlin 3D Printer Firmware + * Marlin 3D Printer Firmware * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. @@ -19,68 +19,60 @@ * along with this program. If not, see . * */ - + /** * Support routines for Re-ARM board - */ - +*/ - -typedef struct { - int8_t pin; - bool output; - bool analog; - uint8_t resistors; - bool open_drain; - char function_string[15]; -} pin_info; +bool pin_Re_ARM_output; +bool pin_Re_ARM_analog; +int8_t pin_Re_ARM_pin; -pin_info pin_Re_ARM; - void get_pin_info(int8_t pin) { - pin_Re_ARM.analog = 0; - pin_Re_ARM.pin = pin; + +if (pin == 7) return; + pin_Re_ARM_analog = 0; + pin_Re_ARM_pin = pin; int8_t pin_port = pin_map[pin].port; int8_t pin_port_pin = pin_map[pin].pin; - // active ADC function/mode/code values for PINSEL registers int8_t ADC_pin_mode = pin_port == 0 && pin_port_pin == 2 ? 2 : pin_port == 0 && pin_port_pin == 3 ? 2 : - pin_port == 0 && pin_port_pin == 23 ? 1 : + pin_port == 0 && pin_port_pin == 23 ? 1 : pin_port == 0 && pin_port_pin == 24 ? 1 : pin_port == 0 && pin_port_pin == 25 ? 1 : pin_port == 0 && pin_port_pin == 26 ? 1 : pin_port == 1 && pin_port_pin == 30 ? 3 : - pin_port == 1 && pin_port_pin == 31 ? 3 : -1; - //get appropriate PINSEL register + pin_port == 1 && pin_port_pin == 31 ? 3 : -1; + //get appropriate PINSEL register volatile uint32_t * pinsel_reg = (pin_port == 0 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL0 : (pin_port == 0) ? &LPC_PINCON->PINSEL1 : (pin_port == 1 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL2 : pin_port == 1 ? &LPC_PINCON->PINSEL3 : pin_port == 2 ? &LPC_PINCON->PINSEL4 : - pin_port == 3 ? &LPC_PINCON->PINSEL7 : &LPC_PINCON->PINSEL9; - + pin_port == 3 ? &LPC_PINCON->PINSEL7 : &LPC_PINCON->PINSEL9; uint8_t pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin; uint8_t pin_mode = (uint8_t) ((*pinsel_reg >> pinsel_start_bit) & 0x3); - uint32_t * FIO_reg[5] PROGMEM = {(uint32_t*) 0x2009C000,(uint32_t*) 0x2009C020,(uint32_t*) 0x2009C040,(uint32_t*) 0x2009C060,(uint32_t*) 0x2009C080}; - pin_Re_ARM.output = (*FIO_reg[pin_map[pin].port] >> pin_map[pin].pin) & 1; //input/output state except if active ADC + pin_Re_ARM_output = (*FIO_reg[pin_map[pin].port] >> pin_map[pin].pin) & 1; //input/output state except if active ADC if (pin_mode) { // if function/mode/code value not 0 then could be an active analog channel if (ADC_pin_mode == pin_mode) { // found an active analog pin - pin_Re_ARM.output = 0; - pin_Re_ARM.analog = 1; - } + pin_Re_ARM_output = 0; + pin_Re_ARM_analog = 1; + } } } /** * translation of routines & variables used by pinsDebug.h */ - + +#define pwm_details(pin) pin = pin // do nothing // print PWM details +#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. #define GET_PIN_INFO(pin) get_pin_info(pin) #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) -#define GET_PINMODE(pin) pin_Re_ARM.output +#define GET_PINMODE(pin) pin_Re_ARM_output #define digitalRead_mod(p) digitalRead(p) #define digitalPinToPort_DEBUG(p) 0 #define digitalPinToBitMask_DEBUG(pin) 0 @@ -89,4 +81,4 @@ void get_pin_info(int8_t pin) { #define NAME_FORMAT(p) PSTR("%-##p##s") // #define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, NAME_FORMAT(MAX_NAME_LENGTH) , pin_array[x].name); SERIAL_ECHO(buffer);} while (0) #define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, PSTR("%-35s") , pin_array[x].name); SERIAL_ECHO(buffer);} while (0) -#define GET_ARRAY_IS_DIGITAL(x) !pin_Re_ARM.analog \ No newline at end of file +#define GET_ARRAY_IS_DIGITAL(x) !pin_Re_ARM_analog \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_SanityCheck.h b/Marlin/src/HAL/HAL_SanityCheck.h new file mode 100644 index 000000000..26a3e8848 --- /dev/null +++ b/Marlin/src/HAL/HAL_SanityCheck.h @@ -0,0 +1,37 @@ +/** + * 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 . + * + */ + +#ifndef HAL_SANITYCHECK_H + +#ifdef ARDUINO_ARCH_AVR + #include "HAL_AVR/SanityCheck_AVR_8_bit.h" +#elif defined(ARDUINO_ARCH_SAM) + #include "HAL_DUE/SanityCheck_Due.h" +#elif IS_32BIT_TEENSY + #include "HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h" +#elif defined(TARGET_LPC1768) + #include "HAL_LPC1768/SanityCheck_Re_ARM.h" +#else + #error Unsupported Platform! +#endif + +#endif diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h new file mode 100644 index 000000000..b4791bdb8 --- /dev/null +++ b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck_Teensy_35_36.h @@ -0,0 +1,29 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 2017 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 . + * + */ + +/** + * Test TEENSY35_36 specific configuration values for errors at compile-time. + */ + +/** + * Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features. + */ diff --git a/Marlin/src/HAL/HAL_pinsDebug.h b/Marlin/src/HAL/HAL_pinsDebug.h index fc3ef95fa..de802d48c 100644 --- a/Marlin/src/HAL/HAL_pinsDebug.h +++ b/Marlin/src/HAL/HAL_pinsDebug.h @@ -22,16 +22,18 @@ #ifndef HAL_PINSDEBUG_H -#ifdef ARDUINO_ARCH_AVR - #include "HAL_AVR/HAL_pinsDebug_AVR.h" -#elif defined(ARDUINO_ARCH_SAM) - #include "HAL_DUE/HAL_pinsDebug_Due.h" -#elif IS_32BIT_TEENSY - #include "HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h" -#elif defined(TARGET_LPC1768) - #include "HAL_LPC1768/HAL_pinsDebug.h" -#else - #error Unsupported Platform! -#endif +#if defined(PINS_DEBUGGING) + #ifdef ARDUINO_ARCH_AVR + #include "HAL_AVR/pinsDebug_AVR_8_bit.h" + #elif defined(ARDUINO_ARCH_SAM) + #include "HAL_DUE/HAL_pinsDebug_Due.h" + #elif IS_32BIT_TEENSY + #include "HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h" + #elif defined(TARGET_LPC1768) + #include "HAL_LPC1768/pinsDebug_Re_ARM.h" + #else + #error Unsupported Platform! + #endif +#endif #endif