Преглед на файлове

Add stepper MS3 support

Co-Authored-By: TheLongAndOnly <thelongandonly@users.noreply.github.com>
Scott Lahteine преди 6 години
родител
ревизия
45e738876a

+ 9
- 5
Marlin/src/gcode/control/M350_M351.cpp Целия файл

@@ -41,17 +41,21 @@ void GcodeSuite::M350() {
41 41
 
42 42
 /**
43 43
  * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
44
- *       S# determines MS1 or MS2, X# sets the pin high/low.
44
+ *       S# determines MS1, MS2 or MS3, X# sets the pin high/low.
45 45
  */
46 46
 void GcodeSuite::M351() {
47 47
   if (parser.seenval('S')) switch (parser.value_byte()) {
48 48
     case 1:
49
-      LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1);
50
-      if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1);
49
+      LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
50
+      if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1);
51 51
       break;
52 52
     case 2:
53
-      LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte());
54
-      if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte());
53
+      LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
54
+      if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1);
55
+      break;
56
+    case 3:
57
+      LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
58
+      if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte());
55 59
       break;
56 60
   }
57 61
   stepper.microstep_readings();

+ 29
- 17
Marlin/src/inc/Conditionals_post.h Целия файл

@@ -236,26 +236,37 @@
236 236
   #define MAX_AUTORETRACT 99
237 237
 #endif
238 238
 
239
-// MS1 MS2 Stepper Driver Microstepping mode table
240
-#define MICROSTEP1 LOW,LOW
241
-#if ENABLED(HEROIC_STEPPER_DRIVERS)
242
-  #define MICROSTEP128 LOW,HIGH
243
-#else
244
-  #define MICROSTEP2 HIGH,LOW
245
-  #define MICROSTEP4 LOW,HIGH
246
-#endif
247
-#define MICROSTEP8 HIGH,HIGH
248
-#ifdef __SAM3X8E__
249
-  #if MB(ALLIGATOR)
250
-    #define MICROSTEP16 LOW,LOW
251
-    #define MICROSTEP32 HIGH,HIGH
239
+// MS1 MS2 MS3 Stepper Driver Microstepping mode table
240
+#if DISABLED(MICROSTEP_CUSTOM)
241
+  #define MICROSTEP1 LOW,LOW,LOW
242
+  #if ENABLED(HEROIC_STEPPER_DRIVERS)
243
+    #define MICROSTEP128 LOW,HIGH,LOW
244
+  #else
245
+    #define MICROSTEP2 HIGH,LOW,LOW
246
+    #define MICROSTEP4 LOW,HIGH,LOW
247
+  #endif
248
+  #define MICROSTEP8 HIGH,HIGH,LOW
249
+  #ifdef __SAM3X8E__
250
+    #if MB(ALLIGATOR)
251
+      #define MICROSTEP16 LOW,LOW,LOW
252
+      #define MICROSTEP32 HIGH,HIGH,LOW
253
+    #else
254
+      #define MICROSTEP16 HIGH,HIGH,LOW
255
+    #endif
252 256
   #else
253
-    #define MICROSTEP16 HIGH,HIGH
257
+    #define MICROSTEP16 HIGH,HIGH,LOW
254 258
   #endif
255
-#else
256
-  #define MICROSTEP16 HIGH,HIGH
257 259
 #endif
258 260
 
261
+#define HAS_MICROSTEP1 defined(MICROSTEP1)
262
+#define HAS_MICROSTEP2 defined(MICROSTEP2)
263
+#define HAS_MICROSTEP4 defined(MICROSTEP4)
264
+#define HAS_MICROSTEP8 defined(MICROSTEP8)
265
+#define HAS_MICROSTEP16 defined(MICROSTEP16)
266
+#define HAS_MICROSTEP32 defined(MICROSTEP32)
267
+#define HAS_MICROSTEP64 defined(MICROSTEP64)
268
+#define HAS_MICROSTEP128 defined(MICROSTEP128)
269
+
259 270
 /**
260 271
  * Override here because this is set in Configuration_adv.h
261 272
  */
@@ -828,6 +839,7 @@
828 839
 #define HAS_Z3_ENABLE     (PIN_EXISTS(Z3_ENABLE))
829 840
 #define HAS_Z3_DIR        (PIN_EXISTS(Z3_DIR))
830 841
 #define HAS_Z3_STEP       (PIN_EXISTS(Z3_STEP))
842
+#define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1))
831 843
 
832 844
 // Extruder steppers and solenoids
833 845
 #define HAS_E0_ENABLE     (PIN_EXISTS(E0_ENABLE))
@@ -1003,7 +1015,7 @@
1003 1015
 #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
1004 1016
 
1005 1017
 // Digital control
1006
-#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1018
+#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1007 1019
 #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
1008 1020
 #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
1009 1021
 #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))

+ 234
- 30
Marlin/src/module/stepper.cpp Целия файл

@@ -2504,53 +2504,136 @@ void Stepper::report_positions() {
2504 2504
    */
2505 2505
 
2506 2506
   void Stepper::microstep_init() {
2507
-    SET_OUTPUT(X_MS1_PIN);
2508
-    SET_OUTPUT(X_MS2_PIN);
2507
+    #if HAS_X_MICROSTEPS
2508
+      SET_OUTPUT(X_MS1_PIN);
2509
+      SET_OUTPUT(X_MS2_PIN);
2510
+      #if PIN_EXISTS(X_MS3)
2511
+        SET_OUTPUT(X_MS3_PIN);
2512
+      #endif
2513
+    #endif
2514
+    #if HAS_X2_MICROSTEPS
2515
+      SET_OUTPUT(X2_MS1_PIN);
2516
+      SET_OUTPUT(X2_MS2_PIN);
2517
+      #if PIN_EXISTS(X2_MS3)
2518
+        SET_OUTPUT(X2_MS3_PIN);
2519
+      #endif
2520
+    #endif
2509 2521
     #if HAS_Y_MICROSTEPS
2510 2522
       SET_OUTPUT(Y_MS1_PIN);
2511 2523
       SET_OUTPUT(Y_MS2_PIN);
2524
+      #if PIN_EXISTS(Y_MS3)
2525
+        SET_OUTPUT(Y_MS3_PIN);
2526
+      #endif
2527
+    #endif
2528
+    #if HAS_Y2_MICROSTEPS
2529
+      SET_OUTPUT(Y2_MS1_PIN);
2530
+      SET_OUTPUT(Y2_MS2_PIN);
2531
+      #if PIN_EXISTS(Y2_MS3)
2532
+        SET_OUTPUT(Y2_MS3_PIN);
2533
+      #endif
2512 2534
     #endif
2513 2535
     #if HAS_Z_MICROSTEPS
2514 2536
       SET_OUTPUT(Z_MS1_PIN);
2515 2537
       SET_OUTPUT(Z_MS2_PIN);
2538
+      #if PIN_EXISTS(Z_MS3)
2539
+        SET_OUTPUT(Z_MS3_PIN);
2540
+      #endif
2541
+    #endif
2542
+    #if HAS_Z2_MICROSTEPS
2543
+      SET_OUTPUT(Z2_MS1_PIN);
2544
+      SET_OUTPUT(Z2_MS2_PIN);
2545
+      #if PIN_EXISTS(Z2_MS3)
2546
+        SET_OUTPUT(Z2_MS3_PIN);
2547
+      #endif
2516 2548
     #endif
2549
+    #if HAS_Z3_MICROSTEPS
2550
+      SET_OUTPUT(Z3_MS1_PIN);
2551
+      SET_OUTPUT(Z3_MS2_PIN);
2552
+      #if PIN_EXISTS(Z3_MS3)
2553
+        SET_OUTPUT(Z3_MS3_PIN);
2554
+      #endif
2555
+    #endif    
2517 2556
     #if HAS_E0_MICROSTEPS
2518 2557
       SET_OUTPUT(E0_MS1_PIN);
2519 2558
       SET_OUTPUT(E0_MS2_PIN);
2559
+      #if PIN_EXISTS(E0_MS3)
2560
+        SET_OUTPUT(E0_MS3_PIN);
2561
+      #endif
2520 2562
     #endif
2521 2563
     #if HAS_E1_MICROSTEPS
2522 2564
       SET_OUTPUT(E1_MS1_PIN);
2523 2565
       SET_OUTPUT(E1_MS2_PIN);
2566
+      #if PIN_EXISTS(E1_MS3)
2567
+        SET_OUTPUT(E1_MS3_PIN);
2568
+      #endif
2524 2569
     #endif
2525 2570
     #if HAS_E2_MICROSTEPS
2526 2571
       SET_OUTPUT(E2_MS1_PIN);
2527 2572
       SET_OUTPUT(E2_MS2_PIN);
2573
+      #if PIN_EXISTS(E2_MS3)
2574
+        SET_OUTPUT(E2_MS3_PIN);
2575
+      #endif
2528 2576
     #endif
2529 2577
     #if HAS_E3_MICROSTEPS
2530 2578
       SET_OUTPUT(E3_MS1_PIN);
2531 2579
       SET_OUTPUT(E3_MS2_PIN);
2580
+      #if PIN_EXISTS(E3_MS3)
2581
+        SET_OUTPUT(E3_MS3_PIN);
2582
+      #endif
2532 2583
     #endif
2533 2584
     #if HAS_E4_MICROSTEPS
2534 2585
       SET_OUTPUT(E4_MS1_PIN);
2535 2586
       SET_OUTPUT(E4_MS2_PIN);
2587
+      #if PIN_EXISTS(E4_MS3)
2588
+        SET_OUTPUT(E4_MS3_PIN);
2589
+      #endif
2536 2590
     #endif
2537 2591
     #if HAS_E5_MICROSTEPS
2538 2592
       SET_OUTPUT(E5_MS1_PIN);
2539 2593
       SET_OUTPUT(E5_MS2_PIN);
2594
+      #if PIN_EXISTS(E5_MS3)
2595
+        SET_OUTPUT(E5_MS3_PIN);
2596
+      #endif
2540 2597
     #endif
2541 2598
     static const uint8_t microstep_modes[] = MICROSTEP_MODES;
2542 2599
     for (uint16_t i = 0; i < COUNT(microstep_modes); i++)
2543 2600
       microstep_mode(i, microstep_modes[i]);
2544 2601
   }
2545 2602
 
2546
-  void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2) {
2603
+  void Stepper::microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) {
2547 2604
     if (ms1 >= 0) switch (driver) {
2548
-      case 0: WRITE(X_MS1_PIN, ms1); break;
2549
-      #if HAS_Y_MICROSTEPS
2550
-        case 1: WRITE(Y_MS1_PIN, ms1); break;
2605
+      #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2606
+        case 0:
2607
+          #if HAS_X_MICROSTEPS
2608
+            WRITE(X_MS1_PIN, ms1);
2609
+          #endif
2610
+          #if HAS_X2_MICROSTEPS
2611
+            WRITE(X2_MS1_PIN, ms1);
2612
+          #endif
2613
+          break;
2551 2614
       #endif
2552
-      #if HAS_Z_MICROSTEPS
2553
-        case 2: WRITE(Z_MS1_PIN, ms1); break;
2615
+      #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2616
+        case 1:
2617
+          #if HAS_Y_MICROSTEPS
2618
+            WRITE(Y_MS1_PIN, ms1);
2619
+          #endif
2620
+          #if HAS_Y2_MICROSTEPS
2621
+            WRITE(Y2_MS1_PIN, ms1);
2622
+          #endif
2623
+          break;
2624
+      #endif
2625
+      #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2626
+        case 2:
2627
+          #if HAS_Z_MICROSTEPS
2628
+            WRITE(Z_MS1_PIN, ms1);
2629
+          #endif
2630
+          #if HAS_Z2_MICROSTEPS
2631
+            WRITE(Z2_MS1_PIN, ms1);
2632
+          #endif
2633
+          #if HAS_Z3_MICROSTEPS
2634
+            WRITE(Z3_MS1_PIN, ms1);
2635
+          #endif
2636
+          break;
2554 2637
       #endif
2555 2638
       #if HAS_E0_MICROSTEPS
2556 2639
         case 3: WRITE(E0_MS1_PIN, ms1); break;
@@ -2572,12 +2655,38 @@ void Stepper::report_positions() {
2572 2655
       #endif
2573 2656
     }
2574 2657
     if (ms2 >= 0) switch (driver) {
2575
-      case 0: WRITE(X_MS2_PIN, ms2); break;
2576
-      #if HAS_Y_MICROSTEPS
2577
-        case 1: WRITE(Y_MS2_PIN, ms2); break;
2658
+      #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2659
+        case 0:
2660
+          #if HAS_X_MICROSTEPS
2661
+            WRITE(X_MS2_PIN, ms2);
2662
+          #endif
2663
+          #if HAS_X2_MICROSTEPS
2664
+            WRITE(X2_MS2_PIN, ms2);
2665
+          #endif
2666
+          break;
2667
+      #endif
2668
+      #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2669
+        case 1:
2670
+          #if HAS_Y_MICROSTEPS
2671
+            WRITE(Y_MS2_PIN, ms2);
2672
+          #endif
2673
+          #if HAS_Y2_MICROSTEPS
2674
+            WRITE(Y2_MS2_PIN, ms2);
2675
+          #endif
2676
+          break;
2578 2677
       #endif
2579
-      #if HAS_Z_MICROSTEPS
2580
-        case 2: WRITE(Z_MS2_PIN, ms2); break;
2678
+      #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2679
+        case 2:
2680
+          #if HAS_Z_MICROSTEPS
2681
+            WRITE(Z_MS2_PIN, ms2);
2682
+          #endif
2683
+          #if HAS_Z2_MICROSTEPS
2684
+            WRITE(Z2_MS2_PIN, ms2);
2685
+          #endif
2686
+          #if HAS_Z3_MICROSTEPS
2687
+            WRITE(Z3_MS2_PIN, ms2);
2688
+          #endif
2689
+          break;
2581 2690
       #endif
2582 2691
       #if HAS_E0_MICROSTEPS
2583 2692
         case 3: WRITE(E0_MS2_PIN, ms2); break;
@@ -2598,70 +2707,165 @@ void Stepper::report_positions() {
2598 2707
         case 8: WRITE(E5_MS2_PIN, ms2); break;
2599 2708
       #endif
2600 2709
     }
2710
+    if (ms3 >= 0) switch (driver) {
2711
+      #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2712
+        case 0:
2713
+          #if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3)
2714
+            WRITE(X_MS3_PIN, ms3);
2715
+          #endif
2716
+          #if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3)
2717
+            WRITE(X2_MS3_PIN, ms3);
2718
+          #endif
2719
+          break;
2720
+      #endif
2721
+      #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2722
+        case 1:
2723
+          #if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3)
2724
+            WRITE(Y_MS3_PIN, ms3);
2725
+          #endif
2726
+          #if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3)
2727
+            WRITE(Y2_MS3_PIN, ms3);
2728
+          #endif
2729
+          break;
2730
+      #endif
2731
+      #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2732
+        case 2:
2733
+          #if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3)
2734
+            WRITE(Z_MS3_PIN, ms3);
2735
+          #endif
2736
+          #if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3)
2737
+            WRITE(Z2_MS3_PIN, ms3);
2738
+          #endif
2739
+          #if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3)
2740
+            WRITE(Z3_MS3_PIN, ms3);
2741
+          #endif
2742
+          break;
2743
+      #endif
2744
+      #if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3)
2745
+        case 3: WRITE(E0_MS3_PIN, ms3); break;
2746
+      #endif
2747
+      #if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3)
2748
+        case 4: WRITE(E1_MS3_PIN, ms3); break;
2749
+      #endif
2750
+      #if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3)
2751
+        case 5: WRITE(E2_MS3_PIN, ms3); break;
2752
+      #endif
2753
+      #if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3)
2754
+        case 6: WRITE(E3_MS3_PIN, ms3); break;
2755
+      #endif
2756
+      #if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3)
2757
+        case 7: WRITE(E4_MS3_PIN, ms3); break;
2758
+      #endif
2759
+      #if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3)
2760
+        case 8: WRITE(E5_MS3_PIN, ms3); break;
2761
+      #endif    
2762
+    }
2601 2763
   }
2602 2764
 
2603 2765
   void Stepper::microstep_mode(const uint8_t driver, const uint8_t stepping_mode) {
2604 2766
     switch (stepping_mode) {
2605
-      case 1: microstep_ms(driver, MICROSTEP1); break;
2606
-      #if ENABLED(HEROIC_STEPPER_DRIVERS)
2607
-        case 128: microstep_ms(driver, MICROSTEP128); break;
2608
-      #else
2767
+      #if HAS_MICROSTEP1
2768
+        case 1: microstep_ms(driver, MICROSTEP1); break;
2769
+      #endif
2770
+      #if HAS_MICROSTEP2
2609 2771
         case 2: microstep_ms(driver, MICROSTEP2); break;
2772
+      #endif
2773
+      #if HAS_MICROSTEP4
2610 2774
         case 4: microstep_ms(driver, MICROSTEP4); break;
2611 2775
       #endif
2612
-      case 8: microstep_ms(driver, MICROSTEP8); break;
2613
-      case 16: microstep_ms(driver, MICROSTEP16); break;
2614
-      #if MB(ALLIGATOR)
2776
+      #if HAS_MICROSTEP8
2777
+        case 8: microstep_ms(driver, MICROSTEP8); break;
2778
+      #endif
2779
+      #if HAS_MICROSTEP16
2780
+        case 16: microstep_ms(driver, MICROSTEP16); break;
2781
+      #endif
2782
+      #if HAS_MICROSTEP32
2615 2783
         case 32: microstep_ms(driver, MICROSTEP32); break;
2616 2784
       #endif
2785
+      #if HAS_MICROSTEP64
2786
+        case 64: microstep_ms(driver, MICROSTEP64); break;
2787
+      #endif
2788
+      #if HAS_MICROSTEP128
2789
+        case 128: microstep_ms(driver, MICROSTEP128); break;
2790
+      #endif
2791
+
2617 2792
       default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break;
2618 2793
     }
2619 2794
   }
2620 2795
 
2621 2796
   void Stepper::microstep_readings() {
2622
-    SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins");
2797
+    SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins");
2623 2798
     SERIAL_PROTOCOLPGM("X: ");
2624
-    SERIAL_PROTOCOL(READ(X_MS1_PIN));
2625
-    SERIAL_PROTOCOLLN(READ(X_MS2_PIN));
2799
+    #if HAS_X_MICROSTEPS
2800
+      SERIAL_PROTOCOL(READ(X_MS1_PIN));
2801
+      SERIAL_PROTOCOL(READ(X_MS2_PIN));
2802
+      #if PIN_EXISTS(X_MS3)
2803
+        SERIAL_PROTOCOLLN(READ(X_MS3_PIN));
2804
+      #endif
2805
+    #endif
2626 2806
     #if HAS_Y_MICROSTEPS
2627 2807
       SERIAL_PROTOCOLPGM("Y: ");
2628 2808
       SERIAL_PROTOCOL(READ(Y_MS1_PIN));
2629
-      SERIAL_PROTOCOLLN(READ(Y_MS2_PIN));
2809
+      SERIAL_PROTOCOL(READ(Y_MS2_PIN));
2810
+      #if PIN_EXISTS(Y_MS3)
2811
+        SERIAL_PROTOCOLLN(READ(Y_MS3_PIN));
2812
+      #endif
2630 2813
     #endif
2631 2814
     #if HAS_Z_MICROSTEPS
2632 2815
       SERIAL_PROTOCOLPGM("Z: ");
2633 2816
       SERIAL_PROTOCOL(READ(Z_MS1_PIN));
2634
-      SERIAL_PROTOCOLLN(READ(Z_MS2_PIN));
2817
+      SERIAL_PROTOCOL(READ(Z_MS2_PIN));
2818
+      #if PIN_EXISTS(Z_MS3)
2819
+        SERIAL_PROTOCOLLN(READ(Z_MS3_PIN));
2820
+      #endif
2635 2821
     #endif
2636 2822
     #if HAS_E0_MICROSTEPS
2637 2823
       SERIAL_PROTOCOLPGM("E0: ");
2638 2824
       SERIAL_PROTOCOL(READ(E0_MS1_PIN));
2639
-      SERIAL_PROTOCOLLN(READ(E0_MS2_PIN));
2825
+      SERIAL_PROTOCOL(READ(E0_MS2_PIN));
2826
+      #if PIN_EXISTS(E0_MS3)
2827
+        SERIAL_PROTOCOLLN(READ(E0_MS3_PIN));
2828
+      #endif
2640 2829
     #endif
2641 2830
     #if HAS_E1_MICROSTEPS
2642 2831
       SERIAL_PROTOCOLPGM("E1: ");
2643 2832
       SERIAL_PROTOCOL(READ(E1_MS1_PIN));
2644
-      SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
2833
+      SERIAL_PROTOCOL(READ(E1_MS2_PIN));
2834
+      #if PIN_EXISTS(E1_MS3)
2835
+        SERIAL_PROTOCOLLN(READ(E1_MS3_PIN));
2836
+      #endif
2645 2837
     #endif
2646 2838
     #if HAS_E2_MICROSTEPS
2647 2839
       SERIAL_PROTOCOLPGM("E2: ");
2648 2840
       SERIAL_PROTOCOL(READ(E2_MS1_PIN));
2649
-      SERIAL_PROTOCOLLN(READ(E2_MS2_PIN));
2841
+      SERIAL_PROTOCOL(READ(E2_MS2_PIN));
2842
+      #if PIN_EXISTS(E2_MS3)
2843
+        SERIAL_PROTOCOLLN(READ(E2_MS3_PIN));
2844
+      #endif
2650 2845
     #endif
2651 2846
     #if HAS_E3_MICROSTEPS
2652 2847
       SERIAL_PROTOCOLPGM("E3: ");
2653 2848
       SERIAL_PROTOCOL(READ(E3_MS1_PIN));
2654
-      SERIAL_PROTOCOLLN(READ(E3_MS2_PIN));
2849
+      SERIAL_PROTOCOL(READ(E3_MS2_PIN));
2850
+      #if PIN_EXISTS(E3_MS3)
2851
+        SERIAL_PROTOCOLLN(READ(E3_MS3_PIN));
2852
+      #endif
2655 2853
     #endif
2656 2854
     #if HAS_E4_MICROSTEPS
2657 2855
       SERIAL_PROTOCOLPGM("E4: ");
2658 2856
       SERIAL_PROTOCOL(READ(E4_MS1_PIN));
2659
-      SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));
2857
+      SERIAL_PROTOCOL(READ(E4_MS2_PIN));
2858
+      #if PIN_EXISTS(E4_MS3)
2859
+        SERIAL_PROTOCOLLN(READ(E4_MS3_PIN));
2860
+      #endif
2660 2861
     #endif
2661 2862
     #if HAS_E5_MICROSTEPS
2662 2863
       SERIAL_PROTOCOLPGM("E5: ");
2663 2864
       SERIAL_PROTOCOL(READ(E5_MS1_PIN));
2664 2865
       SERIAL_PROTOCOLLN(READ(E5_MS2_PIN));
2866
+      #if PIN_EXISTS(E5_MS3)
2867
+        SERIAL_PROTOCOLLN(READ(E5_MS3_PIN));
2868
+      #endif      
2665 2869
     #endif
2666 2870
   }
2667 2871
 

+ 1
- 1
Marlin/src/module/stepper.h Целия файл

@@ -413,7 +413,7 @@ class Stepper {
413 413
     #endif
414 414
 
415 415
     #if HAS_MICROSTEPS
416
-      static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2);
416
+      static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3);
417 417
       static void microstep_mode(const uint8_t driver, const uint8_t stepping);
418 418
       static void microstep_readings();
419 419
     #endif

+ 63
- 40
Marlin/src/pins/pins.h Целия файл

@@ -427,12 +427,18 @@
427 427
 #ifndef X_MS2_PIN
428 428
   #define X_MS2_PIN -1
429 429
 #endif
430
+#ifndef X_MS3_PIN
431
+  #define X_MS3_PIN -1
432
+#endif
430 433
 #ifndef Y_MS1_PIN
431 434
   #define Y_MS1_PIN -1
432 435
 #endif
433 436
 #ifndef Y_MS2_PIN
434 437
   #define Y_MS2_PIN -1
435 438
 #endif
439
+#ifndef Y_MS3_PIN
440
+  #define Y_MS3_PIN -1
441
+#endif
436 442
 #ifndef Z_MS1_PIN
437 443
   #define Z_MS1_PIN -1
438 444
 #endif
@@ -448,18 +454,27 @@
448 454
 #ifndef E0_MS2_PIN
449 455
   #define E0_MS2_PIN -1
450 456
 #endif
457
+#ifndef E0_MS3_PIN
458
+  #define E0_MS3_PIN -1
459
+#endif
451 460
 #ifndef E1_MS1_PIN
452 461
   #define E1_MS1_PIN -1
453 462
 #endif
454 463
 #ifndef E1_MS2_PIN
455 464
   #define E1_MS2_PIN -1
456 465
 #endif
466
+#ifndef E1_MS3_PIN
467
+  #define E1_MS3_PIN -1
468
+#endif
457 469
 #ifndef E2_MS1_PIN
458 470
   #define E2_MS1_PIN -1
459 471
 #endif
460 472
 #ifndef E2_MS2_PIN
461 473
   #define E2_MS2_PIN -1
462 474
 #endif
475
+#ifndef E2_MS3_PIN
476
+  #define E2_MS3_PIN -1
477
+#endif
463 478
 #ifndef E3_MS1_PIN
464 479
   #define E3_MS1_PIN -1
465 480
 #endif
@@ -907,19 +922,21 @@
907 922
     #define X2_STEP_PIN   _EPIN(E_STEPPERS, STEP)
908 923
     #define X2_DIR_PIN    _EPIN(E_STEPPERS, DIR)
909 924
     #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
910
-    #ifndef X2_CS_PIN
911
-      #define X2_CS_PIN   _EPIN(E_STEPPERS, CS)
912
-    #endif
913
-    #if E_STEPPERS > MAX_EXTRUDERS || !PIN_EXISTS(X2_ENABLE)
925
+    #if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP)
914 926
       #error "No E stepper plug left for X2!"
915 927
     #endif
916 928
   #endif
917
-  #undef _X2_PINS
918
-  #define __X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
919
-  #ifdef X2_CS_PIN
920
-    #define _X2_PINS __X2_PINS X2_CS_PIN,
921
-  #else
922
-    #define _X2_PINS __X2_PINS
929
+  #ifndef X2_CS_PIN
930
+    #define X2_CS_PIN     _EPIN(E_STEPPERS, CS)
931
+  #endif
932
+  #ifndef X2_MS1_PIN
933
+    #define X2_MS1_PIN    _EPIN(E_STEPPERS, MS1)
934
+  #endif
935
+  #ifndef X2_MS2_PIN
936
+    #define X2_MS2_PIN    _EPIN(E_STEPPERS, MS2)
937
+  #endif
938
+  #ifndef X2_MS3_PIN
939
+    #define X2_MS3_PIN    _EPIN(E_STEPPERS, MS3)
923 940
   #endif
924 941
   #define Y2_E_INDEX INCREMENT(E_STEPPERS)
925 942
 #else
@@ -932,19 +949,21 @@
932 949
     #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
933 950
     #define Y2_DIR_PIN    _EPIN(Y2_E_INDEX, DIR)
934 951
     #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
935
-    #ifndef Y2_CS_PIN
936
-      #define Y2_CS_PIN   _EPIN(Y2_E_INDEX, CS)
937
-    #endif
938
-    #if Y2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Y2_ENABLE)
952
+    #if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_STEP)
939 953
       #error "No E stepper plug left for Y2!"
940 954
     #endif
941 955
   #endif
942
-  #undef _Y2_PINS
943
-  #define __Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
944
-  #ifdef Y2_CS_PIN
945
-    #define _Y2_PINS __Y2_PINS Y2_CS_PIN,
946
-  #else
947
-    #define _Y2_PINS __Y2_PINS
956
+  #ifndef Y2_CS_PIN
957
+    #define Y2_CS_PIN     _EPIN(Y2_E_INDEX, CS)
958
+  #endif
959
+  #ifndef Y2_MS1_PIN
960
+    #define Y2_MS1_PIN    _EPIN(Y2_E_INDEX, MS1)
961
+  #endif
962
+  #ifndef Y2_MS2_PIN
963
+    #define Y2_MS2_PIN    _EPIN(Y2_E_INDEX, MS2)
964
+  #endif
965
+  #ifndef Y2_MS3_PIN
966
+    #define Y2_MS3_PIN    _EPIN(Y2_E_INDEX, MS3)
948 967
   #endif
949 968
   #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
950 969
 #else
@@ -957,19 +976,21 @@
957 976
     #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
958 977
     #define Z2_DIR_PIN    _EPIN(Z2_E_INDEX, DIR)
959 978
     #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
960
-    #ifndef Z2_CS_PIN
961
-      #define Z2_CS_PIN   _EPIN(Z2_E_INDEX, CS)
962
-    #endif
963
-    #if Z2_E_INDEX > MAX_EXTRUDERS || !PIN_EXISTS(Z2_ENABLE)
979
+    #if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_STEP)
964 980
       #error "No E stepper plug left for Z2!"
965 981
     #endif
966 982
   #endif
967
-  #undef _Z2_PINS
968
-  #define __Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,
969
-  #ifdef Z2_CS_PIN
970
-    #define _Z2_PINS __Z2_PINS Z2_CS_PIN,
971
-  #else
972
-    #define _Z2_PINS __Z2_PINS
983
+  #ifndef Z2_CS_PIN
984
+    #define Z2_CS_PIN     _EPIN(Z2_E_INDEX, CS)
985
+  #endif
986
+  #ifndef Z2_MS1_PIN
987
+    #define Z2_MS1_PIN    _EPIN(Z2_E_INDEX, MS1)
988
+  #endif
989
+  #ifndef Z2_MS2_PIN
990
+    #define Z2_MS2_PIN    _EPIN(Z2_E_INDEX, MS2)
991
+  #endif
992
+  #ifndef Z2_MS3_PIN
993
+    #define Z2_MS3_PIN    _EPIN(Z2_E_INDEX, MS3)
973 994
   #endif
974 995
   #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
975 996
 #else
@@ -981,19 +1002,21 @@
981 1002
     #define Z3_STEP_PIN   _EPIN(Z3_E_INDEX, STEP)
982 1003
     #define Z3_DIR_PIN    _EPIN(Z3_E_INDEX, DIR)
983 1004
     #define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
984
-    #ifndef Z3_CS_PIN
985
-      #define Z3_CS_PIN   _EPIN(Z3_E_INDEX, CS)
986
-    #endif
987
-    #if Z3_E_INDEX > 4 || !PIN_EXISTS(Z3_ENABLE)
1005
+    #if Z3_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z3_STEP)
988 1006
       #error "No E stepper plug left for Z3!"
989 1007
     #endif
990 1008
   #endif
991
-  #undef _Z3_PINS
992
-  #define __Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN,
993
-  #ifdef Z3_CS_PIN
994
-    #define _Z3_PINS __Z3_PINS Z3_CS_PIN,
995
-  #else
996
-    #define _Z3_PINS __Z3_PINS
1009
+  #ifndef Z3_CS_PIN
1010
+    #define Z3_CS_PIN     _EPIN(Z3_E_INDEX, CS)
1011
+  #endif
1012
+  #ifndef Z3_MS1_PIN
1013
+    #define Z3_MS1_PIN    _EPIN(Z3_E_INDEX, MS1)
1014
+  #endif
1015
+  #ifndef Z3_MS2_PIN
1016
+    #define Z3_MS2_PIN    _EPIN(Z3_E_INDEX, MS2)
1017
+  #endif
1018
+  #ifndef Z3_MS3_PIN
1019
+    #define Z3_MS3_PIN    _EPIN(Z3_E_INDEX, MS3)
997 1020
   #endif
998 1021
 #endif
999 1022
 

+ 36
- 0
Marlin/src/pins/pinsDebug_list.h Целия файл

@@ -268,6 +268,9 @@
268 268
 #if PIN_EXISTS(E0_MS2)
269 269
   REPORT_NAME_DIGITAL(__LINE__, E0_MS2_PIN)
270 270
 #endif
271
+#if PIN_EXISTS(E0_MS3)
272
+  REPORT_NAME_DIGITAL(__LINE__, E0_MS3_PIN)
273
+#endif
271 274
 #if PIN_EXISTS(E0_STEP)
272 275
   REPORT_NAME_DIGITAL(__LINE__, E0_STEP_PIN)
273 276
 #endif
@@ -289,6 +292,9 @@
289 292
 #if PIN_EXISTS(E1_MS2)
290 293
   REPORT_NAME_DIGITAL(__LINE__, E1_MS2_PIN)
291 294
 #endif
295
+#if PIN_EXISTS(E1_MS3)
296
+  REPORT_NAME_DIGITAL(__LINE__, E1_MS3_PIN)
297
+#endif
292 298
 #if PIN_EXISTS(E1_STEP)
293 299
   REPORT_NAME_DIGITAL(__LINE__, E1_STEP_PIN)
294 300
 #endif
@@ -310,6 +316,9 @@
310 316
 #if PIN_EXISTS(E2_MS2)
311 317
   REPORT_NAME_DIGITAL(__LINE__, E2_MS2_PIN)
312 318
 #endif
319
+#if PIN_EXISTS(E2_MS3)
320
+  REPORT_NAME_DIGITAL(__LINE__, E2_MS3_PIN)
321
+#endif
313 322
 #if PIN_EXISTS(E2_STEP)
314 323
   REPORT_NAME_DIGITAL(__LINE__, E2_STEP_PIN)
315 324
 #endif
@@ -881,6 +890,9 @@
881 890
 #if PIN_EXISTS(X_MS2)
882 891
   REPORT_NAME_DIGITAL(__LINE__, X_MS2_PIN)
883 892
 #endif
893
+#if PIN_EXISTS(X_MS3)
894
+  REPORT_NAME_DIGITAL(__LINE__, X_MS3_PIN)
895
+#endif
884 896
 #if PIN_EXISTS(X_STEP)
885 897
   REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN)
886 898
 #endif
@@ -893,6 +905,15 @@
893 905
 #if PIN_EXISTS(X2_ENABLE)
894 906
   REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN)
895 907
 #endif
908
+#if PIN_EXISTS(X2_MS1)
909
+  REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN)
910
+#endif
911
+#if PIN_EXISTS(X2_MS2)
912
+  REPORT_NAME_DIGITAL(__LINE__, X2_MS2_PIN)
913
+#endif
914
+#if PIN_EXISTS(X2_MS3)
915
+  REPORT_NAME_DIGITAL(__LINE__, X2_MS3_PIN)
916
+#endif
896 917
 #if PIN_EXISTS(X2_STEP)
897 918
   REPORT_NAME_DIGITAL(__LINE__, X2_STEP_PIN)
898 919
 #endif
@@ -920,6 +941,9 @@
920 941
 #if PIN_EXISTS(Y_MS2)
921 942
   REPORT_NAME_DIGITAL(__LINE__, Y_MS2_PIN)
922 943
 #endif
944
+#if PIN_EXISTS(Y_MS3)
945
+  REPORT_NAME_DIGITAL(__LINE__, Y_MS3_PIN)
946
+#endif
923 947
 #if PIN_EXISTS(Y_STEP)
924 948
   REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN)
925 949
 #endif
@@ -932,6 +956,15 @@
932 956
 #if PIN_EXISTS(Y2_ENABLE)
933 957
   REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN)
934 958
 #endif
959
+#if PIN_EXISTS(Y2_MS1)
960
+  REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN)
961
+#endif
962
+#if PIN_EXISTS(Y2_MS2)
963
+  REPORT_NAME_DIGITAL(__LINE__, Y2_MS2_PIN)
964
+#endif
965
+#if PIN_EXISTS(Y2_MS3)
966
+  REPORT_NAME_DIGITAL(__LINE__, Y2_MS3_PIN)
967
+#endif
935 968
 #if PIN_EXISTS(Y2_STEP)
936 969
   REPORT_NAME_DIGITAL(__LINE__, Y2_STEP_PIN)
937 970
 #endif
@@ -962,6 +995,9 @@
962 995
 #if PIN_EXISTS(Z_MS2)
963 996
   REPORT_NAME_DIGITAL(__LINE__, Z_MS2_PIN)
964 997
 #endif
998
+#if PIN_EXISTS(Z_MS3)
999
+  REPORT_NAME_DIGITAL(__LINE__, Z_MS3_PIN)
1000
+#endif
965 1001
 #if PIN_EXISTS(Z_STEP)
966 1002
   REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN)
967 1003
 #endif

+ 0
- 3
Marlin/src/pins/pins_RURAMPS4D_11.h Целия файл

@@ -119,9 +119,6 @@
119 119
 //#define E3_MS1_PIN         ?
120 120
 //#define E3_MS2_PIN         ?
121 121
 //#define E3_MS3_PIN         ?
122
-//#define Z2_MS1_PIN         ?   // shared with E3_MS1_PIN
123
-//#define Z2_MS2_PIN         ?   // shared with E3_MS2_PIN
124
-//#define Z2_MS3_PIN         ?   // shared with E3_MS3_PIN
125 122
 
126 123
 #if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
127 124
   #define Z_MIN_PROBE_PIN  49

Loading…
Отказ
Запис