Browse Source

📌 Improve Longer3D fan PWM (#23477)

Tanguy Pruvot 3 years ago
parent
commit
27d252c80b
No account linked to committer's email address
1 changed files with 11 additions and 12 deletions
  1. 11
    12
      Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h

+ 11
- 12
Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h View File

@@ -89,20 +89,19 @@
89 89
 #define HEATER_BED_PIN                      PA8   // pin 67 (Hot Bed Mosfet)
90 90
 
91 91
 #define FAN_PIN                             PA15  // pin 77 (4cm Fan)
92
-#ifdef MAPLE_STM32F1
92
+
93
+#if TERN(MAPLE_STM32F1, ENABLED(FAN_SOFT_PWM), ENABLED(FAST_PWM_FAN)) && FAN_MIN_PWM < 5 // Required to avoid issues with heating or STLink
94
+  #error "FAN_MIN_PWM must be 5 or higher."       // Fan will not start in 1-30 range
95
+#endif
96
+
97
+#if defined(MAPLE_STM32F1) || DISABLED(FAST_PWM_FAN) // STM32 HAL required to allow TIMER2 Hardware PWM
93 98
   #define FAN_SOFT_PWM_REQUIRED
94
-  #if ENABLED(FAN_SOFT_PWM) && FAN_MIN_PWM < 35   // Required to avoid issues with heating or STLink
95
-    #error "FAN_MIN_PWM must be 35 or higher."    // Fan will not start in 1-30 range
96
-  #endif
97
-#elif ENABLED(FAST_PWM_FAN)
98
-  #if FAST_PWM_FAN_FREQUENCY != 31400             // Default 1000 is noisy, max 65K (uint16)
99
-    #error "FAST_PWM_FAN_FREQUENCY must be set to 31400."
100
-  #endif
101
-  #if FAN_MIN_PWM < 5
102
-    #error "FAN_MIN_PWM must be 5 or higher."
103
-  #endif
104 99
 #else
105
-  #error "FAST_PWM_FAN required to allow TIMER2 Hardware PWM."
100
+  #if FAST_PWM_FAN_FREQUENCY <= 1000              // Default 1000 is noisy, max 65K (uint16)
101
+    #error "FAST_PWM_FAN_FREQUENCY must be greater than 1000."
102
+  #elif FAST_PWM_FAN_FREQUENCY > 65535
103
+    #error "FAST_PWM_FAN_FREQUENCY must be less than 65536."
104
+  #endif
106 105
 #endif
107 106
 
108 107
 //#define BEEPER_PIN                        PD13  // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor

Loading…
Cancel
Save