Przeglądaj źródła

Added software endstops

Erik van der Zalm 12 lat temu
rodzic
commit
915ef2d4a1
2 zmienionych plików z 13 dodań i 1 usunięć
  1. 12
    0
      Marlin/Marlin.pde
  2. 1
    1
      Marlin/planner.h

+ 12
- 0
Marlin/Marlin.pde Wyświetl plik

@@ -1024,6 +1024,18 @@ inline void get_arc_coordinates()
1024 1024
 
1025 1025
 void prepare_move()
1026 1026
 {
1027
+  if (min_software_endstops) {
1028
+    if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0;
1029
+    if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0;
1030
+    if (destination[Z_AXIS] < 0) destination[Z_AXIS] = 0.0;
1031
+  }
1032
+
1033
+  if (max_software_endstops) {
1034
+    if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
1035
+    if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
1036
+    if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
1037
+  }
1038
+
1027 1039
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0);
1028 1040
   for(int8_t i=0; i < NUM_AXIS; i++) {
1029 1041
     current_position[i] = destination[i];

+ 1
- 1
Marlin/planner.h Wyświetl plik

@@ -31,7 +31,7 @@
31 31
 typedef struct {
32 32
   // Fields used by the bresenham algorithm for tracing the line
33 33
   long steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
34
-  long step_event_count;                    // The number of step events required to complete this block
34
+  unsigned long step_event_count;           // The number of step events required to complete this block
35 35
   long accelerate_until;                    // The index of the step event on which to stop acceleration
36 36
   long decelerate_after;                    // The index of the step event on which to start decelerating
37 37
   long acceleration_rate;                   // The acceleration rate used for acceleration calculation

Ładowanie…
Anuluj
Zapisz