Skip to content

Commit

Permalink
Better pinsDebug_list.h warning suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 3, 2020
1 parent 543760c commit eadb511
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 399 deletions.
10 changes: 6 additions & 4 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@
#define EITHER(V1,V2) ANY(V1,V2)

// Macros to support pins/buttons exist testing
#define _PINEX_1(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define PIN_EXISTS(V...) DO(PINEX,&&,V)
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define _PINEX_1 PIN_EXISTS
#define PINS_EXIST(V...) DO(PINEX,&&,V)
#define ANY_PIN(V...) DO(PINEX,||,V)

#define _BTNEX_1(BN) (defined(BTN_##BN) && BTN_##BN >= 0)
#define BUTTON_EXISTS(V...) DO(BTNEX,&&,V)
#define BUTTON_EXISTS(BN) (defined(BTN_##BN) && BTN_##BN >= 0)
#define _BTNEX_1 BUTTON_EXISTS
#define BUTTONS_EXIST(V...) DO(BTNEX,&&,V)
#define ANY_BUTTON(V...) DO(BTNEX,||,V)

#define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H))
Expand Down
28 changes: 14 additions & 14 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#elif TOOLCHANGE_ZRAISE < 0
#error "TOOLCHANGE_ZRAISE must be 0 or higher."
#elif ENABLED(PARKING_EXTRUDER)
#if !PIN_EXISTS(SOL0, SOL1)
#if !PINS_EXIST(SOL0, SOL1)
#error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN."
#elif !defined(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE, LOW, HIGH)
#error "PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE must be defined as HIGH or LOW."
Expand Down Expand Up @@ -1513,9 +1513,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "HEATER_0_PIN not defined for this board."
#elif !ANY_PIN(TEMP_0, MAX6675_SS)
#error "TEMP_0_PIN not defined for this board."
#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PIN_EXISTS(E0_STEP, E0_DIR))
#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#elif EXTRUDERS && TEMP_SENSOR_0 == 0
#error "TEMP_SENSOR_0 is required with any extruders."
Expand Down Expand Up @@ -1707,35 +1707,35 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
*/
#if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only
#if E_STEPPERS
#if !(PIN_EXISTS(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
#if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 1
#if !(PIN_EXISTS(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
#if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
#error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 2
#if !(PIN_EXISTS(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
#if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
#error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 3
#if !(PIN_EXISTS(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
#if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
#error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 4
#if !(PIN_EXISTS(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
#if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
#error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 5
#if !(PIN_EXISTS(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
#if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
#error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 6
#if !(PIN_EXISTS(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
#if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
#error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 7
#if !(PIN_EXISTS(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
#if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
#error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board."
#endif
#endif // E_STEPPERS > 7
Expand Down Expand Up @@ -1924,7 +1924,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* RGB_LED Requirements
*/
#define _RGB_TEST (PIN_EXISTS(RGB_LED_R, RGB_LED_G, RGB_LED_B))
#define _RGB_TEST (PINS_EXIST(RGB_LED_R, RGB_LED_G, RGB_LED_B))
#if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS
#error "PRINTER_EVENT_LEDS requires BLINKM, PCA9533, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED."
#elif ENABLED(RGB_LED)
Expand Down Expand Up @@ -2078,7 +2078,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* Check existing RX/TX pins against enable TMC UART drivers.
*/
#define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX, ST##_SERIAL_TX))))
#define INVALID_TMC_UART(ST) (AXIS_HAS_UART(ST) && !(defined(ST##_HARDWARE_SERIAL) || (PINS_EXIST(ST##_SERIAL_RX, ST##_SERIAL_TX))))
#if INVALID_TMC_UART(X)
#error "TMC2208 or TMC2209 on X requires X_HARDWARE_SERIAL or X_SERIAL_(RX|TX)_PIN."
#elif INVALID_TMC_UART(X2)
Expand Down Expand Up @@ -2440,7 +2440,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration."
#endif

#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PIN_EXISTS(USB_CS, USB_INTR)
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PINS_EXIST(USB_CS, USB_INTR)
#error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT."
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTON_EXISTS(EN1, EN2))
#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2))
#define HAS_DIGITAL_BUTTONS (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT))
#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL))))

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
);
#endif

#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO))
#define MAX6675_SEPARATE_SPI (EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PINS_EXIST(MAX6675_SCK, MAX6675_DO))

#if MAX6675_SEPARATE_SPI
#include "../libs/private_spi.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const PinInfo pin_array[] PROGMEM = {
#endif

#include "pinsDebug_list.h"
#line 98
#line 172

};

Expand Down
Loading

0 comments on commit eadb511

Please sign in to comment.