Fixed HOME_POS in combination with G28 X0 or G28 Y0

master
Erik van der Zalm 13 years ago
parent c6f2ec3c82
commit b4833d55c2

@ -490,10 +490,12 @@ float code_value()
{ {
return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL)); return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL));
} }
long code_value_long() long code_value_long()
{ {
return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10)); return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10));
} }
bool code_seen(char code_string[]) //Return True if the string was found bool code_seen(char code_string[]) //Return True if the string was found
{ {
return (strstr(cmdbuffer[bufindr], code_string) != NULL); return (strstr(cmdbuffer[bufindr], code_string) != NULL);
@ -504,6 +506,7 @@ bool code_seen(char code)
strchr_pointer = strchr(cmdbuffer[bufindr], code); strchr_pointer = strchr(cmdbuffer[bufindr], code);
return (strchr_pointer != NULL); //Return True if a character was found return (strchr_pointer != NULL); //Return True if a character was found
} }
#define HOMEAXIS(LETTER) \ #define HOMEAXIS(LETTER) \
if ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))\ if ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))\
{ \ { \
@ -590,7 +593,7 @@ void process_commands()
feedrate = homing_feedrate[X_AXIS]; feedrate = homing_feedrate[X_AXIS];
if(homing_feedrate[Y_AXIS]<feedrate) if(homing_feedrate[Y_AXIS]<feedrate)
feedrate =homing_feedrate[Y_AXIS]; feedrate =homing_feedrate[Y_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
st_synchronize(); st_synchronize();
current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH; current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
@ -598,7 +601,7 @@ void process_commands()
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[X_AXIS] = current_position[X_AXIS]; destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
feedrate = 0.0; feedrate = 0.0;
st_synchronize(); st_synchronize();
endstops_hit_on_purpose(); endstops_hit_on_purpose();
@ -620,15 +623,21 @@ void process_commands()
if(code_seen(axis_codes[X_AXIS])) if(code_seen(axis_codes[X_AXIS]))
{ {
current_position[0]=code_value()+add_homeing[0]; if(code_value_long() != 0) {
current_position[X_AXIS]=code_value()+add_homeing[0];
}
} }
if(code_seen(axis_codes[Y_AXIS])) { if(code_seen(axis_codes[Y_AXIS])) {
current_position[1]=code_value()+add_homeing[1]; if(code_value_long() != 0) {
current_position[Y_AXIS]=code_value()+add_homeing[1];
}
} }
if(code_seen(axis_codes[Z_AXIS])) { if(code_seen(axis_codes[Z_AXIS])) {
current_position[2]=code_value()+add_homeing[2]; if(code_value_long() != 0) {
current_position[Z_AXIS]=code_value()+add_homeing[2];
}
} }
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);

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

Loading…
Cancel
Save