瀏覽代碼

Fixed homing

Erik van der Zalm 13 年之前
父節點
當前提交
b48d67ce10
共有 4 個檔案被更改,包括 32 行新增17 行删除
  1. 18
    2
      Marlin/Marlin.pde
  2. 12
    0
      Marlin/motion_control.cpp
  3. 0
    13
      Marlin/planner.cpp
  4. 2
    2
      Marlin/temperature.cpp

+ 18
- 2
Marlin/Marlin.pde 查看文件

513
     destination[LETTER##_AXIS] = 1.5 * LETTER##_MAX_LENGTH * LETTER##_HOME_DIR; \
513
     destination[LETTER##_AXIS] = 1.5 * LETTER##_MAX_LENGTH * LETTER##_HOME_DIR; \
514
     feedrate = homing_feedrate[LETTER##_AXIS]; \
514
     feedrate = homing_feedrate[LETTER##_AXIS]; \
515
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
515
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
516
+    st_synchronize();\
516
     \
517
     \
517
     current_position[LETTER##_AXIS] = 0;\
518
     current_position[LETTER##_AXIS] = 0;\
518
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
519
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
519
     destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
520
     destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
520
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
521
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
522
+    st_synchronize();\
521
     \
523
     \
522
     destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
524
     destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
523
     feedrate = homing_feedrate[LETTER##_AXIS]/2 ;  \
525
     feedrate = homing_feedrate[LETTER##_AXIS]/2 ;  \
524
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
526
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
527
+    st_synchronize();\
525
     \
528
     \
526
     current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
529
     current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
527
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
530
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
528
     feedrate = 0.0;\
531
     feedrate = 0.0;\
529
-    st_synchronize();\
530
     endstops_hit_on_purpose();\
532
     endstops_hit_on_purpose();\
531
   }
533
   }
532
 
534
 
589
         feedrate = homing_feedrate[X_AXIS]; 
591
         feedrate = homing_feedrate[X_AXIS]; 
590
         if(homing_feedrate[Y_AXIS]<feedrate)
592
         if(homing_feedrate[Y_AXIS]<feedrate)
591
           feedrate =homing_feedrate[Y_AXIS]; 
593
           feedrate =homing_feedrate[Y_AXIS]; 
592
-        prepare_move(); 
594
+        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
595
+        st_synchronize();
593
     
596
     
594
         current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
597
         current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
595
         current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
598
         current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
596
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
599
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
597
         destination[X_AXIS] = current_position[X_AXIS];
600
         destination[X_AXIS] = current_position[X_AXIS];
598
         destination[Y_AXIS] = current_position[Y_AXIS];
601
         destination[Y_AXIS] = current_position[Y_AXIS];
602
+        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
599
         feedrate = 0.0;
603
         feedrate = 0.0;
600
         st_synchronize();
604
         st_synchronize();
601
         endstops_hit_on_purpose();
605
         endstops_hit_on_purpose();
1273
 
1277
 
1274
 void prepare_move()
1278
 void prepare_move()
1275
 {
1279
 {
1280
+  if (min_software_endstops) {
1281
+    if (destination[X_AXIS] < X_HOME_POS) destination[X_AXIS] = X_HOME_POS;
1282
+    if (destination[Y_AXIS] < Y_HOME_POS) destination[Y_AXIS] = Y_HOME_POS;
1283
+    if (destination[Z_AXIS] < Z_HOME_POS) destination[Z_AXIS] = Z_HOME_POS;
1284
+  }
1285
+
1286
+  if (max_software_endstops) {
1287
+    if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
1288
+    if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
1289
+    if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
1290
+  }
1291
+  
1276
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
1292
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
1277
   for(int8_t i=0; i < NUM_AXIS; i++) {
1293
   for(int8_t i=0; i < NUM_AXIS; i++) {
1278
     current_position[i] = destination[i];
1294
     current_position[i] = destination[i];

+ 12
- 0
Marlin/motion_control.cpp 查看文件

122
     arc_target[axis_1] = center_axis1 + r_axis1;
122
     arc_target[axis_1] = center_axis1 + r_axis1;
123
     arc_target[axis_linear] += linear_per_segment;
123
     arc_target[axis_linear] += linear_per_segment;
124
     arc_target[E_AXIS] += extruder_per_segment;
124
     arc_target[E_AXIS] += extruder_per_segment;
125
+
126
+    if (min_software_endstops) {
127
+      if (arc_target[X_AXIS] < X_HOME_POS) arc_target[X_AXIS] = X_HOME_POS;
128
+      if (arc_target[Y_AXIS] < Y_HOME_POS) arc_target[Y_AXIS] = Y_HOME_POS;
129
+      if (arc_target[Z_AXIS] < Z_HOME_POS) arc_target[Z_AXIS] = Z_HOME_POS;
130
+    }
131
+
132
+    if (max_software_endstops) {
133
+      if (arc_target[X_AXIS] > X_MAX_LENGTH) arc_target[X_AXIS] = X_MAX_LENGTH;
134
+      if (arc_target[Y_AXIS] > Y_MAX_LENGTH) arc_target[Y_AXIS] = Y_MAX_LENGTH;
135
+      if (arc_target[Z_AXIS] > Z_MAX_LENGTH) arc_target[Z_AXIS] = Z_MAX_LENGTH;
136
+    }
125
     plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, extruder);
137
     plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, extruder);
126
     
138
     
127
   }
139
   }

+ 0
- 13
Marlin/planner.cpp 查看文件

446
   // Calculate the buffer head after we push this byte
446
   // Calculate the buffer head after we push this byte
447
   int next_buffer_head = next_block_index(block_buffer_head);
447
   int next_buffer_head = next_block_index(block_buffer_head);
448
 
448
 
449
-  
450
-  if (min_software_endstops) {
451
-    if (x < X_HOME_POS) x = X_HOME_POS;
452
-    if (y < Y_HOME_POS) y = Y_HOME_POS;
453
-    if (z < Z_HOME_POS) z = Z_HOME_POS;
454
-  }
455
-
456
-  if (max_software_endstops) {
457
-    if (x > X_MAX_LENGTH) x = X_MAX_LENGTH;
458
-    if (y > Y_MAX_LENGTH) y = Y_MAX_LENGTH;
459
-    if (z > Z_MAX_LENGTH) z = Z_MAX_LENGTH;
460
-  }
461
-  
462
   // If the buffer is full: good! That means we are well ahead of the robot. 
449
   // If the buffer is full: good! That means we are well ahead of the robot. 
463
   // Rest here until there is room in the buffer.
450
   // Rest here until there is room in the buffer.
464
   while(block_buffer_tail == next_buffer_head) { 
451
   while(block_buffer_tail == next_buffer_head) { 

+ 2
- 2
Marlin/temperature.cpp 查看文件

851
     for(unsigned char e = 0; e < EXTRUDERS; e++) {
851
     for(unsigned char e = 0; e < EXTRUDERS; e++) {
852
        if(current_raw[e] >= maxttemp[e]) {
852
        if(current_raw[e] >= maxttemp[e]) {
853
           target_raw[e] = 0;
853
           target_raw[e] = 0;
854
+          max_temp_error(e);
854
           #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
855
           #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
855
           {
856
           {
856
-            max_temp_error(e);
857
             kill();;
857
             kill();;
858
           }
858
           }
859
           #endif
859
           #endif
860
        }
860
        }
861
        if(current_raw[e] <= minttemp[e]) {
861
        if(current_raw[e] <= minttemp[e]) {
862
           target_raw[e] = 0;
862
           target_raw[e] = 0;
863
+          min_temp_error(e);
863
           #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
864
           #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
864
           {
865
           {
865
-            min_temp_error(e);
866
             kill();
866
             kill();
867
           }
867
           }
868
           #endif
868
           #endif

Loading…
取消
儲存