Improve Power-loss Recovery (#15135)

This commit is contained in:
Scott Lahteine
2019-09-10 18:52:41 -05:00
committed by GitHub
parent 75927e17dd
commit c590e8ac05
9 changed files with 87 additions and 32 deletions

View File

@ -96,6 +96,10 @@
#include "../feature/backlash.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../feature/power_loss_recovery.h"
#endif
// Delay for delivery of first block to the stepper ISR, if the queue contains 2 or
// fewer movements. The delay is measured in milliseconds, and must be less than 250ms
#define BLOCK_DELAY_FOR_1ST_MOVE 100
@ -2507,6 +2511,10 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
mixer.gradient_control(target_float[Z_AXIS]);
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
block->sdpos = recovery.command_sdpos();
#endif
// Movement was accepted
return true;
} // _populate_block()

View File

@ -159,6 +159,10 @@ typedef struct block_t {
uint32_t segment_time_us;
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
uint32_t sdpos;
#endif
} block_t;
#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX)

View File

@ -121,6 +121,10 @@ Stepper stepper; // Singleton
#include "../libs/L6470/L6470_Marlin.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../feature/power_loss_recovery.h"
#endif
// public:
#if HAS_EXTRA_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN)
@ -1663,6 +1667,10 @@ uint32_t Stepper::stepper_block_phase_isr() {
return interval; // No more queued movements!
}
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.info.sdpos = current_block->sdpos;
#endif
// Flag all moving axes for proper endstop handling
#if IS_CORE