🚸 Fix, Improve Power-Loss Recovery (#22828)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
MOHAMMAD RASIM
2022-02-09 21:29:34 +03:00
committed by Scott Lahteine
parent 11071c7472
commit 3e18cf2b6a
8 changed files with 51 additions and 28 deletions

View File

@ -2809,9 +2809,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
position = target; // Update the position
#if ENABLED(POWER_LOSS_RECOVERY)
block->sdpos = recovery.command_sdpos();
block->start_position = position_float.asLogical();
#endif
TERN_(HAS_POSITION_FLOAT, position_float = target_float);
TERN_(GRADIENT_MIX, mixer.gradient_control(target_float.z));
TERN_(POWER_LOSS_RECOVERY, block->sdpos = recovery.command_sdpos());
return true; // Movement was accepted

View File

@ -244,6 +244,7 @@ typedef struct block_t {
#if ENABLED(POWER_LOSS_RECOVERY)
uint32_t sdpos;
xyze_pos_t start_position;
#endif
#if ENABLED(LASER_POWER_INLINE)
@ -252,7 +253,7 @@ typedef struct block_t {
} block_t;
#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL)
#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY)
#define HAS_POSITION_FLOAT 1
#endif

View File

@ -2151,7 +2151,10 @@ uint32_t Stepper::block_phase_isr() {
cutter.apply_power(current_block->cutter_power);
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.info.sdpos = current_block->sdpos);
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.info.sdpos = current_block->sdpos;
recovery.info.current_position = current_block->start_position;
#endif
#if ENABLED(DIRECT_STEPPING)
if (IS_PAGE(current_block)) {