瀏覽代碼

Move M380_M381 to cpp, solenoid feature

Scott Lahteine 8 年之前
父節點
當前提交
4a220a8b79

+ 0
- 4
Marlin/src/Marlin.cpp 查看文件

352
   return false;
352
   return false;
353
 }
353
 }
354
 
354
 
355
-#if ENABLED(EXT_SOLENOID)
356
-  #include "gcode/control/M380_M381.h"
357
-#endif
358
-
359
 #include "gcode/control/M400.h"
355
 #include "gcode/control/M400.h"
360
 
356
 
361
 #if HAS_BED_PROBE
357
 #if HAS_BED_PROBE

Marlin/src/gcode/control/M380_M381.h → Marlin/src/feature/solenoid.cpp 查看文件

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
+#include "../inc/MarlinConfig.h"
24
+
23
 #if ENABLED(EXT_SOLENOID)
25
 #if ENABLED(EXT_SOLENOID)
24
 
26
 
25
-void enable_solenoid(const uint8_t num) {
27
+#include "solenoid.h"
28
+
29
+#include "../module/motion.h" // for active_extruder
30
+
31
+inline void enable_solenoid(const uint8_t num) {
26
   switch (num) {
32
   switch (num) {
27
     case 0:
33
     case 0:
28
       OUT_WRITE(SOL0_PIN, HIGH);
34
       OUT_WRITE(SOL0_PIN, HIGH);
72
   #endif
78
   #endif
73
 }
79
 }
74
 
80
 
75
-/**
76
- * M380: Enable solenoid on the active extruder
77
- */
78
-void gcode_M380() {
79
-
80
-  enable_solenoid_on_active_extruder();
81
-
82
-}
83
-
84
-/**
85
- * M381: Disable all solenoids
86
- */
87
-void gcode_M381() {
88
-
89
-  disable_all_solenoids();
90
-
91
-}
92
-
93
 #endif // EXT_SOLENOID
81
 #endif // EXT_SOLENOID

+ 29
- 0
Marlin/src/feature/solenoid.h 查看文件

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 __SOLENOID_H__
24
+#define __SOLENOID_H__
25
+
26
+void enable_solenoid_on_active_extruder();
27
+void disable_all_solenoids();
28
+
29
+#endif // __SOLENOID_H__

+ 40
- 0
Marlin/src/gcode/control/M380_M381.cpp 查看文件

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(EXT_SOLENOID)
26
+
27
+#include "../gcode.h"
28
+#include "../../feature/solenoid.h"
29
+
30
+/**
31
+ * M380: Enable solenoid on the active extruder
32
+ */
33
+void GcodeSuite::M380() { enable_solenoid_on_active_extruder(); }
34
+
35
+/**
36
+ * M381: Disable all solenoids
37
+ */
38
+void GcodeSuite::M381() { disable_all_solenoids(); }
39
+
40
+#endif // EXT_SOLENOID

+ 2
- 8
Marlin/src/gcode/gcode.cpp 查看文件

122
 extern void gcode_M350();
122
 extern void gcode_M350();
123
 extern void gcode_M351();
123
 extern void gcode_M351();
124
 extern void gcode_M355();
124
 extern void gcode_M355();
125
-extern void gcode_M380();
126
-extern void gcode_M381();
127
 extern void gcode_M400();
125
 extern void gcode_M400();
128
 extern void gcode_M401();
126
 extern void gcode_M401();
129
 extern void gcode_M402();
127
 extern void gcode_M402();
597
       #endif
595
       #endif
598
 
596
 
599
       #if ENABLED(EXT_SOLENOID)
597
       #if ENABLED(EXT_SOLENOID)
600
-        case 380: // M380: Activate solenoid on active extruder
601
-          gcode_M380();
602
-          break;
603
-        case 381: // M381: Disable all solenoids
604
-          gcode_M381();
605
-          break;
598
+        case 380: M380(); break;  // M380: Activate solenoid on active extruder
599
+        case 381: M381(); break;  // M381: Disable all solenoids
606
       #endif
600
       #endif
607
 
601
 
608
       case 400: // M400: Finish all moves
602
       case 400: // M400: Finish all moves

+ 4
- 0
Marlin/src/module/tool_change.cpp 查看文件

34
   #include "../gcode/gcode.h" // for dwell()
34
   #include "../gcode/gcode.h" // for dwell()
35
 #endif
35
 #endif
36
 
36
 
37
+#if ENABLED(EXT_SOLENOID) && !ENABLED(PARKING_EXTRUDER)
38
+  #include "../feature/solenoid.h"
39
+#endif
40
+
37
 #if ENABLED(SWITCHING_EXTRUDER)
41
 #if ENABLED(SWITCHING_EXTRUDER)
38
 
42
 
39
   #if EXTRUDERS > 3
43
   #if EXTRUDERS > 3

Loading…
取消
儲存