소스 검색

Move T (tool change) to cpp

Scott Lahteine 6 년 전
부모
커밋
07cf75883f
6개의 변경된 파일24개의 추가작업 그리고 20개의 파일을 삭제
  1. 5
    13
      Marlin/src/Marlin.cpp
  2. 6
    1
      Marlin/src/gcode/control/T.cpp
  3. 1
    5
      Marlin/src/gcode/gcode.cpp
  4. 1
    1
      Marlin/src/gcode/gcode.h
  5. 9
    0
      Marlin/src/module/tool_change.cpp
  6. 2
    0
      Marlin/src/module/tool_change.h

+ 5
- 13
Marlin/src/Marlin.cpp 파일 보기

54
   #include "libs/buzzer.h"
54
   #include "libs/buzzer.h"
55
 #endif
55
 #endif
56
 
56
 
57
-#if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE)
58
-  #include "module/tool_change.h"
59
-#endif
60
-
61
 #if ENABLED(DIGIPOT_I2C)
57
 #if ENABLED(DIGIPOT_I2C)
62
   #include "feature/digipot/digipot.h"
58
   #include "feature/digipot/digipot.h"
63
 #endif
59
 #endif
138
   #include "feature/caselight.h"
134
   #include "feature/caselight.h"
139
 #endif
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
 bool Running = true;
141
 bool Running = true;
142
 
142
 
143
 /**
143
 /**
320
   SYNC_PLAN_POSITION_KINEMATIC();
320
   SYNC_PLAN_POSITION_KINEMATIC();
321
 }
321
 }
322
 
322
 
323
-#include "gcode/control/T.h"
324
-
325
 #if ENABLED(USE_CONTROLLER_FAN)
323
 #if ENABLED(USE_CONTROLLER_FAN)
326
 
324
 
327
   void controllerFan() {
325
   void controllerFan() {
932
   #endif
930
   #endif
933
 
931
 
934
   #if ENABLED(PARKING_EXTRUDER)
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
   #endif
934
   #endif
943
 }
935
 }
944
 
936
 

Marlin/src/gcode/control/T.h → Marlin/src/gcode/control/T.cpp 파일 보기

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
+#include "../gcode.h"
23
 #include "../../module/tool_change.h"
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
  * T0-T3: Switch tool, usually switching extruders
31
  * T0-T3: Switch tool, usually switching extruders
27
  *
32
  *
28
  *   F[units/min] Set the movement feedrate
33
  *   F[units/min] Set the movement feedrate
29
  *   S1           Don't move the tool in XY after change
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
   #if ENABLED(DEBUG_LEVELING_FEATURE)
38
   #if ENABLED(DEBUG_LEVELING_FEATURE)
34
     if (DEBUGGING(LEVELING)) {
39
     if (DEBUGGING(LEVELING)) {

+ 1
- 5
Marlin/src/gcode/gcode.cpp 파일 보기

116
 //
116
 //
117
 // Placeholders for non-migrated codes
117
 // Placeholders for non-migrated codes
118
 //
118
 //
119
-extern void gcode_T(uint8_t tmp_extruder);
120
-
121
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
119
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
122
   extern void M100_dump_routine(const char * const title, const char *start, const char *end);
120
   extern void M100_dump_routine(const char * const title, const char *start, const char *end);
123
 #endif
121
 #endif
690
     }
688
     }
691
     break;
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
     default: parser.unknown_command_error();
693
     default: parser.unknown_command_error();
698
   }
694
   }

+ 1
- 1
Marlin/src/gcode/gcode.h 파일 보기

722
 
722
 
723
   static void M999();
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
 
84
 
85
 #if ENABLED(PARKING_EXTRUDER)
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
   void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) {
96
   void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) {
88
     switch (extruder_num) {
97
     switch (extruder_num) {
89
       case 1: OUT_WRITE(SOL1_PIN, state); break;
98
       case 1: OUT_WRITE(SOL1_PIN, state); break;

+ 2
- 0
Marlin/src/module/tool_change.h 파일 보기

46
   inline void pe_activate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, PE_MAGNET_ON_STATE); }
46
   inline void pe_activate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, PE_MAGNET_ON_STATE); }
47
   inline void pe_deactivate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, !PE_MAGNET_ON_STATE); }
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
 #endif // PARKING_EXTRUDER
51
 #endif // PARKING_EXTRUDER
50
 
52
 
51
 /**
53
 /**

Loading…
취소
저장