Parcourir la source

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.
pinchies il y a 5 ans
Parent
révision
4df9509ead
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7
    3
      Marlin/src/inc/Conditionals_post.h

+ 7
- 3
Marlin/src/inc/Conditionals_post.h Voir le fichier

@@ -1169,6 +1169,10 @@
1169 1169
 /**
1170 1170
  * Up to 3 PWM fans
1171 1171
  */
1172
+#ifndef FAN_INVERTING
1173
+  #define FAN_INVERTING false
1174
+#endif
1175
+
1172 1176
 #if HAS_FAN2
1173 1177
   #define FAN_COUNT 3
1174 1178
 #elif HAS_FAN1
@@ -1180,14 +1184,14 @@
1180 1184
 #endif
1181 1185
 
1182 1186
 #if HAS_FAN0
1183
-  #define WRITE_FAN(v) WRITE(FAN_PIN, v)
1187
+  #define WRITE_FAN(v) WRITE(FAN_PIN, (v) ^ FAN_INVERTING)
1184 1188
   #define WRITE_FAN0(v) WRITE_FAN(v)
1185 1189
 #endif
1186 1190
 #if HAS_FAN1
1187
-  #define WRITE_FAN1(v) WRITE(FAN1_PIN, v)
1191
+  #define WRITE_FAN1(v) WRITE(FAN1_PIN, (v) ^ FAN_INVERTING)
1188 1192
 #endif
1189 1193
 #if HAS_FAN2
1190
-  #define WRITE_FAN2(v) WRITE(FAN2_PIN, v)
1194
+  #define WRITE_FAN2(v) WRITE(FAN2_PIN, (v) ^ FAN_INVERTING)
1191 1195
 #endif
1192 1196
 #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
1193 1197
 

Chargement…
Annuler
Enregistrer