diff --git a/Marlin/MarlinSerial.cpp b/Marlin/MarlinSerial.cpp index 682c73048a..38e1b51cf6 100644 --- a/Marlin/MarlinSerial.cpp +++ b/Marlin/MarlinSerial.cpp @@ -89,7 +89,7 @@ FORCE_INLINE void store_char(unsigned char c) { } } - #if defined(M_USARTx_UDRE_vect) + #ifdef M_USARTx_UDRE_vect ISR(M_USARTx_UDRE_vect) { _tx_udr_empty_irq(); } @@ -97,7 +97,7 @@ FORCE_INLINE void store_char(unsigned char c) { #endif // TX_BUFFER_SIZE -#if defined(M_USARTx_RX_vect) +#ifdef M_USARTx_RX_vect ISR(M_USARTx_RX_vect) { unsigned char c = M_UDRx; store_char(c); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index dfa1a5dbcc..ab310817b5 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10212,35 +10212,35 @@ void prepare_move_to_destination() { void setPwmFrequency(uint8_t pin, int val) { val &= 0x07; switch (digitalPinToTimer(pin)) { - #if defined(TCCR0A) + #ifdef TCCR0A case TIMER0A: case TIMER0B: // TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02)); // TCCR0B |= val; break; #endif - #if defined(TCCR1A) + #ifdef TCCR1A case TIMER1A: case TIMER1B: // TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); // TCCR1B |= val; break; #endif - #if defined(TCCR2) + #ifdef TCCR2 case TIMER2: case TIMER2: TCCR2 &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); TCCR2 |= val; break; #endif - #if defined(TCCR2A) + #ifdef TCCR2A case TIMER2A: case TIMER2B: TCCR2B &= ~(_BV(CS20) | _BV(CS21) | _BV(CS22)); TCCR2B |= val; break; #endif - #if defined(TCCR3A) + #ifdef TCCR3A case TIMER3A: case TIMER3B: case TIMER3C: @@ -10248,7 +10248,7 @@ void prepare_move_to_destination() { TCCR3B |= val; break; #endif - #if defined(TCCR4A) + #ifdef TCCR4A case TIMER4A: case TIMER4B: case TIMER4C: @@ -10256,7 +10256,7 @@ void prepare_move_to_destination() { TCCR4B |= val; break; #endif - #if defined(TCCR5A) + #ifdef TCCR5A case TIMER5A: case TIMER5B: case TIMER5C: diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h index b4016437a8..e839480757 100644 --- a/Marlin/pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -700,7 +700,7 @@ static bool pwm_status(uint8_t pin) { #if defined(TCCR3A) && defined(COM3A1) PWM_CASE(3,A); PWM_CASE(3,B); - #if defined(COM3C1) + #ifdef COM3C1 PWM_CASE(3,C); #endif #endif @@ -829,14 +829,14 @@ static void pwm_details(uint8_t pin) { else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt(); else can_be_used(); break; - #if defined(COM3C1) + #ifdef COM3C1 case TIMER3C: - TIMER_PREFIX(3,C,3); - if (WGM_TEST2) err_is_counter(); - else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt(); - else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt(); - else can_be_used(); - break; + TIMER_PREFIX(3,C,3); + if (WGM_TEST2) err_is_counter(); + else if (TEST(TIMSK3, OCIE3C)) err_is_interrupt(); + else if (TIMSK3 & (_BV(TOIE3) | _BV(ICIE3))) err_prob_interrupt(); + else can_be_used(); + break; #endif #endif diff --git a/Marlin/pins_MELZI.h b/Marlin/pins_MELZI.h index 677f0cf360..7c99373f3a 100644 --- a/Marlin/pins_MELZI.h +++ b/Marlin/pins_MELZI.h @@ -26,7 +26,7 @@ #define BOARD_NAME "Melzi" -#if defined(__AVR_ATmega1284P__) +#ifdef __AVR_ATmega1284P__ #define LARGE_FLASH true #endif diff --git a/Marlin/pins_MELZI_MAKR3D.h b/Marlin/pins_MELZI_MAKR3D.h index 877f8cbd23..83deb884c5 100644 --- a/Marlin/pins_MELZI_MAKR3D.h +++ b/Marlin/pins_MELZI_MAKR3D.h @@ -26,7 +26,7 @@ #define BOARD_NAME "Melzi ATmega1284" -#if defined(__AVR_ATmega1284P__) +#ifdef __AVR_ATmega1284P__ #define LARGE_FLASH true #endif diff --git a/Marlin/pins_SANGUINOLOLU_12.h b/Marlin/pins_SANGUINOLOLU_12.h index f214d6f021..19c9e4939f 100644 --- a/Marlin/pins_SANGUINOLOLU_12.h +++ b/Marlin/pins_SANGUINOLOLU_12.h @@ -34,7 +34,7 @@ #define BOARD_NAME "Sanguinololu 1.2" -#if defined(__AVR_ATmega1284P__) +#ifdef __AVR_ATmega1284P__ #define LARGE_FLASH true #endif diff --git a/Marlin/pins_STB_11.h b/Marlin/pins_STB_11.h index 318dc39c0b..05fc40481d 100644 --- a/Marlin/pins_STB_11.h +++ b/Marlin/pins_STB_11.h @@ -26,7 +26,7 @@ #define BOARD_NAME "STB V1.1" -#if defined(__AVR_ATmega1284P__) +#ifdef __AVR_ATmega1284P__ #define LARGE_FLASH true #endif diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index c5d0fe4cb2..1e6cd7bd05 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -455,7 +455,7 @@ void Planner::check_axes_activity() { #if FAN_COUNT > 0 - #if defined(FAN_MIN_PWM) + #ifdef FAN_MIN_PWM #define CALC_FAN_SPEED(f) (tail_fan_speed[f] ? ( FAN_MIN_PWM + (tail_fan_speed[f] * (255 - FAN_MIN_PWM)) / 255 ) : 0) #else #define CALC_FAN_SPEED(f) tail_fan_speed[f] diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index 7ac7f86b85..5333373a9d 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -161,7 +161,7 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt #include #include #define LCD_CLASS LiquidCrystal_SR - #if defined(SR_STROBE_PIN) + #if PIN_EXISTS(SR_STROBE) LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN); #else LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);