Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert FAN_SOFT_PWM where required #23383

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2008,8 +2008,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif

#if HAS_FAN0 && CONTROLLER_FAN_PIN == FAN_PIN
#error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
#if HAS_FAN0
#if CONTROLLER_FAN_PIN == FAN_PIN
#error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
#elif ENABLED(FAN_SOFT_PWM_REQUIRED) && DISABLED(FAN_SOFT_PWM)
#error "FAN_SOFT_PWM is required. Enable it to continue."
#endif
#endif

#if ENABLED(USE_CONTROLLER_FAN)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/mega/pins_MEGACONTROLLER.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
#define CONTROLLER_FAN_PIN FAN2_PIN
#endif

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// Misc. Functions
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BEAST.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#define FAN_PIN PB10
#endif

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// Temperature Sensors
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#define HEATER_BED_PIN PC9 // HOT BED

#define FAN_PIN PC6 // FAN
#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

#define CONTROLLER_FAN_PIN PC7

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CHITU3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#define FAN_PIN PG14 // MAIN BOARD FAN
#endif

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// Temperature Sensors
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@
#ifndef FAN_PIN
#define FAN_PIN PA0 // FAN
#endif
#if PIN_EXISTS(FAN)
#define FAN_SOFT_PWM
#endif
#define FAN_SOFT_PWM_REQUIRED

//
// SD Card
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
#define HEATER_BED_PIN PA1 // HOT BED

#define FAN_PIN PA2 // FAN
#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// SD Card
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CREALITY_V45x.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
// Heaters / Fans
//

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// SD Card
Expand Down
7 changes: 4 additions & 3 deletions Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
//#define DISABLE_DEBUG
#define DISABLE_JTAG
//#define ENABLE_SPI3
#define FLASH_EEPROM_EMULATION
#define FAN_SOFT_PWM

#if ENABLED(FLASH_EEPROM_EMULATION)
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE)
Expand Down Expand Up @@ -118,6 +117,8 @@
#endif
#endif

#define FAN_SOFT_PWM_REQUIRED

//
// Misc. Functions
//
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/pins/stm32f1/pins_FLY_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
//
// Flash EEPROM Emulation
//
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE 0x800 // 2KB
#define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
#if EITHER(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION)
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE 0x800 // 2KB
#define EEPROM_START_ADDRESS (0x8000000 + 256 * 1024 - 2 * EEPROM_PAGE_SIZE) // 256K firmware space
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE
#endif

//
// Servos
Expand Down
18 changes: 12 additions & 6 deletions Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,19 @@

#define FAN_PIN PA15 // pin 77 (4cm Fan)
#ifdef MAPLE_STM32F1
#define FAN_SOFT_PWM // Required to avoid issues with heating or STLink
#define FAN_MIN_PWM 35 // Fan will not start in 1-30 range
#define FAN_MAX_PWM 255
#define FAN_SOFT_PWM_REQUIRED
#if ENABLED(FAN_SOFT_PWM) && FAN_MIN_PWM < 35 // Required to avoid issues with heating or STLink
#error "FAN_MIN_PWM must be 35 or higher." // Fan will not start in 1-30 range
#endif
#elif ENABLED(FAST_PWM_FAN)
#if FAST_PWM_FAN_FREQUENCY != 31400 // Default 1000 is noisy, max 65K (uint16)
#error "FAST_PWM_FAN_FREQUENCY must be set to 31400."
#endif
#if FAN_MIN_PWM < 5
#error "FAN_MIN_PWM must be 5 or higher."
#endif
#else
#define FAST_PWM_FAN // STM32 Variant allow TIMER2 Hardware PWM
#define FAN_MIN_PWM 5
#define FAN_MAX_PWM 255
#error "FAST_PWM_FAN required to allow TIMER2 Hardware PWM."
#endif

//#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_STM3R_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#endif
#define FAN1_PIN PD13

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// Temperature Sensors
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
//
// EEPROM
//
#define FLASH_EEPROM_EMULATION
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
#endif
#if ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE)
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@

#define BOARD_INFO_NAME "Artillery Ruby"

#define FLASH_EEPROM_EMULATION
//#define I2C_EEPROM
#if NO_EEPROM_SELECTED
#define FLASH_EEPROM_EMULATION
//#define I2C_EEPROM
#endif
//#define E2END 0xFFF // 4KB

#define HAL_TIMER_RATE F_CPU
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_INDEX_REV03.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
#define FAN2_PIN PE4
#define FAN3_PIN PE5

#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

// Neopixel Rings
#define NEOPIXEL_PIN PC7
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_RUMBA32_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// Use soft PWM for fans - PWM is not working properly when paired with STM32 Arduino Core v1.7.0
// This can be removed when Core version is updated and PWM behaviour is fixed.
#define FAN_SOFT_PWM
#define FAN_SOFT_PWM_REQUIRED

//
// Configure Timers
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/STM32F103RET6_creality
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exec_test $1 $2 "Ender 3 v2 with MarlinUI" "$3"
restore_configs
opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1
opt_disable NOZZLE_TO_PROBE_OFFSET
opt_enable NOZZLE_AS_PROBE Z_SAFE_HOMING Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN \
opt_enable NOZZLE_AS_PROBE Z_SAFE_HOMING Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN FAN_SOFT_PWM \
PROBE_ACTIVATION_SWITCH PROBE_TARE PROBE_TARE_ONLY_WHILE_INACTIVE
exec_test $1 $2 "Creality V4.5.2 PROBE_ACTIVATION_SWITCH, Probe Tare" "$3"

Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/STM32F103RE_btt_USB
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exec_test $1 $2 "BigTreeTech SKR E3 DIP v1.0 - Basic Configuration" "$3"

restore_configs
opt_set MOTHERBOARD BOARD_BTT_SKR_CR6 SERIAL_PORT -1 SERIAL_PORT_2 2 TEMP_SENSOR_BED 1
opt_enable CR10_STOCKDISPLAY \
opt_enable CR10_STOCKDISPLAY FAN_SOFT_PWM \
NOZZLE_AS_PROBE Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN Z_SAFE_HOMING \
PROBE_ACTIVATION_SWITCH PROBE_TARE PROBE_TARE_ONLY_WHILE_INACTIVE \
PROBING_HEATERS_OFF PREHEAT_BEFORE_PROBING
Expand Down
5 changes: 3 additions & 2 deletions buildroot/tests/rumba32
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_V1_0 SERIAL_PORT -1 \
TEMP_SENSOR_BED 1 X_DRIVER_TYPE TMC2130
opt_disable PIDTEMP
opt_enable PIDTEMPBED
opt_enable PIDTEMPBED FAN_SOFT_PWM
opt_disable THERMAL_PROTECTION_BED
exec_test $1 $2 "RUMBA32 V1.0 with TMC2130, PID Bed, and bed thermal protection disabled" "$3"

# Build examples
restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_V1_1 SERIAL_PORT -1 \
TEMP_SENSOR_BED 1 X_DRIVER_TYPE TMC2130 Y_DRIVER_TYPE TMC2208
opt_enable PIDTEMPBED EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
opt_enable PIDTEMPBED FAN_SOFT_PWM EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
exec_test $1 $2 "RUMBA32 V1.1 with TMC2130, TMC2208, PID Bed, EEPROM settings, and graphic LCD controller" "$3"

# Build examples
restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_MKS SERIAL_PORT -1 X_DRIVER_TYPE TMC2130 Y_DRIVER_TYPE TMC2208
opt_enable FAN_SOFT_PWM
exec_test $1 $2 "RUMBA32 MKS Default Config with Mixed TMC Drivers" "$3"

# cleanup
Expand Down