Browse Source

first naive attempt to have a offset in the homeing procedure. Does not enable to move into regions not allowed by endstops.

Bernhard 13 years ago
parent
commit
2d9a715655
2 changed files with 15 additions and 3 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 14
    3
      Marlin/Marlin.pde

+ 1
- 0
Marlin/Marlin.h View File

@@ -112,5 +112,6 @@ void prepare_arc_move(char isclockwise);
112 112
 extern float homing_feedrate[];
113 113
 extern bool axis_relative_modes[];
114 114
 extern float current_position[NUM_AXIS] ;
115
+extern float add_homeing[3];
115 116
 
116 117
 #endif

+ 14
- 3
Marlin/Marlin.pde View File

@@ -104,6 +104,7 @@
104 104
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
105 105
 // M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
106 106
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
107
+// M206 - set additional homeing offset
107 108
 // M220 - set speed factor override percentage S:factor in percent
108 109
 // M301 - Set PID parameters P I and D
109 110
 // M400 - Finish all moves
@@ -131,7 +132,7 @@ volatile int feedmultiply=100; //100->1 200->2
131 132
 int saved_feedmultiply;
132 133
 volatile bool feedmultiplychanged=false;
133 134
 float current_position[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
134
-
135
+float add_homeing[3]={0,0,0};
135 136
 
136 137
 //===========================================================================
137 138
 //=============================private variables=============================
@@ -536,19 +537,23 @@ inline void process_commands()
536 537
       }
537 538
       feedrate = 0.0;
538 539
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
539
-
540
+      
540 541
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
541 542
       {
542 543
         HOMEAXIS(X);
544
+	current_position[0]=code_value()+add_homeing[0];
543 545
       }
544 546
 
545 547
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
546 548
        HOMEAXIS(Y);
549
+       current_position[1]=code_value()+add_homeing[1];
547 550
       }
548 551
 
549 552
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
550 553
         HOMEAXIS(Z);
554
+	current_position[2]=code_value()+add_homeing[2];
551 555
       }       
556
+      
552 557
       feedrate = saved_feedrate;
553 558
       feedmultiply = saved_feedmultiply;
554 559
       previous_millis_cmd = millis();
@@ -565,7 +570,7 @@ inline void process_commands()
565 570
         st_synchronize();
566 571
       for(int8_t i=0; i < NUM_AXIS; i++) {
567 572
         if(code_seen(axis_codes[i])) { 
568
-           current_position[i] = code_value();  
573
+           current_position[i] = code_value()+add_homeing[i];  
569 574
            if(i == E_AXIS) {
570 575
              plan_set_e_position(current_position[E_AXIS]);
571 576
            }
@@ -934,6 +939,12 @@ inline void process_commands()
934 939
       if(code_seen('Z')) max_z_jerk = code_value() ;
935 940
     }
936 941
     break;
942
+    case 206: // M206 additional homeing offset
943
+      for(int8_t i=0; i < 3; i++) 
944
+      {
945
+        if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
946
+      }
947
+      break;
937 948
     case 220: // M220 S<factor in percent>- set speed factor override percentage
938 949
     {
939 950
       if(code_seen('S')) 

Loading…
Cancel
Save