optimisation: MMU silent mode toggling & init

Change in memory:
Flash: -16 bytes
SRAM: -2 bytes
This commit is contained in:
Guðni Már Gilbert 2023-02-19 20:14:06 +00:00
parent 4cf46893fc
commit 687c14808a
3 changed files with 4 additions and 13 deletions

View File

@ -1465,11 +1465,7 @@ void setup()
//mbl_mode_init();
mbl_settings_init();
SilentModeMenu_MMU = eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH);
if (SilentModeMenu_MMU == 255) {
SilentModeMenu_MMU = 1;
eeprom_write_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU);
}
eeprom_init_default_byte((uint8_t*)EEPROM_MMU_STEALTH, 1);
#if !defined(DEBUG_DISABLE_FANCHECK) && defined(FANCHECK) && defined(TACH_1) && TACH_1 >-1
setup_fan_interrupt();

View File

@ -61,7 +61,6 @@ int8_t ReInitLCD = 0;
uint8_t scrollstuff = 0;
int8_t SilentModeMenu = SILENT_MODE_OFF;
uint8_t SilentModeMenu_MMU = 1; //activate mmu unit stealth mode
int8_t FSensorStateMenu = 1;
@ -3442,10 +3441,8 @@ Sound_CycleState();
}
#ifndef MMU_FORCE_STEALTH_MODE
static void lcd_silent_mode_mmu_set() {
if (SilentModeMenu_MMU == 1) SilentModeMenu_MMU = 0;
else SilentModeMenu_MMU = 1;
//saving to eeprom is done in mmu_loop() after mmu actually switches state and confirms with "ok"
static void lcd_mmu_mode_toggle() {
eeprom_toggle((uint8_t*)EEPROM_MMU_STEALTH);
}
#endif //MMU_FORCE_STEALTH_MODE
@ -4244,8 +4241,7 @@ do\
{\
if (MMU2::mmu2.Enabled())\
{\
if (SilentModeMenu_MMU == 0) MENU_ITEM_TOGGLE_P(_T(MSG_MMU_MODE), _T(MSG_NORMAL), lcd_silent_mode_mmu_set);\
else MENU_ITEM_TOGGLE_P(_T(MSG_MMU_MODE), _T(MSG_STEALTH), lcd_silent_mode_mmu_set);\
MENU_ITEM_TOGGLE_P(_T(MSG_MMU_MODE), eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) ? _T(MSG_STEALTH) : _T(MSG_NORMAL), lcd_mmu_mode_toggle);\
}\
}\
while (0)

View File

@ -163,7 +163,6 @@ void printf_IRSensorAnalogBoardChange();
#endif //IR_SENSOR_ANALOG
extern int8_t SilentModeMenu;
extern uint8_t SilentModeMenu_MMU;
extern bool cancel_heatup;
extern bool isPrintPaused;