Browse Source

Move M702 MK2_MULTIPLEXER to cpp

Scott Lahteine 6 years ago
parent
commit
75cf17d816

+ 0
- 4
Marlin/src/Marlin.cpp View File

@@ -359,10 +359,6 @@ void quickstop_stepper() {
359 359
   SYNC_PLAN_POSITION_KINEMATIC();
360 360
 }
361 361
 
362
-#if ENABLED(MK2_MULTIPLEXER)
363
-  #include "gcode/feature/snmm/M702.h"
364
-#endif
365
-
366 362
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
367 363
   #include "gcode/control/M605.h"
368 364
 #endif

+ 38
- 0
Marlin/src/feature/snmm.cpp View File

@@ -0,0 +1,38 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(MK2_MULTIPLEXER)
26
+
27
+#include "../module/stepper.h"
28
+
29
+void select_multiplexed_stepper(const uint8_t e) {
30
+  stepper.synchronize();
31
+  disable_e_steppers();
32
+  WRITE(E_MUX0_PIN, TEST(e, 0) ? HIGH : LOW);
33
+  WRITE(E_MUX1_PIN, TEST(e, 1) ? HIGH : LOW);
34
+  WRITE(E_MUX2_PIN, TEST(e, 2) ? HIGH : LOW);
35
+  safe_delay(100);
36
+}
37
+
38
+#endif // MK2_MULTIPLEXER

+ 28
- 0
Marlin/src/feature/snmm.h View File

@@ -0,0 +1,28 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef __SNMM_H__
24
+#define __SNMM_H__
25
+
26
+void select_multiplexed_stepper(const uint8_t e);
27
+
28
+#endif // __SNMM_H__

Marlin/src/gcode/feature/snmm/M702.h → Marlin/src/gcode/feature/snmm/M702.cpp View File

@@ -20,21 +20,19 @@
20 20
  *
21 21
  */
22 22
 
23
-inline void select_multiplexed_stepper(const uint8_t e) {
24
-  stepper.synchronize();
25
-  disable_e_steppers();
26
-  WRITE(E_MUX0_PIN, TEST(e, 0) ? HIGH : LOW);
27
-  WRITE(E_MUX1_PIN, TEST(e, 1) ? HIGH : LOW);
28
-  WRITE(E_MUX2_PIN, TEST(e, 2) ? HIGH : LOW);
29
-  safe_delay(100);
30
-}
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(MK2_MULTIPLEXER)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../feature/snmm.h"
31 29
 
32 30
 /**
33 31
  * M702: Unload all extruders
34 32
  */
35
-void gcode_M702() {
33
+void GcodeSuite::M702() {
36 34
   for (uint8_t s = 0; s < E_STEPPERS; s++) {
37
-    select_multiplexed_stepper(e);
35
+    select_multiplexed_stepper(s);
38 36
     // TODO: standard unload filament function
39 37
     // MK2 firmware behavior:
40 38
     //  - Make sure temperature is high enough
@@ -48,3 +46,5 @@ void gcode_M702() {
48 46
   select_multiplexed_stepper(active_extruder);
49 47
   disable_e_steppers();
50 48
 }
49
+
50
+#endif // MK2_MULTIPLEXER

+ 1
- 4
Marlin/src/gcode/gcode.cpp View File

@@ -123,7 +123,6 @@ extern void gcode_M350();
123 123
 extern void gcode_M351();
124 124
 extern void gcode_M355();
125 125
 extern void gcode_M605();
126
-extern void gcode_M702();
127 126
 extern void gcode_M900();
128 127
 extern void gcode_M906();
129 128
 extern void gcode_M911();
@@ -658,9 +657,7 @@ void GcodeSuite::process_next_command() {
658 657
       #endif // DUAL_X_CARRIAGE
659 658
 
660 659
       #if ENABLED(MK2_MULTIPLEXER)
661
-        case 702: // M702: Unload all extruders
662
-          gcode_M702();
663
-          break;
660
+        case 702: M702(); break;  // M702: Unload all extruders
664 661
       #endif
665 662
 
666 663
       #if ENABLED(LIN_ADVANCE)

+ 4
- 0
Marlin/src/module/tool_change.cpp View File

@@ -38,6 +38,10 @@
38 38
   #include "../feature/solenoid.h"
39 39
 #endif
40 40
 
41
+#if ENABLED(MK2_MULTIPLEXER)
42
+  #include "../feature/snmm.h"
43
+#endif
44
+
41 45
 #if ENABLED(SWITCHING_EXTRUDER)
42 46
 
43 47
   #if EXTRUDERS > 3

Loading…
Cancel
Save