Parcourir la source

various changes

Erik van der Zalm il y a 13 ans
Parent
révision
a0a1f81913
3 fichiers modifiés avec 28 ajouts et 22 suppressions
  1. 10
    19
      Marlin/Marlin.pde
  2. 17
    2
      Marlin/planner.cpp
  3. 1
    1
      Marlin/planner.h

+ 10
- 19
Marlin/Marlin.pde Voir le fichier

@@ -509,11 +509,9 @@ bool code_seen(char code)
509 509
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
510 510
     \
511 511
     current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? 0 : LETTER##_MAX_LENGTH;\
512
-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
513 512
     destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
514 513
     feedrate = 0.0;\
515 514
     st_synchronize();\
516
-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
517 515
     endstops_hit_on_purpose();\
518 516
   }
519 517
 
@@ -567,7 +565,7 @@ void process_commands()
567 565
       feedrate = 0.0;
568 566
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
569 567
       #ifdef QUICK_HOME
570
-      if( code_seen(axis_codes[0]) && code_seen(axis_codes[1]) )  //first diagonal move
568
+      if( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS]) )  //first diagonal move
571 569
       {
572 570
         current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;  
573 571
 
@@ -585,10 +583,10 @@ void process_commands()
585 583
         destination[Y_AXIS] = current_position[Y_AXIS];
586 584
         feedrate = 0.0;
587 585
         st_synchronize();
588
-        plan_set_position(0, 0, current_position[Z_AXIS], current_position[E_AXIS]);
589
-        current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
590 586
         endstops_hit_on_purpose();
591 587
       }
588
+      else
589
+      {
592 590
       #endif
593 591
       
594 592
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
@@ -599,7 +597,11 @@ void process_commands()
599 597
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
600 598
        HOMEAXIS(Y);
601 599
       }
602
-
600
+      
601
+      #ifdef QUICK_HOME
602
+      }
603
+      #endif
604
+      
603 605
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
604 606
         HOMEAXIS(Z);
605 607
       }
@@ -616,6 +618,8 @@ void process_commands()
616 618
       if(code_seen(axis_codes[Z_AXIS])) {
617 619
         current_position[2]=code_value()+add_homeing[2];
618 620
       }
621
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
622
+      
619 623
       #ifdef ENDSTOPS_ONLY_FOR_HOMING
620 624
         enable_endstops(false);
621 625
       #endif
@@ -1254,19 +1258,6 @@ void get_arc_coordinates()
1254 1258
 
1255 1259
 void prepare_move()
1256 1260
 {
1257
-  
1258
-  if (min_software_endstops) {
1259
-    if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0;
1260
-    if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0;
1261
-    if (destination[Z_AXIS] < 0) destination[Z_AXIS] = 0.0;
1262
-  }
1263
-
1264
-  if (max_software_endstops) {
1265
-    if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
1266
-    if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
1267
-    if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
1268
-  }
1269
-
1270 1261
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
1271 1262
   for(int8_t i=0; i < NUM_AXIS; i++) {
1272 1263
     current_position[i] = destination[i];

+ 17
- 2
Marlin/planner.cpp Voir le fichier

@@ -439,11 +439,24 @@ float junction_deviation = 0.1;
439 439
 // Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in 
440 440
 // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
441 441
 // calculation the caller must also provide the physical length of the line in millimeters.
442
-void plan_buffer_line(const float &x, const float &y, const float &z, const float &e,  float feed_rate, const uint8_t &extruder)
442
+void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder)
443 443
 {
444 444
   // Calculate the buffer head after we push this byte
445 445
   int next_buffer_head = next_block_index(block_buffer_head);
446 446
 
447
+  
448
+  if (min_software_endstops) {
449
+    if (x < 0) x = 0;
450
+    if (y < 0) y = 0;
451
+    if (z < 0) z = 0;
452
+  }
453
+
454
+  if (max_software_endstops) {
455
+    if (x > X_MAX_LENGTH) x = X_MAX_LENGTH;
456
+    if (y > Y_MAX_LENGTH) y = Y_MAX_LENGTH;
457
+    if (z > Z_MAX_LENGTH) z = Z_MAX_LENGTH;
458
+  }
459
+  
447 460
   // If the buffer is full: good! That means we are well ahead of the robot. 
448 461
   // Rest here until there is room in the buffer.
449 462
   while(block_buffer_tail == next_buffer_head) { 
@@ -451,7 +464,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
451 464
     manage_inactivity(1); 
452 465
     LCD_STATUS;
453 466
   }
454
-
467
+  
455 468
   // The target position of the tool in absolute steps
456 469
   // Calculate target position in absolute steps
457 470
   //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
@@ -461,6 +474,8 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
461 474
   target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);     
462 475
   target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);
463 476
   
477
+
478
+  
464 479
   #ifdef PREVENT_DANGEROUS_EXTRUDE
465 480
     if(target[E_AXIS]!=position[E_AXIS])
466 481
     if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)

+ 1
- 1
Marlin/planner.h Voir le fichier

@@ -67,7 +67,7 @@ void plan_init();
67 67
 
68 68
 // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
69 69
 // millimaters. Feed rate specifies the speed of the motion.
70
-void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
70
+void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder);
71 71
 
72 72
 // Set position. Used for G92 instructions.
73 73
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);

Chargement…
Annuler
Enregistrer