Selaa lähdekoodia

Merge pull request #7128 from thinkyhead/bf_enhanced_arcs

Enhance G2/G3 with 'P' and G17/G18/G19 Plane Select
Scott Lahteine 8 vuotta sitten
vanhempi
commit
ebe6719e12
34 muutettua tiedostoa jossa 420 lisäystä ja 175 poistoa
  1. 2
    2
      .travis.yml
  2. 3
    0
      Marlin/Conditionals_LCD.h
  3. 10
    4
      Marlin/Configuration_adv.h
  4. 3
    3
      Marlin/Marlin.h
  5. 130
    47
      Marlin/Marlin_main.cpp
  6. 13
    2
      Marlin/enum.h
  7. 10
    4
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  8. 10
    4
      Marlin/example_configurations/Felix/Configuration_adv.h
  9. 10
    4
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h
  10. 10
    4
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  11. 10
    4
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  12. 10
    4
      Marlin/example_configurations/K8200/Configuration_adv.h
  13. 10
    4
      Marlin/example_configurations/K8400/Configuration_adv.h
  14. 10
    4
      Marlin/example_configurations/M150/Configuration_adv.h
  15. 10
    4
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  16. 10
    4
      Marlin/example_configurations/SCARA/Configuration_adv.h
  17. 10
    4
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  18. 10
    4
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  19. 10
    4
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  20. 10
    4
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  21. 10
    4
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  22. 10
    4
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  23. 10
    4
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  24. 10
    4
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  25. 10
    4
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  26. 10
    4
      Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h
  27. 10
    4
      Marlin/example_configurations/makibox/Configuration_adv.h
  28. 10
    4
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  29. 10
    4
      Marlin/example_configurations/wt150/Configuration_adv.h
  30. 21
    17
      Marlin/pinsDebug.h
  31. 2
    2
      Marlin/planner.cpp
  32. 3
    3
      Marlin/temperature.cpp
  33. 2
    2
      Marlin/temperature.h
  34. 1
    1
      Marlin/ultralcd.cpp

+ 2
- 2
.travis.yml Näytä tiedosto

72
   - build_marlin
72
   - build_marlin
73
   #
73
   #
74
   # Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4
74
   # Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4
75
-  #  plus a "Fix Mounted" Probe with Safe Homing
75
+  #  plus a "Fix Mounted" Probe with Safe Homing and some arc options
76
   #
76
   #
77
   - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
77
   - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
78
   - opt_set EXTRUDERS 2
78
   - opt_set EXTRUDERS 2
79
   - opt_set TEMP_SENSOR_0 -2
79
   - opt_set TEMP_SENSOR_0 -2
80
   - opt_set TEMP_SENSOR_1 1
80
   - opt_set TEMP_SENSOR_1 1
81
   - opt_set TEMP_SENSOR_BED 1
81
   - opt_set TEMP_SENSOR_BED 1
82
-  - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING
82
+  - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES
83
   - build_marlin
83
   - build_marlin
84
   #
84
   #
85
   # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE
85
   # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE

+ 3
- 0
Marlin/Conditionals_LCD.h Näytä tiedosto

108
 
108
 
109
   #if ENABLED(REPRAPWORLD_KEYPAD)
109
   #if ENABLED(REPRAPWORLD_KEYPAD)
110
     #define NEWPANEL
110
     #define NEWPANEL
111
+    #if ENABLED(ULTIPANEL) && !defined(REPRAPWORLD_KEYPAD_MOVE_STEP)
112
+      #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
113
+    #endif
111
   #endif
114
   #endif
112
 
115
 
113
   #if ENABLED(RA_CONTROL_PANEL)
116
   #if ENABLED(RA_CONTROL_PANEL)

+ 10
- 4
Marlin/Configuration_adv.h Näytä tiedosto

678
 
678
 
679
 // @section extras
679
 // @section extras
680
 
680
 
681
-// Arc interpretation settings:
682
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
683
-#define MM_PER_ARC_SEGMENT 1
684
-#define N_ARC_CORRECTION 25
681
+//
682
+// G2/G3 Arc Support
683
+//
684
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
685
+#if ENABLED(ARC_SUPPORT)
686
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
687
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
688
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
689
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
690
+#endif
685
 
691
 
686
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 //#define BEZIER_CURVE_SUPPORT
693
 //#define BEZIER_CURVE_SUPPORT

+ 3
- 3
Marlin/Marlin.h Näytä tiedosto

370
   extern bool filament_sensor;         // Flag that filament sensor readings should control extrusion
370
   extern bool filament_sensor;         // Flag that filament sensor readings should control extrusion
371
   extern float filament_width_nominal, // Theoretical filament diameter i.e., 3.00 or 1.75
371
   extern float filament_width_nominal, // Theoretical filament diameter i.e., 3.00 or 1.75
372
                filament_width_meas;    // Measured filament diameter
372
                filament_width_meas;    // Measured filament diameter
373
-  extern int8_t measurement_delay[];   // Ring buffer to delay measurement
374
-  extern int filwidth_delay_index[2];  // Ring buffer indexes. Used by planner, temperature, and main code
375
-  extern int meas_delay_cm;            // Delay distance
373
+  extern uint8_t meas_delay_cm,        // Delay distance
374
+                 measurement_delay[];  // Ring buffer to delay measurement
375
+  extern int8_t filwidth_delay_index[2]; // Ring buffer indexes. Used by planner, temperature, and main code
376
 #endif
376
 #endif
377
 
377
 
378
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
378
 #if ENABLED(ADVANCED_PAUSE_FEATURE)

+ 130
- 47
Marlin/Marlin_main.cpp Näytä tiedosto

54
  * G10  - Retract filament according to settings of M207
54
  * G10  - Retract filament according to settings of M207
55
  * G11  - Retract recover filament according to settings of M208
55
  * G11  - Retract recover filament according to settings of M208
56
  * G12  - Clean tool
56
  * G12  - Clean tool
57
+ * G17  - Select Plane XY (Requires CNC_WORKSPACE_PLANES)
58
+ * G18  - Select Plane ZX (Requires CNC_WORKSPACE_PLANES)
59
+ * G19  - Select Plane YZ (Requires CNC_WORKSPACE_PLANES)
57
  * G20  - Set input units to inches
60
  * G20  - Set input units to inches
58
  * G21  - Set input units to millimeters
61
  * G21  - Set input units to millimeters
59
  * G26  - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION)
62
  * G26  - Mesh Validation Pattern (Requires UBL_G26_MESH_VALIDATION)
73
  * "M" Codes
76
  * "M" Codes
74
  *
77
  *
75
  * M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
78
  * M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
76
- * M1   - Same as M0
79
+ * M1   -> M0
77
  * M3   - Turn laser/spindle on, set spindle/laser speed/power, set rotation to clockwise
80
  * M3   - Turn laser/spindle on, set spindle/laser speed/power, set rotation to clockwise
78
  * M4   - Turn laser/spindle on, set spindle/laser speed/power, set rotation to counter-clockwise
81
  * M4   - Turn laser/spindle on, set spindle/laser speed/power, set rotation to counter-clockwise
79
  * M5   - Turn laser/spindle off
82
  * M5   - Turn laser/spindle off
630
   bool filament_sensor = false;                                 // M405 turns on filament sensor control. M406 turns it off.
633
   bool filament_sensor = false;                                 // M405 turns on filament sensor control. M406 turns it off.
631
   float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA,  // Nominal filament width. Change with M404.
634
   float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA,  // Nominal filament width. Change with M404.
632
         filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA;    // Measured filament diameter
635
         filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA;    // Measured filament diameter
633
-  int8_t measurement_delay[MAX_MEASUREMENT_DELAY + 1];          // Ring buffer to delayed measurement. Store extruder factor after subtracting 100
634
-  int filwidth_delay_index[2] = { 0, -1 };                      // Indexes into ring buffer
635
-  int meas_delay_cm = MEASUREMENT_DELAY_CM;                     // Distance delay setting
636
+  uint8_t meas_delay_cm = MEASUREMENT_DELAY_CM,                 // Distance delay setting
637
+          measurement_delay[MAX_MEASUREMENT_DELAY + 1];         // Ring buffer to delayed measurement. Store extruder factor after subtracting 100
638
+  int8_t filwidth_delay_index[2] = { 0, -1 };                   // Indexes into ring buffer
636
 #endif
639
 #endif
637
 
640
 
638
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
641
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
688
   millis_t lastUpdateMillis;
691
   millis_t lastUpdateMillis;
689
 #endif
692
 #endif
690
 
693
 
694
+#if ENABLED(CNC_WORKSPACE_PLANES)
695
+  static WorkspacePlane workspace_plane = PLANE_XY;
696
+#endif
697
+
691
 FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
698
 FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
692
 FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
699
 FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
693
 
700
 
3264
  *    X or Y must differ from the current XY.
3271
  *    X or Y must differ from the current XY.
3265
  *    Mixing R with I or J will throw an error.
3272
  *    Mixing R with I or J will throw an error.
3266
  *
3273
  *
3274
+ *  - P specifies the number of full circles to do
3275
+ *    before the specified arc move.
3276
+ *
3267
  *  Examples:
3277
  *  Examples:
3268
  *
3278
  *
3269
  *    G2 I10           ; CW circle centered at X+10
3279
  *    G2 I10           ; CW circle centered at X+10
3270
  *    G3 X20 Y12 R14   ; CCW circle with r=14 ending at X20 Y12
3280
  *    G3 X20 Y12 R14   ; CCW circle with r=14 ending at X20 Y12
3271
  */
3281
  */
3272
 #if ENABLED(ARC_SUPPORT)
3282
 #if ENABLED(ARC_SUPPORT)
3283
+
3273
   inline void gcode_G2_G3(bool clockwise) {
3284
   inline void gcode_G2_G3(bool clockwise) {
3274
     if (IsRunning()) {
3285
     if (IsRunning()) {
3275
 
3286
 
3287
       float arc_offset[2] = { 0.0, 0.0 };
3298
       float arc_offset[2] = { 0.0, 0.0 };
3288
       if (parser.seen('R')) {
3299
       if (parser.seen('R')) {
3289
         const float r = parser.value_linear_units(),
3300
         const float r = parser.value_linear_units(),
3290
-                    x1 = current_position[X_AXIS], y1 = current_position[Y_AXIS],
3291
-                    x2 = destination[X_AXIS], y2 = destination[Y_AXIS];
3292
-        if (r && (x2 != x1 || y2 != y1)) {
3301
+                    p1 = current_position[X_AXIS], q1 = current_position[Y_AXIS],
3302
+                    p2 = destination[X_AXIS], q2 = destination[Y_AXIS];
3303
+        if (r && (p2 != p1 || q2 != q1)) {
3293
           const float e = clockwise ^ (r < 0) ? -1 : 1,           // clockwise -1/1, counterclockwise 1/-1
3304
           const float e = clockwise ^ (r < 0) ? -1 : 1,           // clockwise -1/1, counterclockwise 1/-1
3294
-                      dx = x2 - x1, dy = y2 - y1,                 // X and Y differences
3305
+                      dx = p2 - p1, dy = q2 - q1,                 // X and Y differences
3295
                       d = HYPOT(dx, dy),                          // Linear distance between the points
3306
                       d = HYPOT(dx, dy),                          // Linear distance between the points
3296
                       h = SQRT(sq(r) - sq(d * 0.5)),              // Distance to the arc pivot-point
3307
                       h = SQRT(sq(r) - sq(d * 0.5)),              // Distance to the arc pivot-point
3297
-                      mx = (x1 + x2) * 0.5, my = (y1 + y2) * 0.5, // Point between the two points
3308
+                      mx = (p1 + p2) * 0.5, my = (q1 + q2) * 0.5, // Point between the two points
3298
                       sx = -dy / d, sy = dx / d,                  // Slope of the perpendicular bisector
3309
                       sx = -dy / d, sy = dx / d,                  // Slope of the perpendicular bisector
3299
                       cx = mx + e * h * sx, cy = my + e * h * sy; // Pivot-point of the arc
3310
                       cx = mx + e * h * sx, cy = my + e * h * sy; // Pivot-point of the arc
3300
-          arc_offset[X_AXIS] = cx - x1;
3301
-          arc_offset[Y_AXIS] = cy - y1;
3311
+          arc_offset[0] = cx - p1;
3312
+          arc_offset[1] = cy - q1;
3302
         }
3313
         }
3303
       }
3314
       }
3304
       else {
3315
       else {
3305
-        if (parser.seen('I')) arc_offset[X_AXIS] = parser.value_linear_units();
3306
-        if (parser.seen('J')) arc_offset[Y_AXIS] = parser.value_linear_units();
3316
+        if (parser.seen('I')) arc_offset[0] = parser.value_linear_units();
3317
+        if (parser.seen('J')) arc_offset[1] = parser.value_linear_units();
3307
       }
3318
       }
3308
 
3319
 
3309
       if (arc_offset[0] || arc_offset[1]) {
3320
       if (arc_offset[0] || arc_offset[1]) {
3310
-        // Send an arc to the planner
3321
+
3322
+        #if ENABLED(ARC_P_CIRCLES)
3323
+          // P indicates number of circles to do
3324
+          int8_t circles_to_do = parser.seen('P') ? parser.value_byte() : 0;
3325
+          if (!WITHIN(circles_to_do, 0, 100)) {
3326
+            SERIAL_ERROR_START();
3327
+            SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS);
3328
+          }
3329
+          while (circles_to_do--)
3330
+            plan_arc(current_position, arc_offset, clockwise);
3331
+        #endif
3332
+
3333
+        // Send the arc to the planner
3311
         plan_arc(destination, arc_offset, clockwise);
3334
         plan_arc(destination, arc_offset, clockwise);
3312
         refresh_cmd_timeout();
3335
         refresh_cmd_timeout();
3313
       }
3336
       }
3318
       }
3341
       }
3319
     }
3342
     }
3320
   }
3343
   }
3321
-#endif
3344
+
3345
+#endif // ARC_SUPPORT
3322
 
3346
 
3323
 /**
3347
 /**
3324
  * G4: Dwell S<seconds> or P<milliseconds>
3348
  * G4: Dwell S<seconds> or P<milliseconds>
3406
   }
3430
   }
3407
 #endif
3431
 #endif
3408
 
3432
 
3433
+#if ENABLED(CNC_WORKSPACE_PLANES)
3434
+
3435
+  void report_workspace_plane() {
3436
+    SERIAL_ECHO_START();
3437
+    SERIAL_ECHOPGM("Workspace Plane ");
3438
+    serialprintPGM(workspace_plane == PLANE_YZ ? PSTR("YZ\n") : workspace_plane == PLANE_ZX ? PSTR("ZX\n") : PSTR("XY\n"));
3439
+  }
3440
+
3441
+  /**
3442
+   * G17: Select Plane XY
3443
+   * G18: Select Plane ZX
3444
+   * G19: Select Plane YZ
3445
+   */
3446
+  inline void gcode_G17() { workspace_plane = PLANE_XY; }
3447
+  inline void gcode_G18() { workspace_plane = PLANE_ZX; }
3448
+  inline void gcode_G19() { workspace_plane = PLANE_YZ; }
3449
+
3450
+#endif // CNC_WORKSPACE_PLANES
3451
+
3409
 #if ENABLED(INCH_MODE_SUPPORT)
3452
 #if ENABLED(INCH_MODE_SUPPORT)
3410
   /**
3453
   /**
3411
    * G20: Set input mode to inches
3454
    * G20: Set input mode to inches
3720
     set_bed_leveling_enabled(false);
3763
     set_bed_leveling_enabled(false);
3721
   #endif
3764
   #endif
3722
 
3765
 
3766
+  #if ENABLED(CNC_WORKSPACE_PLANES)
3767
+    workspace_plane = PLANE_XY;
3768
+  #endif
3769
+
3723
   // Always home with tool 0 active
3770
   // Always home with tool 0 active
3724
   #if HOTENDS > 1
3771
   #if HOTENDS > 1
3725
     const uint8_t old_tool_index = active_extruder;
3772
     const uint8_t old_tool_index = active_extruder;
8898
   inline void gcode_M405() {
8945
   inline void gcode_M405() {
8899
     // This is technically a linear measurement, but since it's quantized to centimeters and is a different unit than
8946
     // This is technically a linear measurement, but since it's quantized to centimeters and is a different unit than
8900
     // everything else, it uses parser.value_int() instead of parser.value_linear_units().
8947
     // everything else, it uses parser.value_int() instead of parser.value_linear_units().
8901
-    if (parser.seen('D')) meas_delay_cm = parser.value_int();
8948
+    if (parser.seen('D')) meas_delay_cm = parser.value_byte();
8902
     NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY);
8949
     NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY);
8903
 
8950
 
8904
     if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup
8951
     if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup
8905
-      const int temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte
8952
+      const uint8_t temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte
8906
 
8953
 
8907
       for (uint8_t i = 0; i < COUNT(measurement_delay); ++i)
8954
       for (uint8_t i = 0; i < COUNT(measurement_delay); ++i)
8908
         measurement_delay[i] = temp_ratio;
8955
         measurement_delay[i] = temp_ratio;
10309
           break;
10356
           break;
10310
       #endif // NOZZLE_CLEAN_FEATURE
10357
       #endif // NOZZLE_CLEAN_FEATURE
10311
 
10358
 
10359
+      #if ENABLED(CNC_WORKSPACE_PLANES)
10360
+        case 17: // G17: Select Plane XY
10361
+          gcode_G17();
10362
+          break;
10363
+        case 18: // G18: Select Plane ZX
10364
+          gcode_G18();
10365
+          break;
10366
+        case 19: // G19: Select Plane YZ
10367
+          gcode_G19();
10368
+          break;
10369
+      #endif // CNC_WORKSPACE_PLANES
10370
+
10312
       #if ENABLED(INCH_MODE_SUPPORT)
10371
       #if ENABLED(INCH_MODE_SUPPORT)
10313
         case 20: //G20: Inch Mode
10372
         case 20: //G20: Inch Mode
10314
           gcode_G20();
10373
           gcode_G20();
11920
 }
11979
 }
11921
 
11980
 
11922
 #if ENABLED(ARC_SUPPORT)
11981
 #if ENABLED(ARC_SUPPORT)
11982
+
11983
+  #if N_ARC_CORRECTION < 1
11984
+    #undef N_ARC_CORRECTION
11985
+    #define N_ARC_CORRECTION 1
11986
+  #endif
11987
+
11923
   /**
11988
   /**
11924
    * Plan an arc in 2 dimensions
11989
    * Plan an arc in 2 dimensions
11925
    *
11990
    *
11934
     float *offset,       // Center of rotation relative to current_position
11999
     float *offset,       // Center of rotation relative to current_position
11935
     uint8_t clockwise    // Clockwise?
12000
     uint8_t clockwise    // Clockwise?
11936
   ) {
12001
   ) {
12002
+    #if ENABLED(CNC_WORKSPACE_PLANES)
12003
+      AxisEnum p_axis, q_axis, l_axis;
12004
+      switch (workspace_plane) {
12005
+        case PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
12006
+        case PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
12007
+        case PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
12008
+      }
12009
+    #else
12010
+      constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS;
12011
+    #endif
11937
 
12012
 
11938
-    float r_X = -offset[X_AXIS],  // Radius vector from center to current location
11939
-          r_Y = -offset[Y_AXIS];
12013
+    // Radius vector from center to current location
12014
+    float r_P = -offset[0], r_Q = -offset[1];
11940
 
12015
 
11941
-    const float radius = HYPOT(r_X, r_Y),
11942
-                center_X = current_position[X_AXIS] - r_X,
11943
-                center_Y = current_position[Y_AXIS] - r_Y,
11944
-                rt_X = logical[X_AXIS] - center_X,
11945
-                rt_Y = logical[Y_AXIS] - center_Y,
11946
-                linear_travel = logical[Z_AXIS] - current_position[Z_AXIS],
12016
+    const float radius = HYPOT(r_P, r_Q),
12017
+                center_P = current_position[p_axis] - r_P,
12018
+                center_Q = current_position[q_axis] - r_Q,
12019
+                rt_X = logical[p_axis] - center_P,
12020
+                rt_Y = logical[q_axis] - center_Q,
12021
+                linear_travel = logical[l_axis] - current_position[l_axis],
11947
                 extruder_travel = logical[E_AXIS] - current_position[E_AXIS];
12022
                 extruder_travel = logical[E_AXIS] - current_position[E_AXIS];
11948
 
12023
 
11949
     // CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
12024
     // CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required.
11950
-    float angular_travel = ATAN2(r_X * rt_Y - r_Y * rt_X, r_X * rt_X + r_Y * rt_Y);
12025
+    float angular_travel = ATAN2(r_P * rt_Y - r_Q * rt_X, r_P * rt_X + r_Q * rt_Y);
11951
     if (angular_travel < 0) angular_travel += RADIANS(360);
12026
     if (angular_travel < 0) angular_travel += RADIANS(360);
11952
     if (clockwise) angular_travel -= RADIANS(360);
12027
     if (clockwise) angular_travel -= RADIANS(360);
11953
 
12028
 
11954
-    // Make a circle if the angular rotation is 0
11955
-    if (angular_travel == 0 && current_position[X_AXIS] == logical[X_AXIS] && current_position[Y_AXIS] == logical[Y_AXIS])
11956
-      angular_travel += RADIANS(360);
12029
+    // Make a circle if the angular rotation is 0 and the target is current position
12030
+    if (angular_travel == 0 && current_position[p_axis] == logical[p_axis] && current_position[q_axis] == logical[q_axis])
12031
+      angular_travel = RADIANS(360);
11957
 
12032
 
11958
     const float mm_of_travel = HYPOT(angular_travel * radius, FABS(linear_travel));
12033
     const float mm_of_travel = HYPOT(angular_travel * radius, FABS(linear_travel));
11959
     if (mm_of_travel < 0.001) return;
12034
     if (mm_of_travel < 0.001) return;
11996
                 cos_T = 1 - 0.5 * sq(theta_per_segment); // Small angle approximation
12071
                 cos_T = 1 - 0.5 * sq(theta_per_segment); // Small angle approximation
11997
 
12072
 
11998
     // Initialize the linear axis
12073
     // Initialize the linear axis
11999
-    arc_target[Z_AXIS] = current_position[Z_AXIS];
12074
+    arc_target[l_axis] = current_position[l_axis];
12000
 
12075
 
12001
     // Initialize the extruder axis
12076
     // Initialize the extruder axis
12002
     arc_target[E_AXIS] = current_position[E_AXIS];
12077
     arc_target[E_AXIS] = current_position[E_AXIS];
12005
 
12080
 
12006
     millis_t next_idle_ms = millis() + 200UL;
12081
     millis_t next_idle_ms = millis() + 200UL;
12007
 
12082
 
12008
-    int8_t count = 0;
12083
+    #if N_ARC_CORRECTION > 1
12084
+      int8_t count = N_ARC_CORRECTION;
12085
+    #endif
12086
+
12009
     for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times
12087
     for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times
12010
 
12088
 
12011
       thermalManager.manage_heater();
12089
       thermalManager.manage_heater();
12014
         idle();
12092
         idle();
12015
       }
12093
       }
12016
 
12094
 
12017
-      if (++count < N_ARC_CORRECTION) {
12018
-        // Apply vector rotation matrix to previous r_X / 1
12019
-        const float r_new_Y = r_X * sin_T + r_Y * cos_T;
12020
-        r_X = r_X * cos_T - r_Y * sin_T;
12021
-        r_Y = r_new_Y;
12022
-      }
12023
-      else {
12095
+      #if N_ARC_CORRECTION > 1
12096
+        if (--count) {
12097
+          // Apply vector rotation matrix to previous r_P / 1
12098
+          const float r_new_Y = r_P * sin_T + r_Q * cos_T;
12099
+          r_P = r_P * cos_T - r_Q * sin_T;
12100
+          r_Q = r_new_Y;
12101
+        }
12102
+        else
12103
+      #endif
12104
+      {
12105
+        #if N_ARC_CORRECTION > 1
12106
+          count = N_ARC_CORRECTION;
12107
+        #endif
12108
+
12024
         // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments.
12109
         // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments.
12025
         // Compute exact location by applying transformation matrix from initial radius vector(=-offset).
12110
         // Compute exact location by applying transformation matrix from initial radius vector(=-offset).
12026
         // To reduce stuttering, the sin and cos could be computed at different times.
12111
         // To reduce stuttering, the sin and cos could be computed at different times.
12027
         // For now, compute both at the same time.
12112
         // For now, compute both at the same time.
12028
-        const float cos_Ti = cos(i * theta_per_segment),
12029
-                    sin_Ti = sin(i * theta_per_segment);
12030
-        r_X = -offset[X_AXIS] * cos_Ti + offset[Y_AXIS] * sin_Ti;
12031
-        r_Y = -offset[X_AXIS] * sin_Ti - offset[Y_AXIS] * cos_Ti;
12032
-        count = 0;
12113
+        const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment);
12114
+        r_P = -offset[0] * cos_Ti + offset[1] * sin_Ti;
12115
+        r_Q = -offset[0] * sin_Ti - offset[1] * cos_Ti;
12033
       }
12116
       }
12034
 
12117
 
12035
       // Update arc_target location
12118
       // Update arc_target location
12036
-      arc_target[X_AXIS] = center_X + r_X;
12037
-      arc_target[Y_AXIS] = center_Y + r_Y;
12038
-      arc_target[Z_AXIS] += linear_per_segment;
12119
+      arc_target[p_axis] = center_P + r_P;
12120
+      arc_target[q_axis] = center_Q + r_Q;
12121
+      arc_target[l_axis] += linear_per_segment;
12039
       arc_target[E_AXIS] += extruder_per_segment;
12122
       arc_target[E_AXIS] += extruder_per_segment;
12040
 
12123
 
12041
       clamp_to_software_endstops(arc_target);
12124
       clamp_to_software_endstops(arc_target);
12201
       #endif
12284
       #endif
12202
       HOTEND_LOOP()
12285
       HOTEND_LOOP()
12203
         max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
12286
         max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
12204
-      bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
12287
+      const bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
12205
       if (new_led != red_led) {
12288
       if (new_led != red_led) {
12206
         red_led = new_led;
12289
         red_led = new_led;
12207
         #if PIN_EXISTS(STAT_LED_RED)
12290
         #if PIN_EXISTS(STAT_LED_RED)

+ 13
- 2
Marlin/enum.h Näytä tiedosto

167
   LCDVIEW_CALL_NO_REDRAW
167
   LCDVIEW_CALL_NO_REDRAW
168
 };
168
 };
169
 
169
 
170
+/**
171
+ * Dual X Carriage modes. A Dual Nozzle can also do duplication.
172
+ */
170
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
173
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
171
   enum DualXMode {
174
   enum DualXMode {
172
-    DXC_FULL_CONTROL_MODE,
173
-    DXC_AUTO_PARK_MODE,
175
+    DXC_FULL_CONTROL_MODE,  // DUAL_X_CARRIAGE only
176
+    DXC_AUTO_PARK_MODE,     // DUAL_X_CARRIAGE only
174
     DXC_DUPLICATION_MODE
177
     DXC_DUPLICATION_MODE
175
   };
178
   };
176
 #endif
179
 #endif
177
 
180
 
181
+/**
182
+ * Workspace planes only apply to G2/G3 moves
183
+ * (and "canned cycles" - not a current feature)
184
+ */
185
+#if ENABLED(CNC_WORKSPACE_PLANES)
186
+  enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
187
+#endif
188
+
178
 #endif // __ENUM_H__
189
 #endif // __ENUM_H__

+ 10
- 4
Marlin/example_configurations/Cartesio/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/Felix/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h Näytä tiedosto

678
 
678
 
679
 // @section extras
679
 // @section extras
680
 
680
 
681
-// Arc interpretation settings:
682
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
683
-#define MM_PER_ARC_SEGMENT 1
684
-#define N_ARC_CORRECTION 25
681
+//
682
+// G2/G3 Arc Support
683
+//
684
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
685
+#if ENABLED(ARC_SUPPORT)
686
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
687
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
688
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
689
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
690
+#endif
685
 
691
 
686
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 //#define BEZIER_CURVE_SUPPORT
693
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/Hephestos/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/Hephestos_2/Configuration_adv.h Näytä tiedosto

654
 
654
 
655
 // @section extras
655
 // @section extras
656
 
656
 
657
-// Arc interpretation settings:
658
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
659
-#define MM_PER_ARC_SEGMENT 1
660
-#define N_ARC_CORRECTION 25
657
+//
658
+// G2/G3 Arc Support
659
+//
660
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
661
+#if ENABLED(ARC_SUPPORT)
662
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
663
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
664
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
665
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
666
+#endif
661
 
667
 
662
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
668
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
663
 //#define BEZIER_CURVE_SUPPORT
669
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/K8200/Configuration_adv.h Näytä tiedosto

684
 
684
 
685
 // @section extras
685
 // @section extras
686
 
686
 
687
-// Arc interpretation settings:
688
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
689
-#define MM_PER_ARC_SEGMENT 1
690
-#define N_ARC_CORRECTION 25
687
+//
688
+// G2/G3 Arc Support
689
+//
690
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
691
+#if ENABLED(ARC_SUPPORT)
692
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
693
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
694
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
695
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
696
+#endif
691
 
697
 
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
698
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
693
 //#define BEZIER_CURVE_SUPPORT
699
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/K8400/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/M150/Configuration_adv.h Näytä tiedosto

678
 
678
 
679
 // @section extras
679
 // @section extras
680
 
680
 
681
-// Arc interpretation settings:
682
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
683
-#define MM_PER_ARC_SEGMENT 1
684
-#define N_ARC_CORRECTION 25
681
+//
682
+// G2/G3 Arc Support
683
+//
684
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
685
+#if ENABLED(ARC_SUPPORT)
686
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
687
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
688
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
689
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
690
+#endif
685
 
691
 
686
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 //#define BEZIER_CURVE_SUPPORT
693
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/RigidBot/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/SCARA/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/TAZ4/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/TinyBoy2/Configuration_adv.h Näytä tiedosto

674
 
674
 
675
 // @section extras
675
 // @section extras
676
 
676
 
677
-// Arc interpretation settings:
678
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
679
-#define MM_PER_ARC_SEGMENT 1
680
-#define N_ARC_CORRECTION 25
677
+//
678
+// G2/G3 Arc Support
679
+//
680
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
681
+#if ENABLED(ARC_SUPPORT)
682
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
683
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
684
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
685
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
686
+#endif
681
 
687
 
682
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
688
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
683
 //#define BEZIER_CURVE_SUPPORT
689
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/WITBOX/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h Näytä tiedosto

676
 
676
 
677
 // @section extras
677
 // @section extras
678
 
678
 
679
-// Arc interpretation settings:
680
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
681
-#define MM_PER_ARC_SEGMENT 1
682
-#define N_ARC_CORRECTION 25
679
+//
680
+// G2/G3 Arc Support
681
+//
682
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
683
+#if ENABLED(ARC_SUPPORT)
684
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
685
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
686
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
687
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
688
+#endif
683
 
689
 
684
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
690
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 //#define BEZIER_CURVE_SUPPORT
691
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h Näytä tiedosto

676
 
676
 
677
 // @section extras
677
 // @section extras
678
 
678
 
679
-// Arc interpretation settings:
680
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
681
-#define MM_PER_ARC_SEGMENT 1
682
-#define N_ARC_CORRECTION 25
679
+//
680
+// G2/G3 Arc Support
681
+//
682
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
683
+#if ENABLED(ARC_SUPPORT)
684
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
685
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
686
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
687
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
688
+#endif
683
 
689
 
684
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
690
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 //#define BEZIER_CURVE_SUPPORT
691
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/generic/Configuration_adv.h Näytä tiedosto

673
 
673
 
674
 // @section extras
674
 // @section extras
675
 
675
 
676
-// Arc interpretation settings:
677
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
678
-#define MM_PER_ARC_SEGMENT 1
679
-#define N_ARC_CORRECTION 25
676
+//
677
+// G2/G3 Arc Support
678
+//
679
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
680
+#if ENABLED(ARC_SUPPORT)
681
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
682
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
683
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
684
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
685
+#endif
680
 
686
 
681
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
682
 //#define BEZIER_CURVE_SUPPORT
688
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h Näytä tiedosto

673
 
673
 
674
 // @section extras
674
 // @section extras
675
 
675
 
676
-// Arc interpretation settings:
677
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
678
-#define MM_PER_ARC_SEGMENT 1
679
-#define N_ARC_CORRECTION 25
676
+//
677
+// G2/G3 Arc Support
678
+//
679
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
680
+#if ENABLED(ARC_SUPPORT)
681
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
682
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
683
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
684
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
685
+#endif
680
 
686
 
681
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
682
 //#define BEZIER_CURVE_SUPPORT
688
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h Näytä tiedosto

678
 
678
 
679
 // @section extras
679
 // @section extras
680
 
680
 
681
-// Arc interpretation settings:
682
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
683
-#define MM_PER_ARC_SEGMENT 1
684
-#define N_ARC_CORRECTION 25
681
+//
682
+// G2/G3 Arc Support
683
+//
684
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
685
+#if ENABLED(ARC_SUPPORT)
686
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
687
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
688
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
689
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
690
+#endif
685
 
691
 
686
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 //#define BEZIER_CURVE_SUPPORT
693
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h Näytä tiedosto

673
 
673
 
674
 // @section extras
674
 // @section extras
675
 
675
 
676
-// Arc interpretation settings:
677
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
678
-#define MM_PER_ARC_SEGMENT 1
679
-#define N_ARC_CORRECTION 25
676
+//
677
+// G2/G3 Arc Support
678
+//
679
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
680
+#if ENABLED(ARC_SUPPORT)
681
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
682
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
683
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
684
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
685
+#endif
680
 
686
 
681
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
682
 //#define BEZIER_CURVE_SUPPORT
688
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/gCreate_gMax1.5+/Configuration_adv.h Näytä tiedosto

678
 
678
 
679
 // @section extras
679
 // @section extras
680
 
680
 
681
-// Arc interpretation settings:
682
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
683
-#define MM_PER_ARC_SEGMENT 1
684
-#define N_ARC_CORRECTION 25
681
+//
682
+// G2/G3 Arc Support
683
+//
684
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
685
+#if ENABLED(ARC_SUPPORT)
686
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
687
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
688
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
689
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
690
+#endif
685
 
691
 
686
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
692
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
687
 //#define BEZIER_CURVE_SUPPORT
693
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/makibox/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h Näytä tiedosto

671
 
671
 
672
 // @section extras
672
 // @section extras
673
 
673
 
674
-// Arc interpretation settings:
675
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
676
-#define MM_PER_ARC_SEGMENT 1
677
-#define N_ARC_CORRECTION 25
674
+//
675
+// G2/G3 Arc Support
676
+//
677
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
678
+#if ENABLED(ARC_SUPPORT)
679
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
680
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
681
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
682
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
683
+#endif
678
 
684
 
679
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
685
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
680
 //#define BEZIER_CURVE_SUPPORT
686
 //#define BEZIER_CURVE_SUPPORT

+ 10
- 4
Marlin/example_configurations/wt150/Configuration_adv.h Näytä tiedosto

674
 
674
 
675
 // @section extras
675
 // @section extras
676
 
676
 
677
-// Arc interpretation settings:
678
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
679
-#define MM_PER_ARC_SEGMENT 1
680
-#define N_ARC_CORRECTION 25
677
+//
678
+// G2/G3 Arc Support
679
+//
680
+#define ARC_SUPPORT               // Disable this feature to save ~3226 bytes
681
+#if ENABLED(ARC_SUPPORT)
682
+  #define MM_PER_ARC_SEGMENT  1   // Length of each arc segment
683
+  #define N_ARC_CORRECTION   25   // Number of intertpolated segments between corrections
684
+  //#define ARC_P_CIRCLES         // Enable the 'P' parameter to specify complete circles
685
+  //#define CNC_WORKSPACE_PLANES  // Allow G2/G3 to operate in XY, ZX, or YZ planes
686
+#endif
681
 
687
 
682
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
688
 // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
683
 //#define BEZIER_CURVE_SUPPORT
689
 //#define BEZIER_CURVE_SUPPORT

+ 21
- 17
Marlin/pinsDebug.h Näytä tiedosto

41
 
41
 
42
 // first pass - put the name strings into FLASH
42
 // first pass - put the name strings into FLASH
43
 
43
 
44
-#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = { PIN_NAME };
44
+#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const char ENTRY_NAME[] PROGMEM = { PIN_NAME };
45
 #define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
45
 #define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
46
 #define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
46
 #define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
47
 #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
47
 #define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
64
 #undef REPORT_NAME_DIGITAL
64
 #undef REPORT_NAME_DIGITAL
65
 #undef REPORT_NAME_ANALOG
65
 #undef REPORT_NAME_ANALOG
66
 
66
 
67
-#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { (const char*)ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL },
67
+#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { ENTRY_NAME, NAME, IS_DIGITAL },
68
 #define _ADD_PIN(NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2(entry_NAME_##COUNTER, NAME, IS_DIGITAL)
68
 #define _ADD_PIN(NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2(entry_NAME_##COUNTER, NAME, IS_DIGITAL)
69
-#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, (uint8_t)1)
70
-#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, 0)
69
+#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, true)
70
+#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, false)
71
 
71
 
72
-const char* const pin_array[][3] PROGMEM = {
72
+typedef struct {
73
+  const char * const name;
74
+  uint8_t pin;
75
+  bool is_digital;
76
+} PinInfo;
77
+
78
+const PinInfo pin_array[] PROGMEM = {
73
 
79
 
74
   /**
80
   /**
75
    *  [pin name]  [pin number]  [is digital or analog]  1 = digital, 0 = analog
81
    *  [pin name]  [pin number]  [is digital or analog]  1 = digital, 0 = analog
83
   // manually add pins ...
89
   // manually add pins ...
84
   #if SERIAL_PORT == 0
90
   #if SERIAL_PORT == 0
85
     #if AVR_ATmega2560_FAMILY
91
     #if AVR_ATmega2560_FAMILY
86
-      { RXD_NAME, 0, 1 },
87
-      { TXD_NAME, 1, 1 },
92
+      { RXD_NAME, 0, true },
93
+      { TXD_NAME, 1, true },
88
     #elif AVR_ATmega1284_FAMILY
94
     #elif AVR_ATmega1284_FAMILY
89
-      { RXD_NAME, 8, 1 },
90
-      { TXD_NAME, 9, 1 },
95
+      { RXD_NAME, 8, true },
96
+      { TXD_NAME, 9, true },
91
     #endif
97
     #endif
92
   #endif
98
   #endif
93
 
99
 
94
   #include "pinsDebug_list.h"
100
   #include "pinsDebug_list.h"
95
-  #line 96
101
+  #line 102
96
 
102
 
97
 };
103
 };
98
 
104
 
99
-#define n_array (sizeof(pin_array) / sizeof(char*)) / 3
100
-
101
 #define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \
105
 #define AVR_ATmega2560_FAMILY_PLUS_70 (MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D \
102
 || MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \
106
 || MOTHERBOARD == BOARD_MIGHTYBOARD_REVE \
103
 || MOTHERBOARD == BOARD_MINIRAMBO \
107
 || MOTHERBOARD == BOARD_MINIRAMBO \
439
 }
443
 }
440
 
444
 
441
 // pretty report with PWM info
445
 // pretty report with PWM info
442
-inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false,const char *start_string = "") {
446
+inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false, const char *start_string = "") {
443
   uint8_t temp_char;
447
   uint8_t temp_char;
444
   char *name_mem_pointer, buffer[30];   // for the sprintf statements
448
   char *name_mem_pointer, buffer[30];   // for the sprintf statements
445
   bool found = false, multi_name_pin = false;
449
   bool found = false, multi_name_pin = false;
446
-  for (uint8_t x = 0; x < n_array; x++)  {    // scan entire array and report all instances of this pin
447
-    if (pgm_read_byte(&pin_array[x][1]) == pin) {
450
+  for (uint8_t x = 0; x < COUNT(pin_array); x++)  {    // scan entire array and report all instances of this pin
451
+    if (pgm_read_byte(&pin_array[x].pin) == pin) {
448
       if (found) multi_name_pin = true;
452
       if (found) multi_name_pin = true;
449
       found = true;
453
       found = true;
450
       if (!multi_name_pin) {    // report digitial and analog pin number only on the first time through
454
       if (!multi_name_pin) {    // report digitial and analog pin number only on the first time through
461
         SERIAL_CHAR('.');
465
         SERIAL_CHAR('.');
462
         SERIAL_ECHO_SP(26 + strlen(start_string));  // add padding if not the first instance found
466
         SERIAL_ECHO_SP(26 + strlen(start_string));  // add padding if not the first instance found
463
       }
467
       }
464
-      name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]);
468
+      name_mem_pointer = (char*)pgm_read_word(&pin_array[x].name);
465
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
469
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
466
         temp_char = pgm_read_byte(name_mem_pointer + y);
470
         temp_char = pgm_read_byte(name_mem_pointer + y);
467
         if (temp_char != 0)
471
         if (temp_char != 0)
489
             else
493
             else
490
           #endif
494
           #endif
491
           {
495
           {
492
-            if (!(pgm_read_byte(&pin_array[x][2]))) {
496
+            if (!(pgm_read_byte(&pin_array[x].is_digital))) {
493
               sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(pin - analogInputToDigitalPin(0)));
497
               sprintf_P(buffer, PSTR("Analog in = %5d"), analogRead(pin - analogInputToDigitalPin(0)));
494
               SERIAL_ECHO(buffer);
498
               SERIAL_ECHO(buffer);
495
             }
499
             }

+ 2
- 2
Marlin/planner.cpp Näytä tiedosto

1103
         while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM;
1103
         while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM;
1104
 
1104
 
1105
         // Convert into an index into the measurement array
1105
         // Convert into an index into the measurement array
1106
-        filwidth_delay_index[0] = (int)(filwidth_delay_dist * 0.1 + 0.0001);
1106
+        filwidth_delay_index[0] = int8_t(filwidth_delay_dist * 0.1);
1107
 
1107
 
1108
         // If the index has changed (must have gone forward)...
1108
         // If the index has changed (must have gone forward)...
1109
         if (filwidth_delay_index[0] != filwidth_delay_index[1]) {
1109
         if (filwidth_delay_index[0] != filwidth_delay_index[1]) {
1110
           filwidth_e_count = 0; // Reset the E movement counter
1110
           filwidth_e_count = 0; // Reset the E movement counter
1111
-          const int8_t meas_sample = thermalManager.widthFil_to_size_ratio() - 100; // Subtract 100 to reduce magnitude - to store in a signed char
1111
+          const uint8_t meas_sample = thermalManager.widthFil_to_size_ratio() - 100; // Subtract 100 to reduce magnitude - to store in a signed char
1112
           do {
1112
           do {
1113
             filwidth_delay_index[1] = (filwidth_delay_index[1] + 1) % MMD_CM; // The next unused slot
1113
             filwidth_delay_index[1] = (filwidth_delay_index[1] + 1) % MMD_CM; // The next unused slot
1114
             measurement_delay[filwidth_delay_index[1]] = meas_sample;         // Store the measurement
1114
             measurement_delay[filwidth_delay_index[1]] = meas_sample;         // Store the measurement

+ 3
- 3
Marlin/temperature.cpp Näytä tiedosto

180
 #endif
180
 #endif
181
 
181
 
182
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
182
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
183
-  int16_t Temperature::meas_shift_index;  // Index of a delayed sample in buffer
183
+  int8_t Temperature::meas_shift_index;  // Index of a delayed sample in buffer
184
 #endif
184
 #endif
185
 
185
 
186
 #if HAS_AUTO_FAN
186
 #if HAS_AUTO_FAN
196
 #endif
196
 #endif
197
 
197
 
198
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
198
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
199
-  int Temperature::current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
199
+  uint16_t Temperature::current_raw_filwidth = 0; // Measured filament diameter - one extruder only
200
 #endif
200
 #endif
201
 
201
 
202
 #if ENABLED(PROBING_HEATERS_OFF)
202
 #if ENABLED(PROBING_HEATERS_OFF)
957
 
957
 
958
   // Convert raw Filament Width to millimeters
958
   // Convert raw Filament Width to millimeters
959
   float Temperature::analog2widthFil() {
959
   float Temperature::analog2widthFil() {
960
-    return current_raw_filwidth / 16383.0 * 5.0;
960
+    return current_raw_filwidth * 5.0 * (1.0 / 16383.0);
961
     //return current_raw_filwidth;
961
     //return current_raw_filwidth;
962
   }
962
   }
963
 
963
 

+ 2
- 2
Marlin/temperature.h Näytä tiedosto

247
     #endif
247
     #endif
248
 
248
 
249
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
249
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
250
-      static int16_t meas_shift_index;  // Index of a delayed sample in buffer
250
+      static int8_t meas_shift_index;  // Index of a delayed sample in buffer
251
     #endif
251
     #endif
252
 
252
 
253
     #if HAS_AUTO_FAN
253
     #if HAS_AUTO_FAN
255
     #endif
255
     #endif
256
 
256
 
257
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
257
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
258
-      static int current_raw_filwidth;  //Holds measured filament diameter - one extruder only
258
+      static uint16_t current_raw_filwidth; // Measured filament diameter - one extruder only
259
     #endif
259
     #endif
260
 
260
 
261
     #if ENABLED(PROBING_HEATERS_OFF)
261
     #if ENABLED(PROBING_HEATERS_OFF)

+ 1
- 1
Marlin/ultralcd.cpp Näytä tiedosto

4001
    *
4001
    *
4002
    */
4002
    */
4003
   #if ENABLED(REPRAPWORLD_KEYPAD)
4003
   #if ENABLED(REPRAPWORLD_KEYPAD)
4004
-    void _reprapworld_keypad_move(AxisEnum axis, int16_t dir) {
4004
+    void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
4005
       move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
4005
       move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
4006
       encoderPosition = dir;
4006
       encoderPosition = dir;
4007
       switch (axis) {
4007
       switch (axis) {

Loading…
Peruuta
Tallenna