From 2d9a7156555e0cdd969b44cc7c4d3c8a18875cfe Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sun, 27 Nov 2011 17:27:17 +0100 Subject: [PATCH] first naive attempt to have a offset in the homeing procedure. Does not enable to move into regions not allowed by endstops. --- Marlin/Marlin.h | 1 + Marlin/Marlin.pde | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 20032a685..69a0cf3e2 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -112,5 +112,6 @@ void prepare_arc_move(char isclockwise); extern float homing_feedrate[]; extern bool axis_relative_modes[]; extern float current_position[NUM_AXIS] ; +extern float add_homeing[3]; #endif diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 9cf499809..6a07cf989 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -104,6 +104,7 @@ // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec // 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 // M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk +// M206 - set additional homeing offset // M220 - set speed factor override percentage S:factor in percent // M301 - Set PID parameters P I and D // M400 - Finish all moves @@ -131,7 +132,7 @@ volatile int feedmultiply=100; //100->1 200->2 int saved_feedmultiply; volatile bool feedmultiplychanged=false; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0}; - +float add_homeing[3]={0,0,0}; //=========================================================================== //=============================private variables============================= @@ -536,19 +537,23 @@ inline void process_commands() } feedrate = 0.0; home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); - + if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) { HOMEAXIS(X); + current_position[0]=code_value()+add_homeing[0]; } if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) { HOMEAXIS(Y); + current_position[1]=code_value()+add_homeing[1]; } if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { HOMEAXIS(Z); + current_position[2]=code_value()+add_homeing[2]; } + feedrate = saved_feedrate; feedmultiply = saved_feedmultiply; previous_millis_cmd = millis(); @@ -565,7 +570,7 @@ inline void process_commands() st_synchronize(); for(int8_t i=0; i < NUM_AXIS; i++) { if(code_seen(axis_codes[i])) { - current_position[i] = code_value(); + current_position[i] = code_value()+add_homeing[i]; if(i == E_AXIS) { plan_set_e_position(current_position[E_AXIS]); } @@ -934,6 +939,12 @@ inline void process_commands() if(code_seen('Z')) max_z_jerk = code_value() ; } break; + case 206: // M206 additional homeing offset + for(int8_t i=0; i < 3; i++) + { + if(code_seen(axis_codes[i])) add_homeing[i] = code_value(); + } + break; case 220: // M220 S- set speed factor override percentage { if(code_seen('S'))