Add support for printers with inverted fan pins (#13362)

Add support for printers with inverted fan pins by adding `#define FAN_INVERTING 1` to `Configuration_adv.h` and modifying the fan write macros.
This commit is contained in:
pinchies 2019-03-11 12:51:21 +11:00 committed by Scott Lahteine
parent 1f7e220387
commit 4df9509ead

View File

@ -1169,6 +1169,10 @@
/** /**
* Up to 3 PWM fans * Up to 3 PWM fans
*/ */
#ifndef FAN_INVERTING
#define FAN_INVERTING false
#endif
#if HAS_FAN2 #if HAS_FAN2
#define FAN_COUNT 3 #define FAN_COUNT 3
#elif HAS_FAN1 #elif HAS_FAN1
@ -1180,14 +1184,14 @@
#endif #endif
#if HAS_FAN0 #if HAS_FAN0
#define WRITE_FAN(v) WRITE(FAN_PIN, v) #define WRITE_FAN(v) WRITE(FAN_PIN, (v) ^ FAN_INVERTING)
#define WRITE_FAN0(v) WRITE_FAN(v) #define WRITE_FAN0(v) WRITE_FAN(v)
#endif #endif
#if HAS_FAN1 #if HAS_FAN1
#define WRITE_FAN1(v) WRITE(FAN1_PIN, v) #define WRITE_FAN1(v) WRITE(FAN1_PIN, (v) ^ FAN_INVERTING)
#endif #endif
#if HAS_FAN2 #if HAS_FAN2
#define WRITE_FAN2(v) WRITE(FAN2_PIN, v) #define WRITE_FAN2(v) WRITE(FAN2_PIN, (v) ^ FAN_INVERTING)
#endif #endif
#define WRITE_FAN_N(n, v) WRITE_FAN##n(v) #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)