"Sound: ON/OFF" menu item (#19901)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
committed by
Scott Lahteine
parent
d4669dbf6a
commit
d7d1ef8228
@ -113,6 +113,7 @@ static void createChar_P(const char c, const byte * const ptr) {
|
||||
|
||||
#if ENABLED(LCD_USE_I2C_BUZZER)
|
||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
||||
if (!buzzer_enabled) return;
|
||||
lcd.buzz(duration, freq);
|
||||
}
|
||||
#endif
|
||||
|
@ -289,6 +289,7 @@ uint8_t MarlinUI::read_slow_buttons(void) {
|
||||
// Duration in ms, freq in Hz
|
||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
||||
if (!PanelDetected) return;
|
||||
if (!buzzer_enabled) return;
|
||||
#if ENABLED(TFTGLCD_PANEL_SPI)
|
||||
WRITE(TFTGLCD_CS, LOW);
|
||||
SPI_SEND_ONE(BUZZER);
|
||||
|
@ -659,6 +659,7 @@ namespace Language_en {
|
||||
PROGMEM Language_Str MSG_REHEATING = _UxGT("Reheating...");
|
||||
|
||||
PROGMEM Language_Str MSG_PROBE_WIZARD = _UxGT("Z Probe Wizard");
|
||||
PROGMEM Language_Str MSG_SOUND = _UxGT("Sound");
|
||||
}
|
||||
|
||||
#if FAN_COUNT == 1
|
||||
|
@ -74,12 +74,17 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SOUND_MENU_ITEM)
|
||||
bool MarlinUI::buzzer_enabled = true;
|
||||
#endif
|
||||
|
||||
#if EITHER(PCA9632_BUZZER, USE_BEEPER)
|
||||
#include "../libs/buzzer.h" // for BUZZ() macro
|
||||
#if ENABLED(PCA9632_BUZZER)
|
||||
#include "../feature/leds/pca9632.h"
|
||||
#endif
|
||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
||||
if (!buzzer_enabled) return;
|
||||
#if ENABLED(PCA9632_BUZZER)
|
||||
PCA9632_buzz(duration, freq);
|
||||
#elif USE_BEEPER
|
||||
|
@ -292,6 +292,12 @@ public:
|
||||
TERN_(HAS_LCD_MENU, currentScreen = status_screen);
|
||||
}
|
||||
|
||||
#if ENABLED(SOUND_MENU_ITEM)
|
||||
static bool buzzer_enabled; // Initialized by settings.load()
|
||||
#else
|
||||
static constexpr bool buzzer_enabled = true;
|
||||
#endif
|
||||
|
||||
#if HAS_BUZZER
|
||||
static void buzz(const long duration, const uint16_t freq);
|
||||
#endif
|
||||
|
@ -45,6 +45,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SOUND_MENU_ITEM)
|
||||
#include "../../libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
|
||||
|
||||
void menu_advanced_settings();
|
||||
@ -412,6 +416,10 @@ void menu_configuration() {
|
||||
SUBMENU_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M_SETTINGS, _menu_configuration_preheat_settings);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SOUND_MENU_ITEM)
|
||||
EDIT_ITEM(bool, MSG_SOUND, &ui.buzzer_enabled, []{ ui.chirp(); });
|
||||
#endif
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
|
||||
if (!busy) ACTION_ITEM(MSG_LOAD_EEPROM, ui.load_settings);
|
||||
|
Reference in New Issue
Block a user