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
 extern float homing_feedrate[];
112
 extern float homing_feedrate[];
113
 extern bool axis_relative_modes[];
113
 extern bool axis_relative_modes[];
114
 extern float current_position[NUM_AXIS] ;
114
 extern float current_position[NUM_AXIS] ;
115
+extern float add_homeing[3];
115
 
116
 
116
 #endif
117
 #endif

+ 14
- 3
Marlin/Marlin.pde View File

104
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
104
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
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
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
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
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
 // M220 - set speed factor override percentage S:factor in percent
108
 // M220 - set speed factor override percentage S:factor in percent
108
 // M301 - Set PID parameters P I and D
109
 // M301 - Set PID parameters P I and D
109
 // M400 - Finish all moves
110
 // M400 - Finish all moves
131
 int saved_feedmultiply;
132
 int saved_feedmultiply;
132
 volatile bool feedmultiplychanged=false;
133
 volatile bool feedmultiplychanged=false;
133
 float current_position[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
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
 //=============================private variables=============================
138
 //=============================private variables=============================
536
       }
537
       }
537
       feedrate = 0.0;
538
       feedrate = 0.0;
538
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
539
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
539
-
540
+      
540
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
541
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
541
       {
542
       {
542
         HOMEAXIS(X);
543
         HOMEAXIS(X);
544
+	current_position[0]=code_value()+add_homeing[0];
543
       }
545
       }
544
 
546
 
545
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
547
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
546
        HOMEAXIS(Y);
548
        HOMEAXIS(Y);
549
+       current_position[1]=code_value()+add_homeing[1];
547
       }
550
       }
548
 
551
 
549
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
552
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
550
         HOMEAXIS(Z);
553
         HOMEAXIS(Z);
554
+	current_position[2]=code_value()+add_homeing[2];
551
       }       
555
       }       
556
+      
552
       feedrate = saved_feedrate;
557
       feedrate = saved_feedrate;
553
       feedmultiply = saved_feedmultiply;
558
       feedmultiply = saved_feedmultiply;
554
       previous_millis_cmd = millis();
559
       previous_millis_cmd = millis();
565
         st_synchronize();
570
         st_synchronize();
566
       for(int8_t i=0; i < NUM_AXIS; i++) {
571
       for(int8_t i=0; i < NUM_AXIS; i++) {
567
         if(code_seen(axis_codes[i])) { 
572
         if(code_seen(axis_codes[i])) { 
568
-           current_position[i] = code_value();  
573
+           current_position[i] = code_value()+add_homeing[i];  
569
            if(i == E_AXIS) {
574
            if(i == E_AXIS) {
570
              plan_set_e_position(current_position[E_AXIS]);
575
              plan_set_e_position(current_position[E_AXIS]);
571
            }
576
            }
934
       if(code_seen('Z')) max_z_jerk = code_value() ;
939
       if(code_seen('Z')) max_z_jerk = code_value() ;
935
     }
940
     }
936
     break;
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
     case 220: // M220 S<factor in percent>- set speed factor override percentage
948
     case 220: // M220 S<factor in percent>- set speed factor override percentage
938
     {
949
     {
939
       if(code_seen('S')) 
950
       if(code_seen('S')) 

Loading…
Cancel
Save