1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

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

This commit is contained in:
Bernhard 2011-11-27 17:27:17 +01:00
parent d2f034ba84
commit 2d9a715655
2 changed files with 15 additions and 3 deletions

View File

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

View File

@ -104,6 +104,7 @@
// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec // 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 // 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 // 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 // M220 - set speed factor override percentage S:factor in percent
// M301 - Set PID parameters P I and D // M301 - Set PID parameters P I and D
// M400 - Finish all moves // M400 - Finish all moves
@ -131,7 +132,7 @@ volatile int feedmultiply=100; //100->1 200->2
int saved_feedmultiply; int saved_feedmultiply;
volatile bool feedmultiplychanged=false; volatile bool feedmultiplychanged=false;
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0}; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
float add_homeing[3]={0,0,0};
//=========================================================================== //===========================================================================
//=============================private variables============================= //=============================private variables=============================
@ -536,19 +537,23 @@ inline void process_commands()
} }
feedrate = 0.0; feedrate = 0.0;
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); 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]))) if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
{ {
HOMEAXIS(X); HOMEAXIS(X);
current_position[0]=code_value()+add_homeing[0];
} }
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) { if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
HOMEAXIS(Y); HOMEAXIS(Y);
current_position[1]=code_value()+add_homeing[1];
} }
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
HOMEAXIS(Z); HOMEAXIS(Z);
current_position[2]=code_value()+add_homeing[2];
} }
feedrate = saved_feedrate; feedrate = saved_feedrate;
feedmultiply = saved_feedmultiply; feedmultiply = saved_feedmultiply;
previous_millis_cmd = millis(); previous_millis_cmd = millis();
@ -565,7 +570,7 @@ inline void process_commands()
st_synchronize(); st_synchronize();
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) { if(code_seen(axis_codes[i])) {
current_position[i] = code_value(); current_position[i] = code_value()+add_homeing[i];
if(i == E_AXIS) { if(i == E_AXIS) {
plan_set_e_position(current_position[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() ; if(code_seen('Z')) max_z_jerk = code_value() ;
} }
break; 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<factor in percent>- set speed factor override percentage case 220: // M220 S<factor in percent>- set speed factor override percentage
{ {
if(code_seen('S')) if(code_seen('S'))