Browse Source

Merge remote-tracking branch 'upstream/MK3' into variants

PavelSindler 5 years ago
parent
commit
860e6f9994
3 changed files with 40 additions and 25 deletions
  1. 15 5
      Firmware/Marlin_main.cpp
  2. 19 20
      Firmware/ultralcd.cpp
  3. 6 0
      Firmware/ultralcd.h

+ 15 - 5
Firmware/Marlin_main.cpp

@@ -7482,7 +7482,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)
 			{
@@ -7502,10 +7502,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

+ 19 - 20
Firmware/ultralcd.cpp

@@ -1782,6 +1782,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
@@ -2300,6 +2301,7 @@ void lcd_set_filament_oq_meass()
 bool bFilamentFirstRun;
 bool bFilamentLoad;
 bool bFilamentPreheatState;
+bool bFilamentAutoloadFlag;
 
 static void mFilamentPrompt()
 {
@@ -2327,9 +2329,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;
 
@@ -2354,6 +2358,8 @@ if(lcd_clicked())
           }
      else setTargetHotend0((float)nTargetOld);
      menu_back();
+     if(bFilamentLoad)                            // i.e. not necessary for preHeat @ unload
+          bFilamentAutoloadFlag=false;
      }
 else if(!isHeatingHotend0())
           {
@@ -2399,10 +2405,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);
@@ -2636,23 +2649,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
 

+ 6 - 0
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();