♻️ Small sound / buzz refactor (#24520)
This commit is contained in:
@ -36,7 +36,7 @@
|
||||
#include "../../marlinui.h"
|
||||
#include "../../../HAL/shared/Delay.h"
|
||||
|
||||
#if HAS_BUZZER
|
||||
#if HAS_SOUND
|
||||
#include "../../../libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
@ -50,9 +50,7 @@ ENCODER_Rate EncoderRate;
|
||||
|
||||
// TODO: Replace with ui.quick_feedback
|
||||
void Encoder_tick() {
|
||||
#if PIN_EXISTS(BEEPER)
|
||||
if (ui.sound_on) buzzer.click(10);
|
||||
#endif
|
||||
TERN_(HAS_BEEPER, if (ui.sound_on) buzzer.click(10));
|
||||
}
|
||||
|
||||
// Encoder initialization
|
||||
@ -66,7 +64,7 @@ void Encoder_Configuration() {
|
||||
#if BUTTON_EXISTS(ENC)
|
||||
SET_INPUT_PULLUP(BTN_ENC);
|
||||
#endif
|
||||
#if PIN_EXISTS(BEEPER)
|
||||
#if HAS_BEEPER
|
||||
SET_OUTPUT(BEEPER_PIN); // TODO: Use buzzer.h which already inits this
|
||||
#endif
|
||||
}
|
||||
|
@ -2625,15 +2625,13 @@ void Draw_HomeOff_Menu() {
|
||||
#include "../../../libs/buzzer.h"
|
||||
|
||||
void HMI_AudioFeedback(const bool success=true) {
|
||||
#if HAS_BUZZER
|
||||
if (success) {
|
||||
buzzer.tone(100, 659);
|
||||
buzzer.tone(10, 0);
|
||||
buzzer.tone(100, 698);
|
||||
}
|
||||
else
|
||||
buzzer.tone(40, 440);
|
||||
#endif
|
||||
if (success) {
|
||||
BUZZ(100, 659);
|
||||
BUZZ(10, 0);
|
||||
BUZZ(100, 698);
|
||||
}
|
||||
else
|
||||
BUZZ(40, 440);
|
||||
}
|
||||
|
||||
// Prepare
|
||||
|
Reference in New Issue
Block a user