From a53d15090333f8e427fdd389efbe04d4593329f5 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 6 Feb 2019 01:58:05 +0100 Subject: [PATCH] preHeat @ filament load / unload / autoLoad autoLoad option added --- Firmware/Marlin_main.cpp | 20 +++++++++++++++----- Firmware/ultralcd.cpp | 39 +++++++++++++++++++-------------------- Firmware/ultralcd.h | 6 ++++++ 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 869db774..4853a4e9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7468,7 +7468,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { - if (mcode_in_progress != 600) //M600 not in progress + if ((mcode_in_progress != 600) && (!bFilamentAutoloadFlag)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7486,10 +7486,20 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { - lcd_update_enable(false); - show_preheat_nozzle_warning(); - lcd_update_enable(true); - } + bFilamentLoad=true; // i.e. filament loading mode + bFilamentFirstRun=false; + bFilamentAutoloadFlag=true; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else + { + menu_submenu(mFilamentMenu); + lcd_timeoutToStatus.start(); + } + } } } else diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e0be62f7..f9e5d12c 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1781,6 +1781,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; + bFilamentAutoloadFlag=false; } //! @brief Pause print, disable nozzle heater, move to park position @@ -2299,6 +2300,7 @@ void lcd_set_filament_oq_meass() bool bFilamentFirstRun; bool bFilamentLoad; bool bFilamentPreheatState; +bool bFilamentAutoloadFlag; static void mFilamentPrompt() { @@ -2326,9 +2328,11 @@ if(lcd_clicked()) } else enquecommand_P(PSTR("M702")); // unload filament } +if(bFilamentLoad) // i.e. not necessary for preHeat @ unload + bFilamentAutoloadFlag=false; } -static void mFilamentItem(uint16_t nTemp) +void mFilamentItem(uint16_t nTemp) { static int nTargetOld; @@ -2353,6 +2357,8 @@ if(lcd_clicked()) } else setTargetHotend0((float)nTargetOld); menu_back(); + if(bFilamentLoad) // i.e. not necessary for preHeat @ unload + bFilamentAutoloadFlag=false; } else if(!isHeatingHotend0()) { @@ -2398,10 +2404,17 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP); } -static void mFilamentMenu() +void mFilamentBack() +{ +menu_back(); +if(bFilamentLoad) // i.e. not necessary for preHeat @ unload + bFilamentAutoloadFlag=false; +} + +void mFilamentMenu() { MENU_BEGIN(); -MENU_ITEM_BACK_P(_T(MSG_MAIN)); +MENU_ITEM_FUNCTION_P(_T(MSG_MAIN),mFilamentBack); MENU_ITEM_SUBMENU_P(PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)),mFilamentItem_PLA); MENU_ITEM_SUBMENU_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP)),mFilamentItem_PET); MENU_ITEM_SUBMENU_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP)),mFilamentItem_ABS); @@ -2634,23 +2647,9 @@ void lcd_load_filament_color_check() #ifdef FILAMENT_SENSOR static void lcd_menu_AutoLoadFilament() { - if (degHotend0() > EXTRUDE_MINTEMP) - { - uint8_t nlines; - lcd_display_message_fullscreen_nonBlocking_P(_i("Autoloading filament is active, just press the knob and insert filament..."),nlines);////MSG_AUTOLOADING_ENABLED c=20 r=4 - } - else - { - static_assert(sizeof(menu_data)>=sizeof(ShortTimer), "ShortTimer doesn't fit into menu_data"); - ShortTimer* ptimer = (ShortTimer*)&(menu_data[0]); - if (!ptimer->running()) ptimer->start(); - lcd_set_cursor(0, 0); - lcd_puts_P(_T(MSG_ERROR)); - lcd_set_cursor(0, 2); - lcd_puts_P(_T(MSG_PREHEAT_NOZZLE)); - if (ptimer->expired(2000ul)) menu_back(); - } - menu_back_if_clicked(); + uint8_t nlines; + lcd_display_message_fullscreen_nonBlocking_P(_i("Autoloading filament is active, just press the knob and insert filament..."),nlines);////MSG_AUTOLOADING_ENABLED c=20 r=4 + menu_back_if_clicked(); } #endif //FILAMENT_SENSOR diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 44bbf390..c692de53 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -133,6 +133,12 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); +extern bool bFilamentFirstRun; +extern bool bFilamentLoad; +extern bool bFilamentPreheatState; +extern bool bFilamentAutoloadFlag; +void mFilamentItem(uint16_t nTemp); +void mFilamentMenu(); void unload_filament(); void stack_error();