Merge pull request #2120 from mkbel/fix_power_panic_2

Fix power panic broken when PSU_Delta defined.
This commit is contained in:
DRracer 2019-08-19 19:06:15 +02:00 committed by GitHub
commit d44a46b349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 27 deletions

View File

@ -9607,7 +9607,6 @@ void uvlo_()
st_synchronize(); st_synchronize();
disable_e0(); disable_e0();
disable_z();
// Move Z up to the next 0th full step. // Move Z up to the next 0th full step.
// Write the file position. // Write the file position.
eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), sd_position); eeprom_update_dword((uint32_t*)(EEPROM_FILE_POSITION), sd_position);
@ -9646,8 +9645,6 @@ void uvlo_()
st_synchronize(); st_synchronize();
printf_P(_N("stps%d\n"), tmc2130_rd_MSCNT(Z_AXIS)); printf_P(_N("stps%d\n"), tmc2130_rd_MSCNT(Z_AXIS));
disable_z();
// Increment power failure counter // Increment power failure counter
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1); eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1);
@ -9686,7 +9683,6 @@ tmc2130_set_current_r(Z_AXIS, 20);
z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS);
#endif //TMC2130 #endif //TMC2130
planner_abort_hard(); planner_abort_hard();
disable_z();
//save current position only in case, where the printer is moving on Z axis, which is only when EEPROM_UVLO is 1 //save current position only in case, where the printer is moving on Z axis, which is only when EEPROM_UVLO is 1
//EEPROM_UVLO is 1 after normal uvlo or after recover_print(), when the extruder is moving on Z axis after rehome //EEPROM_UVLO is 1 after normal uvlo or after recover_print(), when the extruder is moving on Z axis after rehome
@ -10534,34 +10530,20 @@ if(!(bEnableForce_z||eeprom_read_byte((uint8_t*)EEPROM_SILENT)))
void disable_force_z() void disable_force_z()
{ {
uint16_t z_microsteps=0; uint16_t z_microsteps=0;
if(!bEnableForce_z) if(!bEnableForce_z) return; // motor already disabled (may be ;-p )
return; // motor already disabled (may be ;-p )
bEnableForce_z=false;
// alignment to full-step bEnableForce_z=false;
// switching to silent mode
#ifdef TMC2130 #ifdef TMC2130
z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); tmc2130_mode=TMC2130_MODE_SILENT;
#endif // TMC2130 update_mode_profile();
planner_abort_hard(); tmc2130_init(true);
sei();
plan_buffer_line(
current_position[X_AXIS],
current_position[Y_AXIS],
current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],
current_position[E_AXIS],
40, active_extruder);
st_synchronize();
// switching to silent mode
#ifdef TMC2130
tmc2130_mode=TMC2130_MODE_SILENT;
update_mode_profile();
tmc2130_init(true);
#endif // TMC2130 #endif // TMC2130
axis_known_position[Z_AXIS]=false; axis_known_position[Z_AXIS]=false;
} }