Browse Source

Store cutter enable state in EEPROM.

Marek Bel 6 years ago
parent
commit
02a692c5d9
5 changed files with 15 additions and 10 deletions
  1. 0 1
      Firmware/Marlin.h
  2. 0 2
      Firmware/Marlin_main.cpp
  3. 1 1
      Firmware/eeprom.h
  4. 1 1
      Firmware/mmu.cpp
  5. 13 5
      Firmware/ultralcd.cpp

+ 0 - 1
Firmware/Marlin.h

@@ -285,7 +285,6 @@ void setPwmFrequency(uint8_t pin, int val);
 #endif //CRITICAL_SECTION_START
 
 extern bool fans_check_enabled;
-extern bool cutter_enabled;
 extern float homing_feedrate[];
 extern bool axis_relative_modes[];
 extern int feedmultiply;

+ 0 - 2
Firmware/Marlin_main.cpp

@@ -510,8 +510,6 @@ void servo_init()
 
 
 bool fans_check_enabled = true;
-bool cutter_enabled = false;
-
 
 #ifdef TMC2130
 

+ 1 - 1
Firmware/eeprom.h

@@ -153,7 +153,7 @@
 
 #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)
 // !!!!!
 // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
 // !!!!!

+ 1 - 1
Firmware/mmu.cpp

@@ -1439,7 +1439,7 @@ 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 (cutter_enabled)
+			if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
 			{
 			    mmu_command(MmuCmd::K0 + tmp_extruder);
 			    manage_response(true, true, MMU_UNLOAD_MOVE);

+ 13 - 5
Firmware/ultralcd.cpp

@@ -2293,8 +2293,16 @@ void lcd_set_fan_check() {
 	eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED, fans_check_enabled);
 }
 
-void lcd_cutter_enabled() {
-    cutter_enabled = !cutter_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() {
@@ -5212,10 +5220,10 @@ static void lcd_settings_menu()
 
 	SETTINGS_AUTO_DEPLETE;
 
-    if (cutter_enabled == true)
-        MENU_ITEM_FUNCTION_P(_i("Cutter       [on]"), lcd_cutter_enabled);////MSG_FANS_CHECK_ON c=17 r=1
+    if (1 == eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED))
+        MENU_ITEM_FUNCTION_P(_i("Cutter       [on]"), lcd_cutter_enabled);//// c=17 r=1
     else
-        MENU_ITEM_FUNCTION_P(_i("Cutter      [off]"), lcd_cutter_enabled);////MSG_FANS_CHECK_OFF c=17 r=1
+        MENU_ITEM_FUNCTION_P(_i("Cutter      [off]"), lcd_cutter_enabled);//// c=17 r=1
 
 	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