Browse Source

Move M702 MK2_MULTIPLEXER to cpp

Scott Lahteine 7 years ago
parent
commit
75cf17d816

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

359
   SYNC_PLAN_POSITION_KINEMATIC();
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
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
362
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
367
   #include "gcode/control/M605.h"
363
   #include "gcode/control/M605.h"
368
 #endif
364
 #endif

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

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

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
  *
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
  * M702: Unload all extruders
31
  * M702: Unload all extruders
34
  */
32
  */
35
-void gcode_M702() {
33
+void GcodeSuite::M702() {
36
   for (uint8_t s = 0; s < E_STEPPERS; s++) {
34
   for (uint8_t s = 0; s < E_STEPPERS; s++) {
37
-    select_multiplexed_stepper(e);
35
+    select_multiplexed_stepper(s);
38
     // TODO: standard unload filament function
36
     // TODO: standard unload filament function
39
     // MK2 firmware behavior:
37
     // MK2 firmware behavior:
40
     //  - Make sure temperature is high enough
38
     //  - Make sure temperature is high enough
48
   select_multiplexed_stepper(active_extruder);
46
   select_multiplexed_stepper(active_extruder);
49
   disable_e_steppers();
47
   disable_e_steppers();
50
 }
48
 }
49
+
50
+#endif // MK2_MULTIPLEXER

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

123
 extern void gcode_M351();
123
 extern void gcode_M351();
124
 extern void gcode_M355();
124
 extern void gcode_M355();
125
 extern void gcode_M605();
125
 extern void gcode_M605();
126
-extern void gcode_M702();
127
 extern void gcode_M900();
126
 extern void gcode_M900();
128
 extern void gcode_M906();
127
 extern void gcode_M906();
129
 extern void gcode_M911();
128
 extern void gcode_M911();
658
       #endif // DUAL_X_CARRIAGE
657
       #endif // DUAL_X_CARRIAGE
659
 
658
 
660
       #if ENABLED(MK2_MULTIPLEXER)
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
       #endif
661
       #endif
665
 
662
 
666
       #if ENABLED(LIN_ADVANCE)
663
       #if ENABLED(LIN_ADVANCE)

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

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

Loading…
Cancel
Save