Merge pull request #1880 from NotaRobotexe/power_panic
PFW-828 add uvlo tiny z positio back
This commit is contained in:
commit
1c619133a3
@ -1010,6 +1010,10 @@ void setup()
|
||||
{
|
||||
mmu_init();
|
||||
|
||||
#ifdef UVLO_SUPPORT
|
||||
setup_uvlo_interrupt();
|
||||
#endif //UVLO_SUPPORT
|
||||
|
||||
ultralcd_init();
|
||||
|
||||
#if (LCD_BL_PIN != -1) && defined (LCD_BL_PIN)
|
||||
@ -1298,10 +1302,6 @@ void setup()
|
||||
|
||||
#endif //TMC2130
|
||||
|
||||
#ifdef UVLO_SUPPORT
|
||||
setup_uvlo_interrupt();
|
||||
#endif //UVLO_SUPPORT
|
||||
|
||||
st_init(); // Initialize stepper, this enables interrupts!
|
||||
|
||||
#ifdef TMC2130
|
||||
@ -8692,7 +8692,6 @@ void serialecho_temperatures() {
|
||||
SERIAL_PROTOCOL_F(degBed(), 1);
|
||||
SERIAL_PROTOCOLLN("");
|
||||
}
|
||||
|
||||
extern uint32_t sdpos_atomic;
|
||||
#ifdef UVLO_SUPPORT
|
||||
|
||||
@ -8856,9 +8855,11 @@ disable_z();
|
||||
|
||||
// Finaly store the "power outage" flag.
|
||||
//if(sd_print)
|
||||
eeprom_update_byte((uint8_t*)EEPROM_UVLO,2);
|
||||
|
||||
eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps);
|
||||
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==1){
|
||||
eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]);
|
||||
eeprom_update_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS),z_microsteps);
|
||||
}
|
||||
eeprom_update_byte((uint8_t*)EEPROM_UVLO,2);
|
||||
|
||||
// Increment power failure counter
|
||||
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1);
|
||||
@ -8933,6 +8934,7 @@ void recover_print(uint8_t automatic) {
|
||||
char cmd[30];
|
||||
lcd_update_enable(true);
|
||||
lcd_update(2);
|
||||
lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1
|
||||
bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2);
|
||||
recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers
|
||||
// Lift the print head, so one may remove the excess priming material.
|
||||
@ -8970,8 +8972,7 @@ void recover_machine_state_after_power_panic(bool bTiny)
|
||||
// Recover the logical coordinate of the Z axis at the time of the power panic.
|
||||
// The current position after power panic is moved to the next closest 0th full step.
|
||||
if(bTiny){
|
||||
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) / cs.axis_steps_per_unit[Z_AXIS];
|
||||
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / cs.axis_steps_per_unit[Z_AXIS];
|
||||
}
|
||||
else{
|
||||
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
|
||||
@ -9084,7 +9085,7 @@ void restore_print_from_eeprom() {
|
||||
strcat_P(cmd, PSTR(" F2000"));
|
||||
enquecommand(cmd);
|
||||
// Move the Z axis down to the print, in logical coordinates.
|
||||
strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(current_position[Z_AXIS] - (UVLO_Z_AXIS_SHIFT +
|
||||
strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32( 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) / cs.axis_steps_per_unit[Z_AXIS])));
|
||||
enquecommand(cmd);
|
||||
// Unretract.
|
||||
|
Loading…
Reference in New Issue
Block a user