From 4dc5d97ca90c413eff87f9ba368975cda03b8557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 16 Jul 2023 13:36:20 +0000 Subject: [PATCH] power panic: remove unused EEPROM_UVLO_Z_MICROSTEPS It isn't very helpful IMO to have unused code during power panic it just complicates things. Change in memory: Flash: -32 bytes SRAM: 0 bytes --- Firmware/eeprom.h | 2 +- Firmware/power_panic.cpp | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 93a8b23da..aefc50628 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -430,7 +430,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_UVLO_FAN_SPEED (EEPROM_UVLO_FEEDRATE - 1) #define EEPROM_FAN_CHECK_ENABLED (EEPROM_UVLO_FAN_SPEED - 1) #define EEPROM_UVLO_MESH_BED_LEVELING (EEPROM_FAN_CHECK_ENABLED - 9*2) -#define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2) // uint16_t (could be removed) +#define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2) // uint16_t (unused) #define EEPROM_UVLO_E_ABS (EEPROM_UVLO_Z_MICROSTEPS - 1) #define EEPROM_UVLO_CURRENT_POSITION_E (EEPROM_UVLO_E_ABS - 4) //float for current position in E #define EEPROM_UVLO_SAVED_SEGMENT_IDX (EEPROM_UVLO_CURRENT_POSITION_E - 2) //uint16_t diff --git a/Firmware/power_panic.cpp b/Firmware/power_panic.cpp index 9dde1b42f..4e0704103 100644 --- a/Firmware/power_panic.cpp +++ b/Firmware/power_panic.cpp @@ -163,10 +163,8 @@ void uvlo_() { eeprom_update_word((uint16_t*)(EEPROM_UVLO_MESH_BED_LEVELING_FULL +2*mesh_point), *reinterpret_cast(&v)); } - // Write the _final_ Z position and motor microstep counter (unused). + // Write the _final_ Z position eeprom_update_float((float*)EEPROM_UVLO_TINY_CURRENT_POSITION_Z, current_position[Z_AXIS]); - z_microsteps = tmc2130_rd_MSCNT(Z_AXIS); - eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS), z_microsteps); // Store the current position. eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), saved_pos[X_AXIS]); @@ -267,10 +265,6 @@ static void uvlo_tiny() { // Update Z position eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]); - - // Update the _final_ Z motor microstep counter (unused). - z_microsteps = tmc2130_rd_MSCNT(Z_AXIS); - eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS), z_microsteps); } // Update the the "power outage" flag.