소스 검색

[ToolChanger] Lock the current tool at power-up (#17093)

MangaValk 4 년 전
부모
커밋
57f488738b
No account linked to committer's email address
3개의 변경된 파일18개의 추가작업 그리고 5개의 파일을 삭제
  1. 5
    1
      Marlin/src/MarlinCore.cpp
  2. 9
    4
      Marlin/src/module/tool_change.cpp
  3. 4
    0
      Marlin/src/module/tool_change.h

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

165
   #include "feature/fanmux.h"
165
   #include "feature/fanmux.h"
166
 #endif
166
 #endif
167
 
167
 
168
-#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
168
+#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, ELECTROMAGNETIC_SWITCHING_TOOLHEAD, SWITCHING_TOOLHEAD)
169
   #include "module/tool_change.h"
169
   #include "module/tool_change.h"
170
 #endif
170
 #endif
171
 
171
 
1110
     pe_solenoid_init();
1110
     pe_solenoid_init();
1111
   #endif
1111
   #endif
1112
 
1112
 
1113
+  #if ENABLED(SWITCHING_TOOLHEAD)
1114
+    swt_init();
1115
+  #endif
1116
+
1113
   #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
1117
   #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
1114
     est_init();
1118
     est_init();
1115
   #endif
1119
   #endif

+ 9
- 4
Marlin/src/module/tool_change.cpp 파일 보기

368
 
368
 
369
 #if ENABLED(SWITCHING_TOOLHEAD)
369
 #if ENABLED(SWITCHING_TOOLHEAD)
370
 
370
 
371
+  inline void swt_lock(const bool locked=true) {
372
+    const uint16_t swt_angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES;
373
+    MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, swt_angles[locked ? 0 : 1]);
374
+  }
375
+
376
+  void swt_init() { swt_lock(); }
377
+
371
   inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
378
   inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
372
     if (no_move) return;
379
     if (no_move) return;
373
 
380
 
374
-    constexpr uint16_t angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES;
375
-
376
     constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS;
381
     constexpr float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS;
377
     const float placexpos = toolheadposx[active_extruder],
382
     const float placexpos = toolheadposx[active_extruder],
378
                 grabxpos = toolheadposx[new_tool];
383
                 grabxpos = toolheadposx[new_tool];
406
 
411
 
407
     planner.synchronize();
412
     planner.synchronize();
408
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
413
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
409
-    MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[1]);
414
+    swt_lock(false);
410
     safe_delay(500);
415
     safe_delay(500);
411
 
416
 
412
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
417
     current_position.y = SWITCHING_TOOLHEAD_Y_POS;
451
     // Wait for move to finish, pause 0.2s, move servo, pause 0.5s
456
     // Wait for move to finish, pause 0.2s, move servo, pause 0.5s
452
     planner.synchronize();
457
     planner.synchronize();
453
     safe_delay(200);
458
     safe_delay(200);
454
-    MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[0]);
459
+    swt_lock();
455
     safe_delay(500);
460
     safe_delay(500);
456
 
461
 
457
     current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
462
     current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;

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

97
   void est_init();
97
   void est_init();
98
 #endif
98
 #endif
99
 
99
 
100
+#if ENABLED(SWITCHING_TOOLHEAD)
101
+  void swt_init();
102
+#endif
103
+
100
 /**
104
 /**
101
  * Perform a tool-change, which may result in moving the
105
  * Perform a tool-change, which may result in moving the
102
  * previous tool out of the way and the new tool into place.
106
  * previous tool out of the way and the new tool into place.

Loading…
취소
저장