소스 검색

Fixed soft limits when the origin is in the middle.

HOME_POS is now always where the endstop is and can be outside the limits.
The limits are now defined by MIN_POS and MAX_POS rather than HOME_POS and MAX_LENGTH.
The Z is axis now homed first if direction is away from the bed.

Saguinololu limit pins change from MIN to MAX according to the homing direction.
Chris Palmer 12 년 전
부모
커밋
538189cc19
3개의 변경된 파일51개의 추가작업 그리고 19개의 파일을 삭제
  1. 11
    3
      Marlin/Configuration.h
  2. 19
    10
      Marlin/Marlin.pde
  3. 21
    6
      Marlin/pins.h

+ 11
- 3
Marlin/Configuration.h 파일 보기

@@ -187,9 +187,17 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
187 187
 
188 188
 #define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
189 189
 #define max_software_endstops true  //If true, axis won't move to coordinates greater than the defined lengths below.
190
-#define X_MAX_LENGTH 205
191
-#define Y_MAX_LENGTH 205
192
-#define Z_MAX_LENGTH 200
190
+// Travel limits after homing
191
+#define X_MAX_POS 205
192
+#define X_MIN_POS 0
193
+#define Y_MAX_POS 205
194
+#define Y_MIN_POS 0
195
+#define Z_MAX_POS 200
196
+#define Z_MIN_POS 0
197
+
198
+#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
199
+#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
200
+#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
193 201
 
194 202
 // The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
195 203
 #define X_HOME_POS 0

+ 19
- 10
Marlin/Marlin.pde 파일 보기

@@ -562,7 +562,7 @@ bool code_seen(char code)
562 562
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
563 563
     st_synchronize();\
564 564
     \
565
-    current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
565
+    current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\
566 566
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
567 567
     feedrate = 0.0;\
568 568
     endstops_hit_on_purpose();\
@@ -656,6 +656,13 @@ void process_commands()
656 656
       }
657 657
       feedrate = 0.0;
658 658
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
659
+      
660
+      #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
661
+      if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
662
+        HOMEAXIS(Z);
663
+      }
664
+      #endif
665
+      
659 666
       #ifdef QUICK_HOME
660 667
       if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) )  //first diagonal move
661 668
       {
@@ -669,8 +676,8 @@ void process_commands()
669 676
         plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
670 677
         st_synchronize();
671 678
     
672
-        current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
673
-        current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
679
+        current_position[X_AXIS] = X_HOME_POS;
680
+        current_position[Y_AXIS] = Y_HOME_POS;
674 681
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
675 682
         destination[X_AXIS] = current_position[X_AXIS];
676 683
         destination[Y_AXIS] = current_position[Y_AXIS];
@@ -687,12 +694,14 @@ void process_commands()
687 694
       }
688 695
 
689 696
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
690
-       HOMEAXIS(Y);
697
+        HOMEAXIS(Y);
691 698
       }
692 699
       
700
+      #if Z_HOME_DIR < 0                      // If homing towards BED do Z last
693 701
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
694 702
         HOMEAXIS(Z);
695 703
       }
704
+      #endif
696 705
       
697 706
       if(code_seen(axis_codes[X_AXIS])) 
698 707
       {
@@ -1533,15 +1542,15 @@ void get_arc_coordinates()
1533 1542
 void prepare_move()
1534 1543
 {
1535 1544
   if (min_software_endstops) {
1536
-    if (destination[X_AXIS] < X_HOME_POS) destination[X_AXIS] = X_HOME_POS;
1537
-    if (destination[Y_AXIS] < Y_HOME_POS) destination[Y_AXIS] = Y_HOME_POS;
1538
-    if (destination[Z_AXIS] < Z_HOME_POS) destination[Z_AXIS] = Z_HOME_POS;
1545
+    if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS;
1546
+    if (destination[Y_AXIS] < Y_MIN_POS) destination[Y_AXIS] = Y_MIN_POS;
1547
+    if (destination[Z_AXIS] < Z_MIN_POS) destination[Z_AXIS] = Z_MIN_POS;
1539 1548
   }
1540 1549
 
1541 1550
   if (max_software_endstops) {
1542
-    if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
1543
-    if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
1544
-    if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
1551
+    if (destination[X_AXIS] > X_MAX_POS) destination[X_AXIS] = X_MAX_POS;
1552
+    if (destination[Y_AXIS] > Y_MAX_POS) destination[Y_AXIS] = Y_MAX_POS;
1553
+    if (destination[Z_AXIS] > Z_MAX_POS) destination[Z_AXIS] = Z_MAX_POS;
1545 1554
   }
1546 1555
   previous_millis_cmd = millis();  
1547 1556
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);

+ 21
- 6
Marlin/pins.h 파일 보기

@@ -572,18 +572,33 @@
572 572
 
573 573
 #define X_STEP_PIN         15
574 574
 #define X_DIR_PIN          21
575
-#define X_MIN_PIN          18
576
-#define X_MAX_PIN           -1
575
+#if X_HOME_DIR < 0
576
+# define X_MIN_PIN          18 
577
+# define X_MAX_PIN          -1
578
+#else
579
+# define X_MIN_PIN          -1
580
+# define X_MAX_PIN          18
581
+#endif
577 582
 
578 583
 #define Y_STEP_PIN         22
579 584
 #define Y_DIR_PIN          23
580
-#define Y_MIN_PIN          19
581
-#define Y_MAX_PIN          -1
585
+#if Y_HOME_DIR < 0
586
+# define Y_MIN_PIN          19 
587
+# define Y_MAX_PIN          -1
588
+#else
589
+# define Y_MIN_PIN          -1
590
+# define Y_MAX_PIN          19
591
+#endif
582 592
 
583 593
 #define Z_STEP_PIN         3
584 594
 #define Z_DIR_PIN          2
585
-#define Z_MIN_PIN          20
586
-#define Z_MAX_PIN          -1
595
+#if Z_HOME_DIR < 0
596
+# define Z_MIN_PIN          20 
597
+# define Z_MAX_PIN          -1
598
+#else
599
+# define Z_MIN_PIN          -1
600
+# define Z_MAX_PIN          20
601
+#endif
587 602
 
588 603
 #define E0_STEP_PIN         1
589 604
 #define E0_DIR_PIN          0

Loading…
취소
저장