Przeglądaj źródła

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 6 lat temu
rodzic
commit
4df9509ead
1 zmienionych plików z 7 dodań i 3 usunięć
  1. 7
    3
      Marlin/src/inc/Conditionals_post.h

+ 7
- 3
Marlin/src/inc/Conditionals_post.h Wyświetl plik

1169
 /**
1169
 /**
1170
  * Up to 3 PWM fans
1170
  * Up to 3 PWM fans
1171
  */
1171
  */
1172
+#ifndef FAN_INVERTING
1173
+  #define FAN_INVERTING false
1174
+#endif
1175
+
1172
 #if HAS_FAN2
1176
 #if HAS_FAN2
1173
   #define FAN_COUNT 3
1177
   #define FAN_COUNT 3
1174
 #elif HAS_FAN1
1178
 #elif HAS_FAN1
1180
 #endif
1184
 #endif
1181
 
1185
 
1182
 #if HAS_FAN0
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
   #define WRITE_FAN0(v) WRITE_FAN(v)
1188
   #define WRITE_FAN0(v) WRITE_FAN(v)
1185
 #endif
1189
 #endif
1186
 #if HAS_FAN1
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
 #endif
1192
 #endif
1189
 #if HAS_FAN2
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
 #endif
1195
 #endif
1192
 #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
1196
 #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
1193
 
1197
 

Ładowanie…
Anuluj
Zapisz