Browse Source

More extra travel jerk changes

Co-Authored-By: josedpedroso <josedpedroso@users.noreply.github.com>
Scott Lahteine 4 years ago
parent
commit
263a7beeb5
1 changed files with 19 additions and 9 deletions
  1. 19
    9
      Marlin/src/module/planner.cpp

+ 19
- 9
Marlin/src/module/planner.cpp View File

2390
     // Start with a safe speed (from which the machine may halt to stop immediately).
2390
     // Start with a safe speed (from which the machine may halt to stop immediately).
2391
     float safe_speed = nominal_speed;
2391
     float safe_speed = nominal_speed;
2392
 
2392
 
2393
+    #ifdef TRAVEL_EXTRA_XYJERK
2394
+      const float extra_xyjerk = (de <= 0) ? TRAVEL_EXTRA_XYJERK : 0;
2395
+    #else
2396
+      constexpr float extra_xyjerk = 0;
2397
+    #endif
2398
+
2393
     uint8_t limited = 0;
2399
     uint8_t limited = 0;
2394
     #if HAS_LINEAR_E_JERK
2400
     #if HAS_LINEAR_E_JERK
2395
       LOOP_XYZ(i)
2401
       LOOP_XYZ(i)
2398
     #endif
2404
     #endif
2399
     {
2405
     {
2400
       const float jerk = ABS(current_speed[i]);   // cs : Starting from zero, change in speed for this axis
2406
       const float jerk = ABS(current_speed[i]);   // cs : Starting from zero, change in speed for this axis
2401
-
2402
-      float maxj = max_jerk[i];                   // mj : The max jerk setting for this axis
2403
-
2404
-      #ifdef TRAVEL_EXTRA_XYJERK
2405
-        if ((TRAVEL_EXTRA_XYJERK) && !de <= 0 && (i == X_AXIS || i == Y_AXIS))
2406
-          maxj += TRAVEL_EXTRA_XYJERK;            // Extra jerk allowance for travel moves
2407
-      #endif
2407
+                  maxj = (max_jerk[axis]          // mj : The max jerk setting for this axis
2408
+                    #ifdef TRAVEL_EXTRA_XYJERK
2409
+                      + (axis == X_AXIS || axis == Y_AXIS ? extra_xyjerk : 0)
2410
+                    #endif
2411
+                  );
2408
 
2412
 
2409
       if (jerk > maxj) {                          // cs > mj : New current speed too fast?
2413
       if (jerk > maxj) {                          // cs > mj : New current speed too fast?
2410
         if (limited) {                            // limited already?
2414
         if (limited) {                            // limited already?
2457
             : // v_exit <= v_entry                coasting             axis reversal
2461
             : // v_exit <= v_entry                coasting             axis reversal
2458
               ( (v_entry < 0 || v_exit > 0) ? (v_entry - v_exit) : _MAX(-v_exit, v_entry) );
2462
               ( (v_entry < 0 || v_exit > 0) ? (v_entry - v_exit) : _MAX(-v_exit, v_entry) );
2459
 
2463
 
2460
-        if (jerk > max_jerk[axis]) {
2461
-          v_factor *= max_jerk[axis] / jerk;
2464
+        const float maxj = (max_jerk[axis]
2465
+          #ifdef TRAVEL_EXTRA_XYJERK
2466
+            + (axis == X_AXIS || axis == Y_AXIS ? extra_xyjerk : 0)
2467
+          #endif
2468
+        );
2469
+
2470
+        if (jerk > maxj) {
2471
+          v_factor *= maxj / jerk;
2462
           ++limited;
2472
           ++limited;
2463
         }
2473
         }
2464
       }
2474
       }

Loading…
Cancel
Save