Merge pull request #4036 from gudnimg/optimise-mmu-silent-mode

optimisation: MMU silent mode toggling & init
This commit is contained in:
Alex Voinea 2023-04-13 10:54:21 +02:00 committed by GitHub
commit 82343184e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

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

View File

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

View File

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