Disable MMU from menu

Signed-off-by: Przemek Grondek <przemek@grondek.pl>
This commit is contained in:
Voinea 2019-04-07 10:48:41 +02:00 committed by Przemek Grondek
parent b087d7c330
commit 3c13aac640
5 changed files with 547 additions and 504 deletions

File diff suppressed because it is too large Load Diff

View File

@ -595,9 +595,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
#define EEPROM_TEMP_MODEL_D (EEPROM_TEMP_MODEL_V-4) //float
#define EEPROM_TEMP_MODEL_L (EEPROM_TEMP_MODEL_D-2) //uint16_t
#define EEPROM_TEMP_MODEL_VER (EEPROM_TEMP_MODEL_L-1) //uint8_t
#define EEPROM_MMU_DISABLED_FROM_MENU (EEPROM_TEMP_MODEL_VER-1)
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
#define EEPROM_LAST_ITEM EEPROM_TEMP_MODEL_VER
#define EEPROM_LAST_ITEM EEPROM_MMU_DISABLED_FROM_MENU
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!

View File

@ -160,7 +160,9 @@ void mmu_init(void)
WRITE(MMU_RST_PIN, 1);
SET_OUTPUT(MMU_RST_PIN); //setup reset pin
#endif //MMU_HWRESET
uart2_init(); //init uart2
if (!MMU_Disabled_from_menu) {
uart2_init(); //init uart2
}
_delay_ms(10); //wait 10ms for sure
mmu_reset(); //reset mmu (HW or SW), do not wait for response
mmu_state = S::Init;

View File

@ -67,6 +67,7 @@ uint8_t scrollstuff = 0;
int8_t SilentModeMenu = SILENT_MODE_OFF;
uint8_t SilentModeMenu_MMU = 1; //activate mmu unit stealth mode
uint8_t MMU_Disabled_from_menu = 0;
int8_t FSensorStateMenu = 1;
@ -1772,6 +1773,8 @@ static void lcd_support_menu()
lcd_puts_P(_i("unknown")); ////MSG_UNKNOWN c=13
}
}
else if (MMU_Disabled_from_menu)
MENU_ITEM_BACK_P(PSTR("MMU2 disabled"));
else
MENU_ITEM_BACK_P(PSTR("MMU2 N/A"));
@ -1844,6 +1847,35 @@ void lcd_set_fan_check() {
#endif //FANCHECK
}
static void disable_mmu_switch()
{
MMU_Disabled_from_menu = !MMU_Disabled_from_menu;
eeprom_update_byte((unsigned char *)EEPROM_MMU_DISABLED_FROM_MENU, MMU_Disabled_from_menu);
}
static bool settingsDisableMMUFromMenu()
{
if (mmu_enabled || MMU_Disabled_from_menu)
{
if (!MMU_Disabled_from_menu)
{
if (menu_item_function_P(_i("MMU [ENABLED]"), disable_mmu_switch)) return true;
}
else
{
if (menu_item_function_P(_i("MMU [DISABLED]"), disable_mmu_switch)) return true;
}
}
return false;
}
#define SETTINGS_DISABLE_MMU_FROM_MENU \
do\
{\
if(settingsDisableMMUFromMenu()) return;\
}\
while(0)\
#ifdef MMU_HAS_CUTTER
void lcd_cutter_enabled()
{
@ -4953,6 +4985,8 @@ static void lcd_settings_menu()
SETTINGS_AUTO_DEPLETE;
SETTINGS_DISABLE_MMU_FROM_MENU;
SETTINGS_CUTTER;
MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check);

View File

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