浏览代码

Move T (tool change) to cpp

Scott Lahteine 6 年前
父节点
当前提交
07cf75883f

+ 5
- 13
Marlin/src/Marlin.cpp 查看文件

@@ -54,10 +54,6 @@
54 54
   #include "libs/buzzer.h"
55 55
 #endif
56 56
 
57
-#if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE)
58
-  #include "module/tool_change.h"
59
-#endif
60
-
61 57
 #if ENABLED(DIGIPOT_I2C)
62 58
   #include "feature/digipot/digipot.h"
63 59
 #endif
@@ -138,6 +134,10 @@
138 134
   #include "feature/caselight.h"
139 135
 #endif
140 136
 
137
+#if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
138
+  #include "module/tool_change.h"
139
+#endif
140
+
141 141
 bool Running = true;
142 142
 
143 143
 /**
@@ -320,8 +320,6 @@ void quickstop_stepper() {
320 320
   SYNC_PLAN_POSITION_KINEMATIC();
321 321
 }
322 322
 
323
-#include "gcode/control/T.h"
324
-
325 323
 #if ENABLED(USE_CONTROLLER_FAN)
326 324
 
327 325
   void controllerFan() {
@@ -932,13 +930,7 @@ void setup() {
932 930
   #endif
933 931
 
934 932
   #if ENABLED(PARKING_EXTRUDER)
935
-    #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
936
-      pe_activate_magnet(0);
937
-      pe_activate_magnet(1);
938
-    #else
939
-      pe_deactivate_magnet(0);
940
-      pe_deactivate_magnet(1);
941
-    #endif
933
+    pe_magnet_init();
942 934
   #endif
943 935
 }
944 936
 

Marlin/src/gcode/control/T.h → Marlin/src/gcode/control/T.cpp 查看文件

@@ -20,15 +20,20 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../gcode.h"
23 24
 #include "../../module/tool_change.h"
24 25
 
26
+#if ENABLED(DEBUG_LEVELING_FEATURE) || HOTENDS > 1
27
+  #include "../../module/motion.h"
28
+#endif
29
+
25 30
 /**
26 31
  * T0-T3: Switch tool, usually switching extruders
27 32
  *
28 33
  *   F[units/min] Set the movement feedrate
29 34
  *   S1           Don't move the tool in XY after change
30 35
  */
31
-void gcode_T(uint8_t tmp_extruder) {
36
+void GcodeSuite::T(const uint8_t tmp_extruder) {
32 37
 
33 38
   #if ENABLED(DEBUG_LEVELING_FEATURE)
34 39
     if (DEBUGGING(LEVELING)) {

+ 1
- 5
Marlin/src/gcode/gcode.cpp 查看文件

@@ -116,8 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
116 116
 //
117 117
 // Placeholders for non-migrated codes
118 118
 //
119
-extern void gcode_T(uint8_t tmp_extruder);
120
-
121 119
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
122 120
   extern void M100_dump_routine(const char * const title, const char *start, const char *end);
123 121
 #endif
@@ -690,9 +688,7 @@ void GcodeSuite::process_next_command() {
690 688
     }
691 689
     break;
692 690
 
693
-    case 'T':
694
-      gcode_T(parser.codenum);
695
-      break;
691
+    case 'T': T(parser.codenum); break; // Tn: Tool Change
696 692
 
697 693
     default: parser.unknown_command_error();
698 694
   }

+ 1
- 1
Marlin/src/gcode/gcode.h 查看文件

@@ -722,7 +722,7 @@ private:
722 722
 
723 723
   static void M999();
724 724
 
725
-  static void T(uint8_t tmp_extruder);
725
+  static void T(const uint8_t tmp_extruder);
726 726
 
727 727
 };
728 728
 

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

@@ -84,6 +84,15 @@
84 84
 
85 85
 #if ENABLED(PARKING_EXTRUDER)
86 86
 
87
+  void pe_magnet_init() {
88
+    for (uint8_t n = 0; n <= 1; ++n)
89
+      #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
90
+        pe_activate_magnet(n);
91
+      #else
92
+        pe_deactivate_magnet(n);
93
+      #endif
94
+  }
95
+
87 96
   void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) {
88 97
     switch (extruder_num) {
89 98
       case 1: OUT_WRITE(SOL1_PIN, state); break;

+ 2
- 0
Marlin/src/module/tool_change.h 查看文件

@@ -46,6 +46,8 @@
46 46
   inline void pe_activate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, PE_MAGNET_ON_STATE); }
47 47
   inline void pe_deactivate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, !PE_MAGNET_ON_STATE); }
48 48
 
49
+  void pe_magnet_init();
50
+
49 51
 #endif // PARKING_EXTRUDER
50 52
 
51 53
 /**

正在加载...
取消
保存