From be0ed46335353542ce8e9da6cc8a8c668d7a90d7 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Fri, 22 Feb 2019 03:09:50 +0100 Subject: [PATCH 1/3] preHeat @ filament management another funcionality III --- Firmware/Marlin_main.cpp | 9 +++- Firmware/ultralcd.cpp | 108 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fc53b2049..7cfeec82e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7482,7 +7482,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active +//-// if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active + if (mcode_in_progress != 600) //M600 not in progress { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7491,6 +7492,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef PAT9125 fsensor_autoload_check_stop(); #endif //PAT9125 +//-// if (degHotend0() > EXTRUDE_MINTEMP) { if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) @@ -7502,6 +7504,10 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { + lcd_update_enable(false); + show_preheat_nozzle_warning(); + lcd_update_enable(true); +/* eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) @@ -7514,6 +7520,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s menu_submenu(mFilamentMenu); lcd_timeoutToStatus.start(); } +*/ } } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f6502cef9..90b74ec0d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2307,6 +2307,7 @@ eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized bool bFilamentFirstRun; bool bFilamentPreheatState; bool bFilamentAction=false; +bool bFilamentWaitingFlag=false; static void mFilamentPrompt() { @@ -2338,14 +2339,14 @@ if(lcd_clicked()) if(!bFilamentPreheatState) { nLevel++; -// setTargetHotend0(0.0); // uncoment if return to base state is required +// setTargetHotend0(0.0); // uncoment if return to base-state is required } menu_back(nLevel); switch(eFilamentAction) { case e_FILAMENT_ACTION_Load: case e_FILAMENT_ACTION_autoLoad: - loading_flag = true; + loading_flag=true; enquecommand_P(PSTR("M701")); // load filament break; case e_FILAMENT_ACTION_unLoad: @@ -2378,7 +2379,8 @@ if(lcd_clicked()) } } -void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) +/* +void _mFilamentItem(uint16_t nTemp,uint16_t nTempBed) { static int nTargetOld,nTargetBedOld; uint8_t nLevel; @@ -2468,6 +2470,106 @@ else { else bBeep=true; } } +*/ + +void mFilamentItem(uint16_t nTemp,uint16_t nTempBed) +{ +static int nTargetOld,nTargetBedOld; +uint8_t nLevel; + +//if(bPreheatState) // not necessary + nTargetOld=target_temperature[0]; + nTargetBedOld=target_temperature_bed; +setTargetHotend0((float)nTemp); +setTargetBed((float)nTempBed); +lcd_timeoutToStatus.stop(); +if(current_temperature[0]>(target_temperature[0]*0.95)) + { + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_unLoad: + if(bFilamentWaitingFlag) + menu_submenu(mFilamentPrompt); + else { + nLevel=bFilamentPreheatState?1:2; + menu_back(nLevel); + if((eFilamentAction==e_FILAMENT_ACTION_Load)||(eFilamentAction==e_FILAMENT_ACTION_autoLoad)) + { + loading_flag=true; + enquecommand_P(PSTR("M701")); // load filament + } + if(eFilamentAction==e_FILAMENT_ACTION_unLoad) + enquecommand_P(PSTR("M702")); // unload filament + } +//./if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) +//./ eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + break; + case e_FILAMENT_ACTION_mmuLoad: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + nLevel=bFilamentPreheatState?1:2; + bFilamentAction=true; + menu_back(nLevel); + menu_submenu(mmu_fil_eject_menu); + break; + } + if(bFilamentWaitingFlag) + Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); + bFilamentWaitingFlag=false; + } +else { + bFilamentWaitingFlag=true; + lcd_set_cursor(0,0); + lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); + lcd_set_cursor(0,1); + switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 + break; + } + lcd_set_cursor(0,3); + lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 + if(lcd_clicked()) + { + bFilamentWaitingFlag=false; + if(!bFilamentPreheatState) + { + setTargetHotend0(0.0); + setTargetBed(0.0); + menu_back(); + } + else { + setTargetHotend0((float)nTargetOld); + setTargetBed((float)nTargetBedOld); + } + menu_back(); + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad + } + } +} static void mFilamentItem_PLA() { From ff35119ef30f5dc1be813fabf17157b37322d497 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 26 Feb 2019 17:33:37 +0100 Subject: [PATCH 2/3] preHeat @ filament management another funcionality III / autoLoad --- Firmware/Marlin_main.cpp | 15 ++++++++------- Firmware/ultralcd.cpp | 9 +++++++-- Firmware/ultralcd.h | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7cfeec82e..b0f1e633e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7482,8 +7482,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { -//-// if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active - if (mcode_in_progress != 600) //M600 not in progress +//-// if (mcode_in_progress != 600) //M600 not in progress + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //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) { @@ -7492,8 +7492,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef PAT9125 fsensor_autoload_check_stop(); #endif //PAT9125 -//-// - if (degHotend0() > EXTRUDE_MINTEMP) +//-// if (degHotend0() > EXTRUDE_MINTEMP) +if(0) { if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) _tone(BEEPER, 1000); @@ -7504,23 +7504,24 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { +/* lcd_update_enable(false); show_preheat_nozzle_warning(); lcd_update_enable(true); -/* +*/ eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); +// mFilamentItem(target_temperature[0],target_temperature_bed); + menu_submenu(mFilamentItemForce); } else { menu_submenu(mFilamentMenu); lcd_timeoutToStatus.start(); } -*/ } } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 90b74ec0d..5a04796f7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2499,12 +2499,12 @@ if(current_temperature[0]>(target_temperature[0]*0.95)) { loading_flag=true; enquecommand_P(PSTR("M701")); // load filament + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } if(eFilamentAction==e_FILAMENT_ACTION_unLoad) enquecommand_P(PSTR("M702")); // unload filament } -//./if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) -//./ eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad break; case e_FILAMENT_ACTION_mmuLoad: nLevel=bFilamentPreheatState?1:2; @@ -2628,6 +2628,11 @@ MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRI MENU_END(); } +void mFilamentItemForce() +{ +mFilamentItem(target_temperature[0],target_temperature_bed); +} + void lcd_unLoadFilament() { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index dd1132f86..c407bbed3 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -140,6 +140,7 @@ extern bool bFilamentFirstRun; extern bool bFilamentPreheatState; extern bool bFilamentAction; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); +void mFilamentItemForce(); void mFilamentMenu(); void unload_filament(); From 2f1e9685634462714de1244eaf2420be349affad Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 26 Feb 2019 23:17:52 +0100 Subject: [PATCH 3/3] "lcd_update_enable()" replacement --- Firmware/mmu.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..08bfd845c 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1044,6 +1044,16 @@ else { } } +//-// +void extr_unload_view() +{ +lcd_clear(); +lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); +lcd_print(" "); +if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); +else lcd_print(mmu_extruder + 1); +} + void extr_unload() { //unload just current filament for multimaterial printers #ifdef SNMM @@ -1058,12 +1068,15 @@ void extr_unload() st_synchronize(); //show which filament is currently unloaded - lcd_update_enable(false); +//-// lcd_update_enable(false); +menu_submenu(extr_unload_view); +/* lcd_clear(); lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_UNLOADING_FILAMENT)); lcd_print(" "); if (mmu_extruder == MMU_FILAMENT_UNKNOWN) lcd_print(" "); else lcd_print(mmu_extruder + 1); +*/ mmu_filament_ramming(); @@ -1071,7 +1084,8 @@ void extr_unload() // get response manage_response(false, true, MMU_UNLOAD_MOVE); - lcd_update_enable(true); +//-// lcd_update_enable(true); +menu_back(); #else //SNMM lcd_clear();