Browse Source

Save/restore K during a power panic

Yuri D'Elia 5 years ago
parent
commit
bca5618145
2 changed files with 8 additions and 0 deletions
  1. 6 0
      Firmware/Marlin_main.cpp
  2. 2 0
      Firmware/eeprom.h

+ 6 - 0
Firmware/Marlin_main.cpp

@@ -8801,6 +8801,9 @@ void uvlo_()
 #endif
 #endif
 	eeprom_update_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY), (uint16_t)extrudemultiply);
+#ifdef LIN_ADVANCE
+	eeprom_update_float((float*)(EEPROM_UVLO_LA_K), extruder_advance_K);
+#endif
 
     // Finaly store the "power outage" flag.
 	if(sd_print) eeprom_update_byte((uint8_t*)EEPROM_UVLO, 1);
@@ -9046,6 +9049,9 @@ void recover_machine_state_after_power_panic(bool bTiny)
 #endif
 #endif
   extrudemultiply = (int)eeprom_read_word((uint16_t*)(EEPROM_EXTRUDEMULTIPLY));
+#ifdef LIN_ADVANCE
+  extruder_advance_K = eeprom_read_float((float*)EEPROM_UVLO_LA_K);
+#endif
 }
 
 void restore_print_from_eeprom() {

+ 2 - 0
Firmware/eeprom.h

@@ -160,6 +160,8 @@
 #define EEPROM_MBL_POINTS_NR (EEPROM_MBL_MAGNET_ELIMINATION -1) //uint8_t number of points in one exis for mesh bed leveling
 #define EEPROM_MBL_PROBE_NR (EEPROM_MBL_POINTS_NR-1) //number of measurements for each point
 #define EEPROM_MMU_STEALTH (EEPROM_MBL_PROBE_NR-1)
+
+#define EEPROM_UVLO_LA_K (EEPROM_MMU_STEALTH-4) // float
 // !!!!!
 // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
 // !!!!!