My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

buzzer.cpp 495B

12345678910111213141516171819202122
  1. #include "Marlin.h"
  2. #include "buzzer.h"
  3. #include "ultralcd.h"
  4. #if HAS_BUZZER
  5. void buzz(long duration, uint16_t freq) {
  6. if (freq > 0) {
  7. #ifdef LCD_USE_I2C_BUZZER
  8. lcd_buzz(duration, freq);
  9. #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition
  10. SET_OUTPUT(BEEPER);
  11. tone(BEEPER, freq, duration);
  12. delay(duration);
  13. #else
  14. delay(duration);
  15. #endif
  16. }
  17. else {
  18. delay(duration);
  19. }
  20. }
  21. #endif