Bläddra i källkod

Fixed HOME_POS in combination with G28 X0 or G28 Y0

Erik van der Zalm 13 år sedan
förälder
incheckning
b4833d55c2
2 ändrade filer med 15 tillägg och 6 borttagningar
  1. 14
    5
      Marlin/Marlin.pde
  2. 1
    1
      Marlin/stepper.cpp

+ 14
- 5
Marlin/Marlin.pde Visa fil

@@ -490,10 +490,12 @@ float code_value()
490 490
 { 
491 491
   return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL)); 
492 492
 }
493
+
493 494
 long code_value_long() 
494 495
 { 
495 496
   return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10)); 
496 497
 }
498
+
497 499
 bool code_seen(char code_string[]) //Return True if the string was found
498 500
 { 
499 501
   return (strstr(cmdbuffer[bufindr], code_string) != NULL); 
@@ -504,6 +506,7 @@ bool code_seen(char code)
504 506
   strchr_pointer = strchr(cmdbuffer[bufindr], code);
505 507
   return (strchr_pointer != NULL);  //Return True if a character was found
506 508
 }
509
+
507 510
 #define HOMEAXIS(LETTER) \
508 511
   if ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))\
509 512
     { \
@@ -590,7 +593,7 @@ void process_commands()
590 593
         feedrate = homing_feedrate[X_AXIS]; 
591 594
         if(homing_feedrate[Y_AXIS]<feedrate)
592 595
           feedrate =homing_feedrate[Y_AXIS]; 
593
-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
596
+        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
594 597
         st_synchronize();
595 598
     
596 599
         current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
@@ -598,7 +601,7 @@ void process_commands()
598 601
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
599 602
         destination[X_AXIS] = current_position[X_AXIS];
600 603
         destination[Y_AXIS] = current_position[Y_AXIS];
601
-        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
604
+        plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
602 605
         feedrate = 0.0;
603 606
         st_synchronize();
604 607
         endstops_hit_on_purpose();
@@ -620,15 +623,21 @@ void process_commands()
620 623
       
621 624
       if(code_seen(axis_codes[X_AXIS])) 
622 625
       {
623
-        current_position[0]=code_value()+add_homeing[0];
626
+        if(code_value_long() != 0) {
627
+          current_position[X_AXIS]=code_value()+add_homeing[0];
628
+        }
624 629
       }
625 630
 
626 631
       if(code_seen(axis_codes[Y_AXIS])) {
627
-        current_position[1]=code_value()+add_homeing[1];
632
+        if(code_value_long() != 0) {
633
+          current_position[Y_AXIS]=code_value()+add_homeing[1];
634
+        }
628 635
       }
629 636
 
630 637
       if(code_seen(axis_codes[Z_AXIS])) {
631
-        current_position[2]=code_value()+add_homeing[2];
638
+        if(code_value_long() != 0) {
639
+          current_position[Z_AXIS]=code_value()+add_homeing[2];
640
+        }
632 641
       }
633 642
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
634 643
       

+ 1
- 1
Marlin/stepper.cpp Visa fil

@@ -432,7 +432,7 @@ ISR(TIMER1_COMPA_vect)
432 432
       }
433 433
       else { // +direction
434 434
         NORM_E_DIR();
435
-        count_direction[E_AXIS]=-1;
435
+        count_direction[E_AXIS]=1;
436 436
       }
437 437
     #endif //!ADVANCE
438 438
     

Laddar…
Avbryt
Spara