Skip to content

Commit 9e7b3ec

Browse files
descipherLCh-77
authored andcommitted
🔧 Sanity-check AVR D9 Fan PWM / SPEAKER Timer2 (MarlinFirmware#23672)
1 parent b6b47ab commit 9e7b3ec

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Marlin/src/HAL/AVR/inc/SanityCheck.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@
2929
* Checks for FAST PWM
3030
*/
3131
#if ALL(FAST_PWM_FAN, USE_OCR2A_AS_TOP, HAS_TCCR2)
32-
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
32+
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2."
33+
#endif
34+
35+
/**
36+
* Checks for SOFT PWM
37+
*/
38+
#if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
39+
#error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
40+
#error "Disable SPEAKER or enable FAN_SOFT_PWM."
3341
#endif
3442

3543
/**

Marlin/src/inc/SanityCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
20182018
#if CONTROLLER_FAN_PIN == FAN_PIN
20192019
#error "You cannot set CONTROLLER_FAN_PIN equal to FAN_PIN."
20202020
#elif ENABLED(FAN_SOFT_PWM_REQUIRED) && DISABLED(FAN_SOFT_PWM)
2021-
#error "FAN_SOFT_PWM is required. Enable it to continue."
2021+
#error "FAN_SOFT_PWM is required for your board. Enable it to continue."
20222022
#endif
20232023
#endif
20242024

0 commit comments

Comments
 (0)