"Sound: ON/OFF" menu item (#19901)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Lucas Seiki Oshiro
2020-10-27 22:41:12 -03:00
committed by GitHub
parent 68ef3ac675
commit c0b4f4eb47
13 changed files with 74 additions and 13 deletions

View File

@ -153,6 +153,10 @@
#include "../feature/ethernet.h"
#endif
#if ENABLED(SOUND_MENU_ITEM)
#include "../libs/buzzer.h"
#endif
#pragma pack(push, 1) // No padding between variables
#if HAS_ETHERNET
@ -451,6 +455,12 @@ typedef struct SettingsDataStruct {
ethernet_subnet; // M554 P
#endif
//
// Buzzer enable/disable
//
#if ENABLED(SOUND_MENU_ITEM)
bool buzzer_enabled;
#endif
} SettingsData;
//static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");
@ -1422,6 +1432,13 @@ void MarlinSettings::postprocess() {
}
#endif
//
// Buzzer enable/disable
//
#if ENABLED(SOUND_MENU_ITEM)
EEPROM_WRITE(ui.buzzer_enabled);
#endif
//
// Report final CRC and Data Size
//
@ -2293,6 +2310,14 @@ void MarlinSettings::postprocess() {
EEPROM_READ(ethernet_subnet); ethernet.subnet = ethernet_subnet;
#endif
//
// Buzzer enable/disable
//
#if ENABLED(SOUND_MENU_ITEM)
_FIELD_TEST(buzzer_enabled);
EEPROM_READ(ui.buzzer_enabled);
#endif
//
// Validate Final Size and CRC
//
@ -2603,6 +2628,11 @@ void MarlinSettings::reset() {
//
TERN_(TOUCH_SCREEN_CALIBRATION, touch.calibration_reset());
//
// Buzzer enable/disable
//
TERN_(SOUND_MENU_ITEM, ui.buzzer_enabled = true);
//
// Magnetic Parking Extruder
//