|
@@ -10778,12 +10778,15 @@ void recover_print(uint8_t automatic) {
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
|
|
|
|
enquecommand_P(PSTR("M83")); //E axis relative mode
|
|
enquecommand_P(PSTR("M83")); //E axis relative mode
|
|
- //enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure
|
|
|
|
- // If not automatically recoreverd (long power loss), extrude extra filament to stabilize
|
|
|
|
- if(automatic == 0){
|
|
|
|
- enquecommand_P(PSTR("G1 E5 F120")); //Extrude some filament to stabilize pessure
|
|
|
|
- }
|
|
|
|
- enquecommand_P(PSTR("G1 E" STRINGIFY(-default_retraction)" F480"));
|
|
|
|
|
|
+
|
|
|
|
+ // If not automatically recoreverd (long power loss)
|
|
|
|
+ if(automatic == 0){
|
|
|
|
+ //Extrude some filament to stabilize the pressure
|
|
|
|
+ enquecommand_P(PSTR("G1 E5 F120"));
|
|
|
|
+ // Retract to be consistent with a short pause
|
|
|
|
+ sprintf_P(cmd, PSTR("G1 E%-0.3f F2700"), default_retraction);
|
|
|
|
+ enquecommand(cmd);
|
|
|
|
+ }
|
|
|
|
|
|
printf_P(_N("After waiting for temp:\nCurrent pos X_AXIS:%.3f\nCurrent pos Y_AXIS:%.3f\n"), current_position[X_AXIS], current_position[Y_AXIS]);
|
|
printf_P(_N("After waiting for temp:\nCurrent pos X_AXIS:%.3f\nCurrent pos Y_AXIS:%.3f\n"), current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
|
|
|
@@ -10794,7 +10797,6 @@ void recover_print(uint8_t automatic) {
|
|
|
|
|
|
void recover_machine_state_after_power_panic(bool bTiny)
|
|
void recover_machine_state_after_power_panic(bool bTiny)
|
|
{
|
|
{
|
|
- char cmd[30];
|
|
|
|
// 1) Recover the logical cordinates at the time of the power panic.
|
|
// 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.
|
|
// 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));
|
|
current_position[X_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0));
|
|
@@ -10829,12 +10831,9 @@ void recover_machine_state_after_power_panic(bool bTiny)
|
|
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS))
|
|
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS))
|
|
+ 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS];
|
|
+ 7) >> 4) / cs.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);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ // Recover last E axis position
|
|
|
|
+ current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
|
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
|
|
|
|
@@ -10929,8 +10928,6 @@ void restore_print_from_eeprom() {
|
|
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
|
|
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
|
|
SERIAL_ECHOPGM("Position read from eeprom:");
|
|
SERIAL_ECHOPGM("Position read from eeprom:");
|
|
MYSERIAL.println(position);
|
|
MYSERIAL.println(position);
|
|
- // E axis relative mode.
|
|
|
|
- enquecommand_P(PSTR("M83"));
|
|
|
|
// Move to the XY print position in logical coordinates, where the print has been killed.
|
|
// Move to the XY print position in logical coordinates, where the print has been killed.
|
|
strcpy_P(cmd, PSTR("G1 X")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0))));
|
|
strcpy_P(cmd, PSTR("G1 X")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0))));
|
|
strcat_P(cmd, PSTR(" Y")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4))));
|
|
strcat_P(cmd, PSTR(" Y")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4))));
|
|
@@ -10942,16 +10939,20 @@ void restore_print_from_eeprom() {
|
|
strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z))));
|
|
strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z))));
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
// Unretract.
|
|
// Unretract.
|
|
- enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480"));
|
|
|
|
|
|
+ sprintf_P(cmd, PSTR("G1 E%0.3f F2700"), default_retraction);
|
|
|
|
+ enquecommand(cmd);
|
|
|
|
+ // Recover final E axis position and mode
|
|
|
|
+ float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
|
+ sprintf_P(cmd, PSTR("G92 E"));
|
|
|
|
+ dtostrf(pos_e, 6, 3, cmd + strlen(cmd));
|
|
|
|
+ enquecommand(cmd);
|
|
|
|
+ if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
|
|
+ enquecommand_P(PSTR("M82")); //E axis abslute mode
|
|
// Set the feedrates saved at the power panic.
|
|
// Set the feedrates saved at the power panic.
|
|
sprintf_P(cmd, PSTR("G1 F%d"), feedrate_rec);
|
|
sprintf_P(cmd, PSTR("G1 F%d"), feedrate_rec);
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
sprintf_P(cmd, PSTR("M220 S%d"), feedmultiply_rec);
|
|
sprintf_P(cmd, PSTR("M220 S%d"), feedmultiply_rec);
|
|
enquecommand(cmd);
|
|
enquecommand(cmd);
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS))
|
|
|
|
- {
|
|
|
|
- enquecommand_P(PSTR("M82")); //E axis abslute mode
|
|
|
|
- }
|
|
|
|
// Set the fan speed saved at the power panic.
|
|
// Set the fan speed saved at the power panic.
|
|
strcpy_P(cmd, PSTR("M106 S"));
|
|
strcpy_P(cmd, PSTR("M106 S"));
|
|
strcat(cmd, itostr3(int(fan_speed_rec)));
|
|
strcat(cmd, itostr3(int(fan_speed_rec)));
|