Browse Source

Implement the delayed-move technique

Scott Lahteine 8 years ago
parent
commit
47b5c55c29
2 changed files with 8 additions and 6 deletions
  1. 2
    0
      Marlin/planner.h
  2. 6
    6
      Marlin/ultralcd.cpp

+ 2
- 0
Marlin/planner.h View File

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

+ 6
- 6
Marlin/ultralcd.cpp View File

@@ -51,6 +51,7 @@
51 51
 int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
52 52
 
53 53
 int8_t manual_move_axis = (int8_t)NO_AXIS;
54
+millis_t manual_move_start_time = 0;
54 55
 
55 56
 bool encoderRateMultiplierEnabled;
56 57
 int32_t lastEncoderMovementMillis;
@@ -1193,11 +1194,11 @@ static void lcd_prepare_menu() {
1193 1194
 #endif // DELTA_CALIBRATION_MENU
1194 1195
 
1195 1196
 /**
1196
- * If the manual move hasn't been fed to the planner yet,
1197
+ * If the most recent manual move hasn't been fed to the planner yet,
1197 1198
  * and the planner can accept one, send immediately
1198 1199
  */
1199 1200
 inline void manage_manual_move() {
1200
-  if (manual_move_axis != (int8_t)NO_AXIS && !planner.planner_is_full()) {
1201
+  if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
1201 1202
     #if ENABLED(DELTA)
1202 1203
       calculate_delta(current_position);
1203 1204
       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() {
1209 1210
 }
1210 1211
 
1211 1212
 /**
1212
- * Set a flag that lcd_update() should send a move
1213
- * to "current_position" at the next opportunity,
1214
- * and try to send one now.
1213
+ * Set a flag that lcd_update() should start a move
1214
+ * to "current_position" after a short delay.
1215 1215
  */
1216 1216
 inline void manual_move_to_current(AxisEnum axis) {
1217
+  manual_move_start_time = millis() + 500UL; // 1/2 second delay
1217 1218
   manual_move_axis = (int8_t)axis;
1218
-  manage_manual_move();
1219 1219
 }
1220 1220
 
1221 1221
 /**

Loading…
Cancel
Save