|
64 | 64 | uint8_t MarlinUI::progress_bar_percent; // = 0
|
65 | 65 | #endif
|
66 | 66 |
|
| 67 | +#if HAS_BUZZER |
| 68 | + #include "../libs/buzzer.h" |
| 69 | + void MarlinUI::buzz(const long duration, const uint16_t freq) { |
| 70 | + #if ENABLED(LCD_USE_I2C_BUZZER) |
| 71 | + lcd.buzz(duration, freq); |
| 72 | + #elif ENABLED(PCA9632_BUZZER) |
| 73 | + pca9632_buzz(const long duration, const uint16_t freq) { |
| 74 | + #elif USE_BEEPER |
| 75 | + buzzer.tone(duration, freq); |
| 76 | + #endif |
| 77 | + } |
| 78 | +#endif |
| 79 | + |
67 | 80 | #if HAS_SPI_LCD
|
68 | 81 |
|
69 | 82 | #if HAS_GRAPHICAL_LCD
|
|
89 | 102 | #include "../feature/bedlevel/bedlevel.h"
|
90 | 103 | #endif
|
91 | 104 |
|
92 |
| -#if HAS_BUZZER |
93 |
| - #include "../libs/buzzer.h" |
94 |
| -#endif |
95 |
| - |
96 | 105 | #if HAS_TRINAMIC
|
97 | 106 | #include "../feature/tmc_util.h"
|
98 | 107 | #endif
|
@@ -568,7 +577,7 @@ void MarlinUI::status_screen() {
|
568 | 577 | const millis_t ms = millis();
|
569 | 578 | #endif
|
570 | 579 | if (ELAPSED(ms, next_beep)) {
|
571 |
| - BUZZ(FEEDRATE_CHANGE_BEEP_DURATION, FEEDRATE_CHANGE_BEEP_FREQUENCY); |
| 580 | + buzz(FEEDRATE_CHANGE_BEEP_DURATION, FEEDRATE_CHANGE_BEEP_FREQUENCY); |
572 | 581 | next_beep = ms + 500UL;
|
573 | 582 | }
|
574 | 583 | #endif
|
@@ -611,13 +620,12 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
|
611 | 620 | #if HAS_BUZZER
|
612 | 621 | // Buzz and wait. Is the delay needed for buttons to settle?
|
613 | 622 | buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
614 |
| - #endif |
615 |
| - |
616 |
| - #if HAS_LCD_MENU |
617 |
| - #if ENABLED(LCD_USE_I2C_BUZZER) |
618 |
| - delay(10); |
619 |
| - #elif PIN_EXISTS(BEEPER) |
620 |
| - for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } |
| 623 | + #if HAS_LCD_MENU |
| 624 | + #if USE_BEEPER |
| 625 | + for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); } |
| 626 | + #else |
| 627 | + delay(10); |
| 628 | + #endif |
621 | 629 | #endif
|
622 | 630 | #endif
|
623 | 631 | }
|
@@ -729,16 +737,6 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
|
729 | 737 |
|
730 | 738 | LCDViewAction MarlinUI::lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
731 | 739 |
|
732 |
| -bool MarlinUI::detected() { |
733 |
| - return |
734 |
| - #if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE) |
735 |
| - lcd.LcdDetected() == 1 |
736 |
| - #else |
737 |
| - true |
738 |
| - #endif |
739 |
| - ; |
740 |
| -} |
741 |
| - |
742 | 740 | void MarlinUI::update() {
|
743 | 741 |
|
744 | 742 | static uint16_t max_display_update_time = 0;
|
@@ -1295,23 +1293,6 @@ void MarlinUI::update() {
|
1295 | 1293 | #endif // HAS_ENCODER_WHEEL
|
1296 | 1294 | }
|
1297 | 1295 |
|
1298 |
| - #if HAS_SLOW_BUTTONS |
1299 |
| - |
1300 |
| - uint8_t MarlinUI::read_slow_buttons() { |
1301 |
| - #if ENABLED(LCD_I2C_TYPE_MCP23017) |
1302 |
| - // Reading these buttons this is likely to be too slow to call inside interrupt context |
1303 |
| - // so they are called during normal lcd_update |
1304 |
| - uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET; |
1305 |
| - #if ENABLED(LCD_I2C_VIKI) |
1306 |
| - if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked |
1307 |
| - slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated |
1308 |
| - #endif // LCD_I2C_VIKI |
1309 |
| - return slow_bits; |
1310 |
| - #endif // LCD_I2C_TYPE_MCP23017 |
1311 |
| - } |
1312 |
| - |
1313 |
| - #endif |
1314 |
| - |
1315 | 1296 | #endif // HAS_ENCODER_ACTION
|
1316 | 1297 |
|
1317 | 1298 | #endif // HAS_SPI_LCD
|
|
0 commit comments