Implement the delayed-move technique

This commit is contained in:
Scott Lahteine 2016-04-03 18:06:17 -07:00
parent a3e25a0fca
commit 47b5c55c29
2 changed files with 8 additions and 6 deletions

View file

@ -189,6 +189,8 @@ class Planner {
*/ */
static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING) #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)

View file

@ -51,6 +51,7 @@
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
int8_t manual_move_axis = (int8_t)NO_AXIS; int8_t manual_move_axis = (int8_t)NO_AXIS;
millis_t manual_move_start_time = 0;
bool encoderRateMultiplierEnabled; bool encoderRateMultiplierEnabled;
int32_t lastEncoderMovementMillis; int32_t lastEncoderMovementMillis;
@ -1193,11 +1194,11 @@ static void lcd_prepare_menu() {
#endif // DELTA_CALIBRATION_MENU #endif // DELTA_CALIBRATION_MENU
/** /**
* If the manual move hasn't been fed to the planner yet, * If the most recent manual move hasn't been fed to the planner yet,
* and the planner can accept one, send immediately * and the planner can accept one, send immediately
*/ */
inline void manage_manual_move() { inline void manage_manual_move() {
if (manual_move_axis != (int8_t)NO_AXIS && !planner.planner_is_full()) { if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
#if ENABLED(DELTA) #if ENABLED(DELTA)
calculate_delta(current_position); calculate_delta(current_position);
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder);
@ -1209,13 +1210,12 @@ inline void manage_manual_move() {
} }
/** /**
* Set a flag that lcd_update() should send a move * Set a flag that lcd_update() should start a move
* to "current_position" at the next opportunity, * to "current_position" after a short delay.
* and try to send one now.
*/ */
inline void manual_move_to_current(AxisEnum axis) { inline void manual_move_to_current(AxisEnum axis) {
manual_move_start_time = millis() + 500UL; // 1/2 second delay
manual_move_axis = (int8_t)axis; manual_move_axis = (int8_t)axis;
manage_manual_move();
} }
/** /**