From bca5618145dcee174f01ba82aa66742f1bb5b173 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Mon, 3 Jun 2019 16:53:55 +0200 Subject: [PATCH] Save/restore K during a power panic --- Firmware/Marlin_main.cpp | 6 ++++++ Firmware/eeprom.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b9af28b7a..663d36e57 100644 --- a/Firmware/Marlin_main.cpp +++ b/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() { diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index c96e1d8db..624025e8b 100644 --- a/Firmware/eeprom.h +++ b/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 !!!!! // !!!!!