Browse Source

🩺 Assert FAN_SOFT_PWM where required (#23383)

Scott Lahteine 2 years ago
parent
commit
88a6e5b691
No account linked to committer's email address

+ 6
- 2
Marlin/src/inc/SanityCheck.h View File

@@ -2008,8 +2008,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2008 2008
   #endif
2009 2009
 #endif
2010 2010
 
2011
-#if HAS_FAN0 && CONTROLLER_FAN_PIN == FAN_PIN
2012
-  #error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
2011
+#if HAS_FAN0
2012
+  #if CONTROLLER_FAN_PIN == FAN_PIN
2013
+    #error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
2014
+  #elif ENABLED(FAN_SOFT_PWM_REQUIRED) && DISABLED(FAN_SOFT_PWM)
2015
+    #error "FAN_SOFT_PWM is required. Enable it to continue."
2016
+  #endif
2013 2017
 #endif
2014 2018
 
2015 2019
 #if ENABLED(USE_CONTROLLER_FAN)

+ 1
- 1
Marlin/src/pins/mega/pins_MEGACONTROLLER.h View File

@@ -121,7 +121,7 @@
121 121
   #define CONTROLLER_FAN_PIN            FAN2_PIN
122 122
 #endif
123 123
 
124
-#define FAN_SOFT_PWM
124
+#define FAN_SOFT_PWM_REQUIRED
125 125
 
126 126
 //
127 127
 // Misc. Functions

+ 1
- 1
Marlin/src/pins/stm32f1/pins_BEAST.h View File

@@ -93,7 +93,7 @@
93 93
   #define FAN_PIN                           PB10
94 94
 #endif
95 95
 
96
-#define FAN_SOFT_PWM
96
+#define FAN_SOFT_PWM_REQUIRED
97 97
 
98 98
 //
99 99
 // Temperature Sensors

+ 1
- 1
Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h View File

@@ -113,7 +113,7 @@
113 113
 #define HEATER_BED_PIN                      PC9   // HOT BED
114 114
 
115 115
 #define FAN_PIN                             PC6   // FAN
116
-#define FAN_SOFT_PWM
116
+#define FAN_SOFT_PWM_REQUIRED
117 117
 
118 118
 #define CONTROLLER_FAN_PIN                  PC7
119 119
 

+ 1
- 1
Marlin/src/pins/stm32f1/pins_CHITU3D.h View File

@@ -87,7 +87,7 @@
87 87
   #define FAN_PIN                           PG14  // MAIN BOARD FAN
88 88
 #endif
89 89
 
90
-#define FAN_SOFT_PWM
90
+#define FAN_SOFT_PWM_REQUIRED
91 91
 
92 92
 //
93 93
 // Temperature Sensors

+ 1
- 3
Marlin/src/pins/stm32f1/pins_CREALITY_V4.h View File

@@ -143,9 +143,7 @@
143 143
 #ifndef FAN_PIN
144 144
   #define FAN_PIN                           PA0   // FAN
145 145
 #endif
146
-#if PIN_EXISTS(FAN)
147
-  #define FAN_SOFT_PWM
148
-#endif
146
+#define FAN_SOFT_PWM_REQUIRED
149 147
 
150 148
 //
151 149
 // SD Card

+ 1
- 1
Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h View File

@@ -144,7 +144,7 @@
144 144
 #define HEATER_BED_PIN                      PA1   // HOT BED
145 145
 
146 146
 #define FAN_PIN                             PA2   // FAN
147
-#define FAN_SOFT_PWM
147
+#define FAN_SOFT_PWM_REQUIRED
148 148
 
149 149
 //
150 150
 // SD Card

+ 1
- 1
Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h View File

@@ -97,7 +97,7 @@
97 97
 // Heaters / Fans
98 98
 //
99 99
 
100
-#define FAN_SOFT_PWM
100
+#define FAN_SOFT_PWM_REQUIRED
101 101
 
102 102
 //
103 103
 // SD Card

+ 4
- 3
Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h View File

@@ -38,10 +38,9 @@
38 38
 //#define DISABLE_DEBUG
39 39
 #define DISABLE_JTAG
40 40
 //#define ENABLE_SPI3
41
-#define FLASH_EEPROM_EMULATION
42
-#define FAN_SOFT_PWM
43 41
 
44
-#if ENABLED(FLASH_EEPROM_EMULATION)
42
+#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
43
+  #define FLASH_EEPROM_EMULATION
45 44
   #define EEPROM_PAGE_SIZE     (0x800U)           // 2KB
46 45
   #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
47 46
   #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE)
@@ -118,6 +117,8 @@
118 117
   #endif
119 118
 #endif
120 119
 
120
+#define FAN_SOFT_PWM_REQUIRED
121
+
121 122
 //
122 123
 // Misc. Functions
123 124
 //

+ 6
- 4
Marlin/src/pins/stm32f1/pins_FLY_MINI.h View File

@@ -30,10 +30,12 @@
30 30
 //
31 31
 // Flash EEPROM Emulation
32 32
 //
33
-#define FLASH_EEPROM_EMULATION
34
-#define EEPROM_PAGE_SIZE     0x800 // 2KB
35
-#define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space
36
-#define MARLIN_EEPROM_SIZE   EEPROM_PAGE_SIZE
33
+#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
34
+  #define FLASH_EEPROM_EMULATION
35
+  #define EEPROM_PAGE_SIZE     0x800 // 2KB
36
+  #define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space
37
+  #define MARLIN_EEPROM_SIZE   EEPROM_PAGE_SIZE
38
+#endif
37 39
 
38 40
 //
39 41
 // Servos

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

@@ -90,13 +90,19 @@
90 90
 
91 91
 #define FAN_PIN                             PA15  // pin 77 (4cm Fan)
92 92
 #ifdef MAPLE_STM32F1
93
-  #define FAN_SOFT_PWM                            // Required to avoid issues with heating or STLink
94
-  #define FAN_MIN_PWM                         35  // Fan will not start in 1-30 range
95
-  #define FAN_MAX_PWM                        255
93
+  #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
96 104
 #else
97
-  #define FAST_PWM_FAN                            // STM32 Variant allow TIMER2 Hardware PWM
98
-  #define FAN_MIN_PWM                          5
99
-  #define FAN_MAX_PWM                        255
105
+  #error "FAST_PWM_FAN required to allow TIMER2 Hardware PWM."
100 106
 #endif
101 107
 
102 108
 //#define BEEPER_PIN                        PD13  // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor

+ 1
- 1
Marlin/src/pins/stm32f1/pins_STM3R_MINI.h View File

@@ -91,7 +91,7 @@
91 91
 #endif
92 92
 #define FAN1_PIN                            PD13
93 93
 
94
-#define FAN_SOFT_PWM
94
+#define FAN_SOFT_PWM_REQUIRED
95 95
 
96 96
 //
97 97
 // Temperature Sensors

+ 3
- 1
Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h View File

@@ -45,7 +45,9 @@
45 45
 //
46 46
 // EEPROM
47 47
 //
48
-#define FLASH_EEPROM_EMULATION
48
+#if NO_EEPROM_SELECTED
49
+  #define FLASH_EEPROM_EMULATION
50
+#endif
49 51
 #if ENABLED(FLASH_EEPROM_EMULATION)
50 52
   // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
51 53
   #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)

+ 4
- 2
Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h View File

@@ -29,8 +29,10 @@
29 29
 
30 30
 #define BOARD_INFO_NAME      "Artillery Ruby"
31 31
 
32
-#define FLASH_EEPROM_EMULATION
33
-//#define I2C_EEPROM
32
+#if NO_EEPROM_SELECTED
33
+  #define FLASH_EEPROM_EMULATION
34
+  //#define I2C_EEPROM
35
+#endif
34 36
 //#define E2END                            0xFFF  // 4KB
35 37
 
36 38
 #define HAL_TIMER_RATE                     F_CPU

+ 1
- 1
Marlin/src/pins/stm32f4/pins_INDEX_REV03.h View File

@@ -119,7 +119,7 @@
119 119
 #define FAN2_PIN                            PE4
120 120
 #define FAN3_PIN                            PE5
121 121
 
122
-#define FAN_SOFT_PWM
122
+#define FAN_SOFT_PWM_REQUIRED
123 123
 
124 124
 // Neopixel Rings
125 125
 #define NEOPIXEL_PIN                        PC7

+ 1
- 1
Marlin/src/pins/stm32f4/pins_RUMBA32_common.h View File

@@ -35,7 +35,7 @@
35 35
 
36 36
 // Use soft PWM for fans - PWM is not working properly when paired with STM32 Arduino Core v1.7.0
37 37
 // This can be removed when Core version is updated and PWM behaviour is fixed.
38
-#define FAN_SOFT_PWM
38
+#define FAN_SOFT_PWM_REQUIRED
39 39
 
40 40
 //
41 41
 // Configure Timers

+ 1
- 1
buildroot/tests/STM32F103RET6_creality View File

@@ -30,7 +30,7 @@ exec_test $1 $2 "Ender 3 v2 with MarlinUI" "$3"
30 30
 restore_configs
31 31
 opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1
32 32
 opt_disable NOZZLE_TO_PROBE_OFFSET
33
-opt_enable NOZZLE_AS_PROBE Z_SAFE_HOMING Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN \
33
+opt_enable NOZZLE_AS_PROBE Z_SAFE_HOMING Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN FAN_SOFT_PWM \
34 34
            PROBE_ACTIVATION_SWITCH PROBE_TARE PROBE_TARE_ONLY_WHILE_INACTIVE
35 35
 exec_test $1 $2 "Creality V4.5.2 PROBE_ACTIVATION_SWITCH, Probe Tare" "$3"
36 36
 

+ 1
- 1
buildroot/tests/STM32F103RE_btt_USB View File

@@ -15,7 +15,7 @@ exec_test $1 $2 "BigTreeTech SKR E3 DIP v1.0 - Basic Configuration" "$3"
15 15
 
16 16
 restore_configs
17 17
 opt_set MOTHERBOARD BOARD_BTT_SKR_CR6 SERIAL_PORT -1 SERIAL_PORT_2 2 TEMP_SENSOR_BED 1
18
-opt_enable CR10_STOCKDISPLAY \
18
+opt_enable CR10_STOCKDISPLAY FAN_SOFT_PWM \
19 19
            NOZZLE_AS_PROBE Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN Z_SAFE_HOMING \
20 20
            PROBE_ACTIVATION_SWITCH PROBE_TARE PROBE_TARE_ONLY_WHILE_INACTIVE \
21 21
            PROBING_HEATERS_OFF PREHEAT_BEFORE_PROBING

+ 3
- 2
buildroot/tests/rumba32 View File

@@ -11,7 +11,7 @@ restore_configs
11 11
 opt_set MOTHERBOARD BOARD_RUMBA32_V1_0 SERIAL_PORT -1 \
12 12
         TEMP_SENSOR_BED 1 X_DRIVER_TYPE TMC2130
13 13
 opt_disable PIDTEMP
14
-opt_enable PIDTEMPBED
14
+opt_enable PIDTEMPBED FAN_SOFT_PWM
15 15
 opt_disable THERMAL_PROTECTION_BED
16 16
 exec_test $1 $2 "RUMBA32 V1.0 with TMC2130, PID Bed, and bed thermal protection disabled" "$3"
17 17
 
@@ -19,12 +19,13 @@ exec_test $1 $2 "RUMBA32 V1.0 with TMC2130, PID Bed, and bed thermal protection
19 19
 restore_configs
20 20
 opt_set MOTHERBOARD BOARD_RUMBA32_V1_1 SERIAL_PORT -1 \
21 21
         TEMP_SENSOR_BED 1 X_DRIVER_TYPE TMC2130 Y_DRIVER_TYPE TMC2208
22
-opt_enable PIDTEMPBED EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
22
+opt_enable PIDTEMPBED FAN_SOFT_PWM EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
23 23
 exec_test $1 $2 "RUMBA32 V1.1 with TMC2130, TMC2208, PID Bed, EEPROM settings, and graphic LCD controller" "$3"
24 24
 
25 25
 # Build examples
26 26
 restore_configs
27 27
 opt_set MOTHERBOARD BOARD_RUMBA32_MKS SERIAL_PORT -1 X_DRIVER_TYPE TMC2130 Y_DRIVER_TYPE TMC2208
28
+opt_enable FAN_SOFT_PWM
28 29
 exec_test $1 $2 "RUMBA32 MKS Default Config with Mixed TMC Drivers" "$3"
29 30
 
30 31
 # cleanup

Loading…
Cancel
Save