Skip to content

Commit c995a1d

Browse files
thinkyheadEvilGremlin
authored andcommitted
🎨 Rename FAN_PIN to FAN0_PIN (MarlinFirmware#25568)
1 parent 241d794 commit c995a1d

File tree

226 files changed

+380
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+380
-466
lines changed

Marlin/src/HAL/AVR/fastio.h

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -255,84 +255,6 @@ enum ClockSource2 : uint8_t {
255255
#define SET_FOCB(T,V) SET_FOC(T,B,V)
256256
#define SET_FOCC(T,V) SET_FOC(T,C,V)
257257

258-
#if 0
259-
260-
/**
261-
* PWM availability macros
262-
*/
263-
264-
// Determine which hardware PWMs are already in use
265-
#define _PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == E6_AUTO_FAN_PIN || P == E7_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN || P == COOLER_AUTO_FAN_PIN)
266-
#if PIN_EXISTS(CONTROLLER_FAN)
267-
#define PWM_CHK_FAN_B(P) (_PWM_CHK_FAN_B(P) || P == CONTROLLER_FAN_PIN)
268-
#else
269-
#define PWM_CHK_FAN_B(P) _PWM_CHK_FAN_B(P)
270-
#endif
271-
272-
#if ANY_PIN(FAN, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7)
273-
#if PIN_EXISTS(FAN7)
274-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN || P == FAN7_PIN)
275-
#elif PIN_EXISTS(FAN6)
276-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN || P == FAN6_PIN)
277-
#elif PIN_EXISTS(FAN5)
278-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN || P == FAN5_PIN)
279-
#elif PIN_EXISTS(FAN4)
280-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN || P == FAN4_PIN)
281-
#elif PIN_EXISTS(FAN3)
282-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN || P == FAN3_PIN)
283-
#elif PIN_EXISTS(FAN2)
284-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN || P == FAN2_PIN)
285-
#elif PIN_EXISTS(FAN1)
286-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN || P == FAN1_PIN)
287-
#else
288-
#define PWM_CHK_FAN_A(P) (P == FAN0_PIN)
289-
#endif
290-
#else
291-
#define PWM_CHK_FAN_A(P) false
292-
#endif
293-
294-
#if HAS_MOTOR_CURRENT_PWM
295-
#if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
296-
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN || P == MOTOR_CURRENT_PWM_XY_PIN)
297-
#elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
298-
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN)
299-
#else
300-
#define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN)
301-
#endif
302-
#else
303-
#define PWM_CHK_MOTOR_CURRENT(P) false
304-
#endif
305-
306-
#ifdef NUM_SERVOS
307-
#if AVR_ATmega2560_FAMILY
308-
#define PWM_CHK_SERVO(P) (P == 5 || (NUM_SERVOS > 12 && P == 6) || (NUM_SERVOS > 24 && P == 46)) // PWMS 3A, 4A & 5A
309-
#elif AVR_ATmega2561_FAMILY
310-
#define PWM_CHK_SERVO(P) (P == 5) // PWM3A
311-
#elif AVR_ATmega1284_FAMILY
312-
#define PWM_CHK_SERVO(P) false
313-
#elif AVR_AT90USB1286_FAMILY
314-
#define PWM_CHK_SERVO(P) (P == 16) // PWM3A
315-
#elif AVR_ATmega328_FAMILY
316-
#define PWM_CHK_SERVO(P) false
317-
#endif
318-
#else
319-
#define PWM_CHK_SERVO(P) false
320-
#endif
321-
322-
#if ENABLED(BARICUDA)
323-
#if HAS_HEATER_1 && HAS_HEATER_2
324-
#define PWM_CHK_HEATER(P) (P == HEATER_1_PIN || P == HEATER_2_PIN)
325-
#elif HAS_HEATER_1
326-
#define PWM_CHK_HEATER(P) (P == HEATER_1_PIN)
327-
#endif
328-
#else
329-
#define PWM_CHK_HEATER(P) false
330-
#endif
331-
332-
#define PWM_CHK(P) (PWM_CHK_HEATER(P) || PWM_CHK_SERVO(P) || PWM_CHK_MOTOR_CURRENT(P) || PWM_CHK_FAN_A(P) || PWM_CHK_FAN_B(P))
333-
334-
#endif // PWM_CHK is not used in Marlin
335-
336258
// define which hardware PWMs are available for the current CPU
337259
// all timer 1 PWMS deleted from this list because they are never available
338260
#if AVR_ATmega2560_FAMILY

Marlin/src/HAL/AVR/inc/SanityCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
/**
7070
* Checks for SOFT PWM
7171
*/
72-
#if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
73-
#error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
72+
#if HAS_FAN0 && FAN0_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
73+
#error "FAN0_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
7474
#error "Disable SPEAKER or enable FAN_SOFT_PWM."
7575
#endif
7676

Marlin/src/HAL/STM32/inc/SanityCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
* Check for common serial pin conflicts
5656
*/
5757
#define _CHECK_SERIAL_PIN(N) (( \
58-
BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN_PIN == N || \
58+
BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN0_PIN == N || \
5959
SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \
6060
))
6161
#define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN)

Marlin/src/HAL/STM32F1/timers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ typedef uint16_t hal_timer_t;
8181
#endif
8282

8383
#if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE, MKS_ROBIN_E3D, MKS_ROBIN_E3)
84-
// SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM.
84+
// SKR Mini E3 boards use PA8 as FAN0_PIN, so TIMER 1 is used for Fan PWM.
8585
#ifdef STM32_HIGH_DENSITY
8686
#define MF_TIMER_SERVO0 8 // tone.cpp uses Timer 4
8787
#else

Marlin/src/inc/Conditionals_post.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,16 +2631,12 @@
26312631
#define _NOT_E_AUTO(N,F) (E##N##_AUTO_FAN_PIN != FAN##F##_PIN)
26322632
#define _HAS_FAN(F) (PIN_EXISTS(FAN##F) \
26332633
&& CONTROLLER_FAN_PIN != FAN##F##_PIN \
2634-
&& _NOT_E_AUTO(0,F) \
2635-
&& _NOT_E_AUTO(1,F) \
2636-
&& _NOT_E_AUTO(2,F) \
2637-
&& _NOT_E_AUTO(3,F) \
2638-
&& _NOT_E_AUTO(4,F) \
2639-
&& _NOT_E_AUTO(5,F) \
2640-
&& _NOT_E_AUTO(6,F) \
2641-
&& _NOT_E_AUTO(7,F) \
2634+
&& _NOT_E_AUTO(0,F) && _NOT_E_AUTO(1,F) \
2635+
&& _NOT_E_AUTO(2,F) && _NOT_E_AUTO(3,F) \
2636+
&& _NOT_E_AUTO(4,F) && _NOT_E_AUTO(5,F) \
2637+
&& _NOT_E_AUTO(6,F) && _NOT_E_AUTO(7,F) \
26422638
&& F < MAX_FANS)
2643-
#if PIN_EXISTS(FAN)
2639+
#if _HAS_FAN(0)
26442640
#define HAS_FAN0 1
26452641
#endif
26462642
#if _HAS_FAN(1)

Marlin/src/inc/SanityCheck.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@
682682
#error "PROBE_PT_[123]_[XY] is now defined using PROBE_PT_[123] with an array { x, y }."
683683
#elif defined(SQUARE_WAVE_STEPPING)
684684
#error "SQUARE_WAVE_STEPPING is now EDGE_STEPPING."
685+
#elif defined(FAN_PIN)
686+
#error "FAN_PIN is now FAN0_PIN."
685687
#endif
686688

687689
// L64xx stepper drivers have been removed
@@ -2371,21 +2373,21 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
23712373
*/
23722374
#if HAS_AUTO_FAN
23732375
#if HAS_FAN0
2374-
#if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN_PIN
2375-
#error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN."
2376-
#elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN_PIN
2377-
#error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN."
2378-
#elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN_PIN
2379-
#error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN."
2380-
#elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN_PIN
2381-
#error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN."
2376+
#if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN0_PIN
2377+
#error "You cannot set E0_AUTO_FAN_PIN equal to FAN0_PIN."
2378+
#elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN0_PIN
2379+
#error "You cannot set E1_AUTO_FAN_PIN equal to FAN0_PIN."
2380+
#elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN0_PIN
2381+
#error "You cannot set E2_AUTO_FAN_PIN equal to FAN0_PIN."
2382+
#elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN0_PIN
2383+
#error "You cannot set E3_AUTO_FAN_PIN equal to FAN0_PIN."
23822384
#endif
23832385
#endif
23842386
#endif
23852387

23862388
#if HAS_FAN0
2387-
#if CONTROLLER_FAN_PIN == FAN_PIN
2388-
#error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
2389+
#if CONTROLLER_FAN_PIN == FAN0_PIN
2390+
#error "You cannot set CONTROLLER_FAN_PIN equal to FAN0_PIN."
23892391
#elif ENABLED(FAN_SOFT_PWM_REQUIRED) && DISABLED(FAN_SOFT_PWM)
23902392
#error "FAN_SOFT_PWM is required for your board. Enable it to continue."
23912393
#endif
@@ -2427,8 +2429,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
24272429
#if NEED_CASE_LIGHT_PIN
24282430
#if !PIN_EXISTS(CASE_LIGHT)
24292431
#error "CASE_LIGHT_ENABLE requires CASE_LIGHT_PIN, CASE_LIGHT_USE_NEOPIXEL, or CASE_LIGHT_USE_RGB_LED."
2430-
#elif CASE_LIGHT_PIN == FAN_PIN
2431-
#error "CASE_LIGHT_PIN conflicts with FAN_PIN. Resolve before continuing."
2432+
#elif CASE_LIGHT_PIN == FAN0_PIN
2433+
#error "CASE_LIGHT_PIN conflicts with FAN0_PIN. Resolve before continuing."
24322434
#endif
24332435
#endif
24342436

@@ -4191,11 +4193,11 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
41914193
#elif !(defined(SPEED_POWER_MIN) && defined(SPEED_POWER_MAX) && defined(SPEED_POWER_STARTUP))
41924194
#error "SPINDLE_LASER_USE_PWM equation constant(s) missing."
41934195
#elif _PIN_CONFLICT(X_MIN)
4194-
#error "SPINDLE_LASER_USE_PWM pin conflicts with X_MIN_PIN."
4196+
#error "SPINDLE_LASER_PWM_PIN conflicts with X_MIN_PIN."
41954197
#elif _PIN_CONFLICT(X_MAX)
4196-
#error "SPINDLE_LASER_USE_PWM pin conflicts with X_MAX_PIN."
4198+
#error "SPINDLE_LASER_PWM_PIN conflicts with X_MAX_PIN."
41974199
#elif _PIN_CONFLICT(Z_STEP)
4198-
#error "SPINDLE_LASER_USE_PWM pin conflicts with Z_STEP_PIN."
4200+
#error "SPINDLE_LASER_PWM_PIN conflicts with Z_STEP_PIN."
41994201
#elif _PIN_CONFLICT(CASE_LIGHT)
42004202
#error "SPINDLE_LASER_PWM_PIN conflicts with CASE_LIGHT_PIN."
42014203
#elif _PIN_CONFLICT(E0_AUTO_FAN)
@@ -4215,7 +4217,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
42154217
#elif _PIN_CONFLICT(E7_AUTO_FAN)
42164218
#error "SPINDLE_LASER_PWM_PIN conflicts with E7_AUTO_FAN_PIN."
42174219
#elif _PIN_CONFLICT(FAN)
4218-
#error "SPINDLE_LASER_PWM_PIN conflicts with FAN_PIN."
4220+
#error "SPINDLE_LASER_PWM_PIN conflicts with FAN0_PIN."
42194221
#elif _PIN_CONFLICT(FAN1)
42204222
#error "SPINDLE_LASER_PWM_PIN conflicts with FAN1_PIN."
42214223
#elif _PIN_CONFLICT(FAN2)

Marlin/src/module/temperature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2677,7 +2677,7 @@ void Temperature::init() {
26772677
#endif
26782678

26792679
#if HAS_FAN0
2680-
INIT_FAN_PIN(FAN_PIN);
2680+
INIT_FAN_PIN(FAN0_PIN);
26812681
#endif
26822682
#if HAS_FAN1
26832683
INIT_FAN_PIN(FAN1_PIN);

Marlin/src/pins/esp32/pins_E4D.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
// Heaters / Fans
9191
//
9292
#define HEATER_0_PIN 2
93-
#define FAN_PIN 0
93+
#define FAN0_PIN 0
9494
#define HEATER_BED_PIN 15
9595

9696
//

Marlin/src/pins/esp32/pins_ENWI_ESPNP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101

102102
// General use mosfets, useful for things like pumps and solenoids
103103
// Shift register pins 128, 129, 130 and 131 are broken out and can be used
104-
#define FAN_PIN 132
104+
#define FAN0_PIN 132
105105
#define FAN1_PIN 134
106106
#define FAN2_PIN 135
107107
#define FAN3_PIN 136

Marlin/src/pins/esp32/pins_ESP32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
// Heaters / Fans
8080
//
8181
#define HEATER_0_PIN 2
82-
#define FAN_PIN 13
82+
#define FAN0_PIN 13
8383
#define HEATER_BED_PIN 4
8484

8585
// SPI

0 commit comments

Comments
 (0)