瀏覽代碼

Additional 5 extruders support (solenoids, microstepping)

Scott Lahteine 7 年之前
父節點
當前提交
0ac2b5c045
共有 4 個檔案被更改,包括 81 行新增6 行删除
  1. 4
    0
      Marlin/Conditionals_post.h
  2. 20
    6
      Marlin/Marlin_main.cpp
  3. 48
    0
      Marlin/stepper.cpp
  4. 9
    0
      Marlin/thermistortables.h

+ 4
- 0
Marlin/Conditionals_post.h 查看文件

@@ -487,15 +487,19 @@
487 487
   #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
488 488
   #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
489 489
   #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
490
+  #define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
490 491
   #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
491 492
   #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
492 493
   #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
494
+  #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
493 495
   #define HAS_MICROSTEPS_X (PIN_EXISTS(X_MS1))
494 496
   #define HAS_MICROSTEPS_Y (PIN_EXISTS(Y_MS1))
495 497
   #define HAS_MICROSTEPS_Z (PIN_EXISTS(Z_MS1))
496 498
   #define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
497 499
   #define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
498 500
   #define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
501
+  #define HAS_MICROSTEPS_E3 (PIN_EXISTS(E3_MS1))
502
+  #define HAS_MICROSTEPS_E4 (PIN_EXISTS(E4_MS1))
499 503
   #define HAS_MICROSTEPS (HAS_MICROSTEPS_X || HAS_MICROSTEPS_Y || HAS_MICROSTEPS_Z || HAS_MICROSTEPS_E0 || HAS_MICROSTEPS_E1 || HAS_MICROSTEPS_E2)
500 504
   #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
501 505
   #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))

+ 20
- 6
Marlin/Marlin_main.cpp 查看文件

@@ -7599,21 +7599,26 @@ inline void gcode_M303() {
7599 7599
       case 0:
7600 7600
         OUT_WRITE(SOL0_PIN, HIGH);
7601 7601
         break;
7602
-        #if HAS_SOLENOID_1
7602
+        #if HAS_SOLENOID_1 && EXTRUDERS > 1
7603 7603
           case 1:
7604 7604
             OUT_WRITE(SOL1_PIN, HIGH);
7605 7605
             break;
7606 7606
         #endif
7607
-        #if HAS_SOLENOID_2
7607
+        #if HAS_SOLENOID_2 && EXTRUDERS > 2
7608 7608
           case 2:
7609 7609
             OUT_WRITE(SOL2_PIN, HIGH);
7610 7610
             break;
7611 7611
         #endif
7612
-        #if HAS_SOLENOID_3
7612
+        #if HAS_SOLENOID_3 && EXTRUDERS > 3
7613 7613
           case 3:
7614 7614
             OUT_WRITE(SOL3_PIN, HIGH);
7615 7615
             break;
7616 7616
         #endif
7617
+        #if HAS_SOLENOID_4 && EXTRUDERS > 4
7618
+          case 4:
7619
+            OUT_WRITE(SOL4_PIN, HIGH);
7620
+            break;
7621
+        #endif
7617 7622
       default:
7618 7623
         SERIAL_ECHO_START;
7619 7624
         SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
@@ -7625,9 +7630,18 @@ inline void gcode_M303() {
7625 7630
 
7626 7631
   void disable_all_solenoids() {
7627 7632
     OUT_WRITE(SOL0_PIN, LOW);
7628
-    OUT_WRITE(SOL1_PIN, LOW);
7629
-    OUT_WRITE(SOL2_PIN, LOW);
7630
-    OUT_WRITE(SOL3_PIN, LOW);
7633
+    #if HAS_SOLENOID_1 && EXTRUDERS > 1
7634
+      OUT_WRITE(SOL1_PIN, LOW);
7635
+    #endif
7636
+    #if HAS_SOLENOID_2 && EXTRUDERS > 2
7637
+      OUT_WRITE(SOL2_PIN, LOW);
7638
+    #endif
7639
+    #if HAS_SOLENOID_3 && EXTRUDERS > 3
7640
+      OUT_WRITE(SOL3_PIN, LOW);
7641
+    #endif
7642
+    #if HAS_SOLENOID_4 && EXTRUDERS > 4
7643
+      OUT_WRITE(SOL4_PIN, LOW);
7644
+    #endif
7631 7645
   }
7632 7646
 
7633 7647
   /**

+ 48
- 0
Marlin/stepper.cpp 查看文件

@@ -1076,6 +1076,9 @@ void Stepper::init() {
1076 1076
   #if HAS_E3_STEP
1077 1077
     E_AXIS_INIT(3);
1078 1078
   #endif
1079
+  #if HAS_E4_STEP
1080
+    E_AXIS_INIT(4);
1081
+  #endif
1079 1082
 
1080 1083
   // waveform generation = 0100 = CTC
1081 1084
   CBI(TCCR1B, WGM13);
@@ -1477,6 +1480,18 @@ void Stepper::report_positions() {
1477 1480
       SET_OUTPUT(E1_MS1_PIN);
1478 1481
       SET_OUTPUT(E1_MS2_PIN);
1479 1482
     #endif
1483
+    #if HAS_MICROSTEPS_E2
1484
+      SET_OUTPUT(E2_MS1_PIN);
1485
+      SET_OUTPUT(E2_MS2_PIN);
1486
+    #endif
1487
+    #if HAS_MICROSTEPS_E3
1488
+      SET_OUTPUT(E3_MS1_PIN);
1489
+      SET_OUTPUT(E3_MS2_PIN);
1490
+    #endif
1491
+    #if HAS_MICROSTEPS_E4
1492
+      SET_OUTPUT(E4_MS1_PIN);
1493
+      SET_OUTPUT(E4_MS2_PIN);
1494
+    #endif
1480 1495
     static const uint8_t microstep_modes[] = MICROSTEP_MODES;
1481 1496
     for (uint16_t i = 0; i < COUNT(microstep_modes); i++)
1482 1497
       microstep_mode(i, microstep_modes[i]);
@@ -1497,6 +1512,15 @@ void Stepper::report_positions() {
1497 1512
       #if HAS_MICROSTEPS_E1
1498 1513
         case 4: WRITE(E1_MS1_PIN, ms1); break;
1499 1514
       #endif
1515
+      #if HAS_MICROSTEPS_E2
1516
+        case 5: WRITE(E2_MS1_PIN, ms1); break;
1517
+      #endif
1518
+      #if HAS_MICROSTEPS_E3
1519
+        case 6: WRITE(E3_MS1_PIN, ms1); break;
1520
+      #endif
1521
+      #if HAS_MICROSTEPS_E4
1522
+        case 7: WRITE(E4_MS1_PIN, ms1); break;
1523
+      #endif
1500 1524
     }
1501 1525
     if (ms2 >= 0) switch (driver) {
1502 1526
       case 0: WRITE(X_MS2_PIN, ms2); break;
@@ -1512,6 +1536,15 @@ void Stepper::report_positions() {
1512 1536
       #if HAS_MICROSTEPS_E1
1513 1537
         case 4: WRITE(E1_MS2_PIN, ms2); break;
1514 1538
       #endif
1539
+      #if HAS_MICROSTEPS_E2
1540
+        case 5: WRITE(E2_MS2_PIN, ms2); break;
1541
+      #endif
1542
+      #if HAS_MICROSTEPS_E3
1543
+        case 6: WRITE(E3_MS2_PIN, ms2); break;
1544
+      #endif
1545
+      #if HAS_MICROSTEPS_E4
1546
+        case 7: WRITE(E4_MS2_PIN, ms2); break;
1547
+      #endif
1515 1548
     }
1516 1549
   }
1517 1550
 
@@ -1550,6 +1583,21 @@ void Stepper::report_positions() {
1550 1583
       SERIAL_PROTOCOL(READ(E1_MS1_PIN));
1551 1584
       SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
1552 1585
     #endif
1586
+    #if HAS_MICROSTEPS_E2
1587
+      SERIAL_PROTOCOLPGM("E2: ");
1588
+      SERIAL_PROTOCOL(READ(E2_MS1_PIN));
1589
+      SERIAL_PROTOCOLLN(READ(E2_MS2_PIN));
1590
+    #endif
1591
+    #if HAS_MICROSTEPS_E3
1592
+      SERIAL_PROTOCOLPGM("E3: ");
1593
+      SERIAL_PROTOCOL(READ(E3_MS1_PIN));
1594
+      SERIAL_PROTOCOLLN(READ(E3_MS2_PIN));
1595
+    #endif
1596
+    #if HAS_MICROSTEPS_E4
1597
+      SERIAL_PROTOCOLPGM("E4: ");
1598
+      SERIAL_PROTOCOL(READ(E4_MS1_PIN));
1599
+      SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));
1600
+    #endif
1553 1601
   }
1554 1602
 
1555 1603
 #endif // HAS_MICROSTEPS

+ 9
- 0
Marlin/thermistortables.h 查看文件

@@ -226,6 +226,15 @@
226 226
     #define HEATER_3_RAW_LO_TEMP 0
227 227
   #endif
228 228
 #endif
229
+#ifndef HEATER_4_RAW_HI_TEMP
230
+  #ifdef HEATER_4_USES_THERMISTOR
231
+    #define HEATER_4_RAW_HI_TEMP 0
232
+    #define HEATER_4_RAW_LO_TEMP 16383
233
+  #else
234
+    #define HEATER_4_RAW_HI_TEMP 16383
235
+    #define HEATER_4_RAW_LO_TEMP 0
236
+  #endif
237
+#endif
229 238
 #ifndef HEATER_BED_RAW_HI_TEMP
230 239
   #ifdef BED_USES_THERMISTOR
231 240
     #define HEATER_BED_RAW_HI_TEMP 0

Loading…
取消
儲存