瀏覽代碼

Merge branch 'deltabot' into Marlin_v1

Erik van der Zalm 12 年之前
父節點
當前提交
ac975ed8c2
共有 1 個檔案被更改,包括 39 行新增9 行删除
  1. 39
    9
      Marlin/Marlin_main.cpp

+ 39
- 9
Marlin/Marlin_main.cpp 查看文件

@@ -808,9 +808,42 @@ void process_commands()
808 808
       for(int8_t i=0; i < NUM_AXIS; i++) {
809 809
         destination[i] = current_position[i];
810 810
       }
811
-      feedrate = 0.0;
812
-      home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])))
813
-                    || ((code_seen(axis_codes[0])) && (code_seen(axis_codes[1])) && (code_seen(axis_codes[2])));
811
+          feedrate = 0.0;
812
+
813
+#ifdef DELTA
814
+          // A delta can only safely home all axis at the same time
815
+          // all axis have to home at the same time
816
+
817
+          // Move all carriages up together until the first endstop is hit.
818
+          current_position[X_AXIS] = 0;
819
+          current_position[Y_AXIS] = 0;
820
+          current_position[Z_AXIS] = 0;
821
+          plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
822
+
823
+          destination[X_AXIS] = 3 * Z_MAX_LENGTH;
824
+          destination[Y_AXIS] = 3 * Z_MAX_LENGTH;
825
+          destination[Z_AXIS] = 3 * Z_MAX_LENGTH;
826
+          feedrate = 1.732 * homing_feedrate[X_AXIS];
827
+          plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
828
+          st_synchronize();
829
+          endstops_hit_on_purpose();
830
+
831
+          current_position[X_AXIS] = destination[X_AXIS];
832
+          current_position[Y_AXIS] = destination[Y_AXIS];
833
+          current_position[Z_AXIS] = destination[Z_AXIS];
834
+          
835
+          // take care of back off and rehome now we are all at the top
836
+          HOMEAXIS(X);
837
+          HOMEAXIS(Y);
838
+          HOMEAXIS(Z);
839
+
840
+          calculate_delta(current_position);
841
+          plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
842
+
843
+#else // NOT DELTA
844
+
845
+          home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
846
+
814 847
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
815 848
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
816 849
         HOMEAXIS(Z);
@@ -879,12 +912,9 @@ void process_commands()
879 912
           current_position[Z_AXIS]=code_value()+add_homeing[2];
880 913
         }
881 914
       }
882
-      #ifdef DELTA
883
-        calculate_delta(current_position);
884
-        plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
885
-      #else
886
-        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
887
-      #endif
915
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
916
+#endif // DELTA
917
+          
888 918
       #ifdef ENDSTOPS_ONLY_FOR_HOMING
889 919
         enable_endstops(false);
890 920
       #endif

Loading…
取消
儲存