Skip to content

Commit

Permalink
🔧 Sanity-check AVR D9 Fan PWM / SPEAKER Timer2 (#23672)
Browse files Browse the repository at this point in the history
  • Loading branch information
descipher authored and thinkyhead committed May 7, 2022
1 parent f8571fc commit f42c1b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Marlin/src/HAL/AVR/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@
* Checks for FAST PWM
*/
#if ALL(FAST_PWM_FAN, USE_OCR2A_AS_TOP, HAS_TCCR2)
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2"
#error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2."
#endif

/**
* Checks for SOFT PWM
*/
#if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
#error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
#error "Disable SPEAKER or enable FAN_SOFT_PWM."
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#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."
#error "FAN_SOFT_PWM is required for your board. Enable it to continue."
#endif
#endif

Expand Down

0 comments on commit f42c1b4

Please sign in to comment.