Browse Source

Merge pull request #1578 from mkbel/bad_load_cut

Bad load cut
PavelSindler 5 years ago
parent
commit
6fda306eab
6 changed files with 49 additions and 7 deletions
  1. 1 0
      Firmware/Marlin.h
  2. 0 1
      Firmware/Marlin_main.cpp
  3. 2 2
      Firmware/eeprom.h
  4. 6 0
      Firmware/mmu.cpp
  5. 0 2
      Firmware/temperature.cpp
  6. 40 2
      Firmware/ultralcd.cpp

+ 1 - 0
Firmware/Marlin.h

@@ -284,6 +284,7 @@ void setPwmFrequency(uint8_t pin, int val);
   #define CRITICAL_SECTION_END    SREG = _sreg;
 #endif //CRITICAL_SECTION_START
 
+extern bool fans_check_enabled;
 extern float homing_feedrate[];
 extern bool axis_relative_modes[];
 extern int feedmultiply;

+ 0 - 1
Firmware/Marlin_main.cpp

@@ -511,7 +511,6 @@ void servo_init()
 
 bool fans_check_enabled = true;
 
-
 #ifdef TMC2130
 
 extern int8_t CrashDetectMenu;

+ 2 - 2
Firmware/eeprom.h

@@ -153,9 +153,9 @@
 
 #define EEPROM_MMU_LOAD_FAIL_TOT (EEPROM_MMU_FAIL - 2) //uint16_t
 #define EEPROM_MMU_LOAD_FAIL (EEPROM_MMU_LOAD_FAIL_TOT - 1) //uint8_t
+#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1)
+#define EEPROM_UVLO_MESH_BED_LEVELING_FULL     (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion
 
-#define EEPROM_UVLO_MESH_BED_LEVELING_FULL     (EEPROM_MMU_LOAD_FAIL - 1000 - 12*12*2) //allow 12 calibration points for future expansion
-//-1000 is to be compatible with future updates from prusa if it not merged, real value is 2503 so there is space
 // !!!!!
 // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
 // !!!!!

+ 6 - 0
Firmware/mmu.cpp

@@ -1451,6 +1451,12 @@ void mmu_continue_loading()
 			if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
 			if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1);
 
+			if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
+			{
+			    mmu_command(MmuCmd::K0 + tmp_extruder);
+			    manage_response(true, true, MMU_UNLOAD_MOVE);
+			}
+
             mmu_command(MmuCmd::T0 + tmp_extruder);
             manage_response(true, true, MMU_TCODE_MOVE);
             load_more();

+ 0 - 2
Firmware/temperature.cpp

@@ -484,8 +484,6 @@ void countFanSpeed()
 	fan_edge_counter[1] = 0;
 }
 
-extern bool fans_check_enabled;
-
 void checkFanSpeed()
 {
 	uint8_t max_print_fan_errors = 0;

+ 40 - 2
Firmware/ultralcd.cpp

@@ -41,8 +41,6 @@
 #include "static_assert.h"
 #include "io_atmega2560.h"
 
-extern bool fans_check_enabled;
-
 
 int scrollstuff = 0;
 char longFilenameOLD[LONG_FILENAME_LENGTH];
@@ -201,6 +199,7 @@ static void fil_unload_menu();
 #endif // SNMM || SNMM_V2
 static void lcd_disable_farm_mode();
 static void lcd_set_fan_check();
+static void lcd_cutter_enabled();
 static char snmm_stop_print_menu();
 #ifdef SDCARD_SORT_ALPHA
  static void lcd_sort_type_set();
@@ -2294,6 +2293,18 @@ void lcd_set_fan_check() {
 	eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled);
 }
 
+void lcd_cutter_enabled()
+{
+    if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
+    {
+        eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0);
+    }
+    else
+    {
+        eeprom_update_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 1);
+    }
+}
+
 void lcd_set_filament_autoload() {
      fsensor_autoload_set(!fsensor_autoload_enabled);
 }
@@ -5193,6 +5204,29 @@ do\
 }\
 while(0)\
 
+static bool settingsCutter()
+{
+    if (mmu_enabled)
+    {
+        if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
+        {
+            if (menu_item_function_P(_i("Cutter       [on]"), lcd_cutter_enabled)) return true;//// c=17 r=1
+        }
+        else
+        {
+            if (menu_item_function_P(_i("Cutter      [off]"), lcd_cutter_enabled)) return true;//// c=17 r=1
+        }
+    }
+    return false;
+}
+
+#define SETTINGS_CUTTER \
+do\
+{\
+    if(settingsCutter()) return;\
+}\
+while(0)\
+
 #ifdef TMC2130
 #define SETTINGS_SILENT_MODE \
 do\
@@ -5316,6 +5350,8 @@ static void lcd_settings_menu()
 
 	SETTINGS_AUTO_DEPLETE;
 
+	SETTINGS_CUTTER;
+
 	if (fans_check_enabled == true)
 		MENU_ITEM_FUNCTION_P(_i("Fans check   [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1
 	else
@@ -6513,6 +6549,8 @@ static void lcd_tune_menu()
 
 	SETTINGS_AUTO_DEPLETE;
 
+	SETTINGS_CUTTER;
+
 #ifdef TMC2130
      if(!farm_mode)
      {