diff --git a/dda.c b/dda.c index bb122b6..db77f67 100644 --- a/dda.c +++ b/dda.c @@ -228,15 +228,15 @@ void dda_create(DDA *dda, TARGET *target) { if (target->all_relative) { x_delta_um = labs(target->X); um_to_steps_x(dda->x_delta, x_delta_um); - dda->x_direction = (target->X < 0)?1:0; + dda->x_direction = (target->X >= 0)?1:0; y_delta_um = labs(target->Y); um_to_steps_y(dda->y_delta, y_delta_um); - dda->y_direction = (target->Y < 0)?1:0; + dda->y_direction = (target->Y >= 0)?1:0; z_delta_um = labs(target->Z); um_to_steps_z(dda->z_delta, z_delta_um); - dda->z_direction = (target->Z < 0)?1:0; + dda->z_direction = (target->Z >= 0)?1:0; } else { x_delta_um = (uint32_t)labs(target->X - startpoint.X); @@ -262,7 +262,7 @@ void dda_create(DDA *dda, TARGET *target) { if (target->all_relative || target->e_relative) { e_delta_um = labs(target->E); um_to_steps_e(dda->e_delta, e_delta_um); - dda->e_direction = (target->E < 0)?1:0; + dda->e_direction = (target->E >= 0)?1:0; } else { e_delta_um = (uint32_t)labs(target->E - startpoint.E); diff --git a/gcode_process.c b/gcode_process.c index 8941bf7..268b4be 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -73,7 +73,7 @@ void process_gcode_command() { #ifdef X_MAX if (next_target.target.all_relative) { if (next_target.target.X += startpoint.X > X_MAX * 1000.) - next_target.target.X = X_MIN * 1000. - startpoint.X; + next_target.target.X = X_MAX * 1000. - startpoint.X; } else { if (next_target.target.X > X_MAX * 1000.) @@ -93,7 +93,7 @@ void process_gcode_command() { #ifdef Y_MAX if (next_target.target.all_relative) { if (next_target.target.Y += startpoint.Y > Y_MAX * 1000.) - next_target.target.Y = Y_MIN * 1000. - startpoint.Y; + next_target.target.Y = Y_MAX * 1000. - startpoint.Y; } else { if (next_target.target.Y > Y_MAX * 1000.) @@ -113,7 +113,7 @@ void process_gcode_command() { #ifdef Z_MAX if (next_target.target.all_relative) { if (next_target.target.Z += startpoint.Z > Z_MAX * 1000.) - next_target.target.Z = Z_MIN * 1000. - startpoint.Z; + next_target.target.Z = Z_MAX * 1000. - startpoint.Z; } else { if (next_target.target.Z > Z_MAX * 1000.) @@ -424,8 +424,8 @@ void process_gcode_command() { case 82: //? --- M82 - Set E codes absolute --- //? - //? This is the default. M82/M82 is not documented in the - //? RepRap wiki, behaviours was taken from Strinter as of March 2012. + //? This is the default. M82/M83 is not documented in the + //? RepRap wiki, behaviours was taken from Sprinter as of March 2012. // No wait_queue() needed. next_target.target.e_relative = 0;