switching stealth/normal mode for mmu in settings menu and tune menu
This commit is contained in:
parent
141b78c048
commit
819a91ab1e
3 changed files with 46 additions and 12 deletions
Firmware
|
@ -45,6 +45,7 @@ namespace
|
||||||
WaitCmd, //!< wait for command response
|
WaitCmd, //!< wait for command response
|
||||||
Pause,
|
Pause,
|
||||||
GetDrvError, //!< get power failures count
|
GetDrvError, //!< get power failures count
|
||||||
|
SwitchMode //switch mmu between stealth and normal mode
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,9 +184,9 @@ bool check_for_ir_sensor()
|
||||||
|
|
||||||
static bool activate_stealth_mode()
|
static bool activate_stealth_mode()
|
||||||
{
|
{
|
||||||
#if defined (MMU_FORCE_STEALTH_MODE)
|
#ifdef MMU_FORCE_STEALTH_MODE
|
||||||
return true;
|
return true;
|
||||||
#elif
|
#else
|
||||||
return (eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) == 1);
|
return (eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) == 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -335,6 +336,12 @@ void mmu_loop(void)
|
||||||
mmu_last_cmd = mmu_cmd;
|
mmu_last_cmd = mmu_cmd;
|
||||||
mmu_cmd = MmuCmd::None;
|
mmu_cmd = MmuCmd::None;
|
||||||
}
|
}
|
||||||
|
else if ((eeprom_read_byte((uint8_t*)EEPROM_MMU_STEALTH) != SilentModeMenu_MMU) && mmu_ready) {
|
||||||
|
DEBUG_PRINTF_P(PSTR("MMU <= 'M%d'\n"), SilentModeMenu_MMU);
|
||||||
|
mmu_printf_P(PSTR("M%d\n"), SilentModeMenu_MMU);
|
||||||
|
mmu_ready = false;
|
||||||
|
mmu_state = S::SwitchMode;
|
||||||
|
}
|
||||||
else if ((mmu_last_response + 300) < _millis()) //request every 300ms
|
else if ((mmu_last_response + 300) < _millis()) //request every 300ms
|
||||||
{
|
{
|
||||||
#ifndef IR_SENSOR
|
#ifndef IR_SENSOR
|
||||||
|
@ -450,9 +457,23 @@ void mmu_loop(void)
|
||||||
mmu_state = S::Idle;
|
mmu_state = S::Idle;
|
||||||
}
|
}
|
||||||
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis())
|
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis())
|
||||||
{ //resend request after timeout (5 min)
|
{ //timeout 45 s
|
||||||
mmu_state = S::Idle;
|
mmu_state = S::Idle;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
case S::SwitchMode:
|
||||||
|
if (mmu_rx_ok() > 0)
|
||||||
|
{
|
||||||
|
DEBUG_PRINTF_P(PSTR("MMU => 'ok'\n"));
|
||||||
|
eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU);
|
||||||
|
mmu_ready = true;
|
||||||
|
mmu_state = S::Idle;
|
||||||
|
}
|
||||||
|
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis())
|
||||||
|
{ //timeout 45 s
|
||||||
|
mmu_state = S::Idle;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4516,11 +4516,13 @@ static void lcd_sound_state_set(void)
|
||||||
Sound_CycleState();
|
Sound_CycleState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MMU_FORCE_STEALTH_MODE
|
||||||
static void lcd_silent_mode_mmu_set() {
|
static void lcd_silent_mode_mmu_set() {
|
||||||
if (SilentModeMenu_MMU == 1) SilentModeMenu_MMU = 0;
|
if (SilentModeMenu_MMU == 1) SilentModeMenu_MMU = 0;
|
||||||
else SilentModeMenu_MMU = 1;
|
else SilentModeMenu_MMU = 1;
|
||||||
eeprom_update_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU);
|
//saving to eeprom is done in mmu_loop() after mmu actually switches state and confirms with "ok"
|
||||||
}
|
}
|
||||||
|
#endif //MMU_FORCE_STEALTH_MODE
|
||||||
|
|
||||||
static void lcd_silent_mode_set() {
|
static void lcd_silent_mode_set() {
|
||||||
switch (SilentModeMenu) {
|
switch (SilentModeMenu) {
|
||||||
|
@ -5295,17 +5297,26 @@ do\
|
||||||
break; /* (probably) not needed*/\
|
break; /* (probably) not needed*/\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
#ifndef MMU_FORCE_STEALTH_MODE
|
|
||||||
if(mmu_enabled)\
|
|
||||||
{\
|
|
||||||
if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set);\
|
|
||||||
else MENU_ITEM_FUNCTION_P(_i("MMU Mode [Stealth]"), lcd_silent_mode_mmu_set);\
|
|
||||||
}\
|
|
||||||
#endif //MMU_FORCE_STEALTH_MODE
|
|
||||||
}\
|
}\
|
||||||
while (0)
|
while (0)
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
|
#ifndef MMU_FORCE_STEALTH_MODE
|
||||||
|
#define SETTINGS_MMU_MODE \
|
||||||
|
do\
|
||||||
|
{\
|
||||||
|
if (mmu_enabled)\
|
||||||
|
{\
|
||||||
|
if (SilentModeMenu_MMU == 0) MENU_ITEM_FUNCTION_P(_i("MMU Mode [Fast]"), lcd_silent_mode_mmu_set); \
|
||||||
|
else MENU_ITEM_FUNCTION_P(_i("MMU Mode[Stealth]"), lcd_silent_mode_mmu_set); \
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
while (0)
|
||||||
|
#else //MMU_FORCE_STEALTH_MODE
|
||||||
|
#define SETTINGS_MMU_MODE
|
||||||
|
#endif //MMU_FORCE_STEALTH_MODE
|
||||||
|
|
||||||
#ifdef SDCARD_SORT_ALPHA
|
#ifdef SDCARD_SORT_ALPHA
|
||||||
#define SETTINGS_SD \
|
#define SETTINGS_SD \
|
||||||
do\
|
do\
|
||||||
|
@ -5410,6 +5421,7 @@ static void lcd_settings_menu()
|
||||||
MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1
|
MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1
|
||||||
|
|
||||||
SETTINGS_SILENT_MODE;
|
SETTINGS_SILENT_MODE;
|
||||||
|
SETTINGS_MMU_MODE;
|
||||||
|
|
||||||
MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1
|
MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1
|
||||||
|
|
||||||
|
@ -6626,7 +6638,7 @@ static void lcd_tune_menu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
SETTINGS_MMU_MODE;
|
||||||
switch(eSoundMode)
|
switch(eSoundMode)
|
||||||
{
|
{
|
||||||
case e_SOUND_MODE_LOUD:
|
case e_SOUND_MODE_LOUD:
|
||||||
|
|
|
@ -117,6 +117,7 @@ extern int farm_status;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue