|
@@ -7322,16 +7322,6 @@ void recover_print(uint8_t automatic) {
|
|
|
enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure
|
|
|
}
|
|
|
enquecommand_P(PSTR("G1 E" STRINGIFY(-DEFAULT_RETRACTION)" F480"));
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
|
- {
|
|
|
- float extruder_abs_pos = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
- enquecommand_P(PSTR("M82")); //E axis abslute mode
|
|
|
-// current_position[E_AXIS] = extruder_abs_pos;
|
|
|
-// plan_set_e_position(extruder_abs_pos);
|
|
|
- sprintf_P(cmd, PSTR("G92 E"));
|
|
|
- dtostrf(extruder_abs_pos, 6, 3, cmd + strlen(cmd));
|
|
|
- enquecommand(cmd);
|
|
|
- }
|
|
|
|
|
|
// Mark the power panic status as inactive.
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
|
|
@@ -7355,6 +7345,7 @@ void recover_print(uint8_t automatic) {
|
|
|
|
|
|
void recover_machine_state_after_power_panic()
|
|
|
{
|
|
|
+ char cmd[30];
|
|
|
// 1) Recover the logical cordinates at the time of the power panic.
|
|
|
// The logical XY coordinates are needed to recover the machine Z coordinate corrected by the mesh bed leveling.
|
|
|
current_position[X_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0));
|
|
@@ -7363,6 +7354,13 @@ void recover_machine_state_after_power_panic()
|
|
|
// The current position after power panic is moved to the next closest 0th full step.
|
|
|
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
|
|
|
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
|
|
|
+ if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) {
|
|
|
+ current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
+ sprintf_P(cmd, PSTR("G92 E"));
|
|
|
+ dtostrf(current_position[E_AXIS], 6, 3, cmd + strlen(cmd));
|
|
|
+ enquecommand(cmd);
|
|
|
+ }
|
|
|
+
|
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
|
|
|
|
SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial ");
|
|
@@ -7468,6 +7466,11 @@ void restore_print_from_eeprom() {
|
|
|
// Set the feedrate saved at the power panic.
|
|
|
sprintf_P(cmd, PSTR("G1 F%d"), feedrate_rec);
|
|
|
enquecommand(cmd);
|
|
|
+ if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
|
+ {
|
|
|
+ float extruder_abs_pos = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
+ enquecommand_P(PSTR("M82")); //E axis abslute mode
|
|
|
+ }
|
|
|
// Set the fan speed saved at the power panic.
|
|
|
strcpy_P(cmd, PSTR("M106 S"));
|
|
|
strcat(cmd, itostr3(int(fan_speed_rec)));
|