Store distances in the TARGET strucure in micrometers for all axes.

This extends the previous commit from X to Y, Z and E.
This commit is contained in:
Markus Hitter 2011-10-14 15:17:32 +02:00
parent c96ea0c773
commit 4e5f51f01e
13 changed files with 145 additions and 110 deletions

View File

@ -64,11 +64,11 @@
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm) valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
*/ */
#define STEPS_PER_M_X 320000 #define STEPS_PER_M_X 320000
#define STEPS_PER_MM_Y 320.000 #define STEPS_PER_M_Y 320000
#define STEPS_PER_MM_Z 320.000 #define STEPS_PER_M_Z 320000
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E 320.000 #define STEPS_PER_M_E 320000
/* /*

View File

@ -61,11 +61,11 @@
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm) valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
*/ */
#define STEPS_PER_M_X 320000 #define STEPS_PER_M_X 320000
#define STEPS_PER_MM_Y 320.000 #define STEPS_PER_M_Y 320000
#define STEPS_PER_MM_Z 200.000 #define STEPS_PER_M_Z 200000
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E 320.000 #define STEPS_PER_M_E 320000
/* /*

View File

@ -66,11 +66,11 @@
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm) valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
*/ */
#define STEPS_PER_M_X (5000*8) #define STEPS_PER_M_X (5000*8)
#define STEPS_PER_MM_Y (320.000*8) #define STEPS_PER_M_Y (5000*8)
#define STEPS_PER_MM_Z (200.000*8) #define STEPS_PER_M_Z (160000*8)
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E (320.000*8) #define STEPS_PER_M_E (160000*8)
/* /*

View File

@ -69,11 +69,11 @@
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm) valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
*/ */
#define STEPS_PER_M_X 40000 #define STEPS_PER_M_X 40000
#define STEPS_PER_MM_Y 40.000 #define STEPS_PER_M_Y 40000
#define STEPS_PER_MM_Z 320.000 #define STEPS_PER_M_Z 320000
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E 96.271 #define STEPS_PER_M_E 96271
/* /*

View File

@ -71,11 +71,11 @@
#define MICROSTEPPING_E 4.0 #define MICROSTEPPING_E 4.0
#define STEPS_PER_M_X (5023*MICROSTEPPING_X) #define STEPS_PER_M_X (5023*MICROSTEPPING_X)
#define STEPS_PER_MM_Y (5.023*MICROSTEPPING_Y) #define STEPS_PER_M_Y (5023*MICROSTEPPING_Y)
#define STEPS_PER_MM_Z (416.699*MICROSTEPPING_Z) #define STEPS_PER_M_Z (416699*MICROSTEPPING_Z)
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E (2.759*MICROSTEPPING_E) #define STEPS_PER_M_E (2759*MICROSTEPPING_E)
/* /*

View File

@ -71,11 +71,11 @@
#define MICROSTEPPING_E 4.0 #define MICROSTEPPING_E 4.0
#define STEPS_PER_M_X (5023*MICROSTEPPING_X) #define STEPS_PER_M_X (5023*MICROSTEPPING_X)
#define STEPS_PER_MM_Y (5.023*MICROSTEPPING_Y) #define STEPS_PER_M_Y (5023*MICROSTEPPING_Y)
#define STEPS_PER_MM_Z (416.699*MICROSTEPPING_Z) #define STEPS_PER_M_Z (416699*MICROSTEPPING_Z)
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E (2.759*MICROSTEPPING_E) #define STEPS_PER_M_E (2759*MICROSTEPPING_E)
/* /*

View File

@ -70,11 +70,11 @@
#define MICROSTEPPING_E 4.0 #define MICROSTEPPING_E 4.0
#define STEPS_PER_M_X (5023*MICROSTEPPING_X) #define STEPS_PER_M_X (5023*MICROSTEPPING_X)
#define STEPS_PER_MM_Y (5.023*MICROSTEPPING_Y) #define STEPS_PER_M_Y (5023*MICROSTEPPING_Y)
#define STEPS_PER_MM_Z (416.699*MICROSTEPPING_Z) #define STEPS_PER_M_Z (416699*MICROSTEPPING_Z)
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E (2.759*MICROSTEPPING_E) #define STEPS_PER_M_E (2759*MICROSTEPPING_E)
/* /*

View File

@ -70,11 +70,11 @@
#define MICROSTEPPING_E 4.0 #define MICROSTEPPING_E 4.0
#define STEPS_PER_M_X (5023*MICROSTEPPING_X) #define STEPS_PER_M_X (5023*MICROSTEPPING_X)
#define STEPS_PER_MM_Y (5.023*MICROSTEPPING_Y) #define STEPS_PER_M_Y (5023*MICROSTEPPING_Y)
#define STEPS_PER_MM_Z (416.699*MICROSTEPPING_Z) #define STEPS_PER_M_Z (416699*MICROSTEPPING_Z)
/// http://blog.arcol.hu/?p=157 may help with this one /// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_MM_E (2.759*MICROSTEPPING_E) #define STEPS_PER_M_E (2759*MICROSTEPPING_E)
/* /*

65
dda.c
View File

@ -24,8 +24,8 @@
#include "heater.h" #include "heater.h"
#endif #endif
#ifdef STEPS_PER_MM_X #ifdef STEPS_PER_MM_Y
#error STEPS_PER_MM_X is gone, review your config.h and use STEPS_PER_M_X #error STEPS_PER_MM_Y is gone, review your config.h and use STEPS_PER_M_Y
#endif #endif
/// step timeout /// step timeout
@ -192,6 +192,9 @@ void dda_init(void) {
*/ */
void dda_new_startpoint(void) { void dda_new_startpoint(void) {
um_to_steps_x(startpoint_steps.X, startpoint.X); um_to_steps_x(startpoint_steps.X, startpoint.X);
um_to_steps_y(startpoint_steps.Y, startpoint.Y);
um_to_steps_z(startpoint_steps.Z, startpoint.Z);
um_to_steps_e(startpoint_steps.E, startpoint.E);
} }
/*! CREATE a dda given current_position and a target, save to passed location so we can write directly into the queue /*! CREATE a dda given current_position and a target, save to passed location so we can write directly into the queue
@ -207,7 +210,7 @@ void dda_new_startpoint(void) {
This algorithm is probably the main limiting factor to print speed in terms of firmware limitations This algorithm is probably the main limiting factor to print speed in terms of firmware limitations
*/ */
void dda_create(DDA *dda, TARGET *target) { void dda_create(DDA *dda, TARGET *target) {
uint32_t steps, x_delta_um /*, y_delta_um, z_delta_um, e_delta_um */; uint32_t steps, x_delta_um, y_delta_um, z_delta_um, e_delta_um;
uint32_t distance, c_limit, c_limit_calc; uint32_t distance, c_limit, c_limit_calc;
// initialise DDA to a known state // initialise DDA to a known state
@ -220,14 +223,22 @@ void dda_create(DDA *dda, TARGET *target) {
memcpy(&(dda->endpoint), target, sizeof(TARGET)); memcpy(&(dda->endpoint), target, sizeof(TARGET));
x_delta_um = (uint32_t)labs(target->X - startpoint.X); x_delta_um = (uint32_t)labs(target->X - startpoint.X);
y_delta_um = (uint32_t)labs(target->Y - startpoint.Y);
z_delta_um = (uint32_t)labs(target->Z - startpoint.Z);
e_delta_um = (uint32_t)labs(target->E - startpoint.E);
um_to_steps_x(steps, target->X); um_to_steps_x(steps, target->X);
dda->x_delta = labs(steps - startpoint_steps.X); dda->x_delta = labs(steps - startpoint_steps.X);
startpoint_steps.X = steps; startpoint_steps.X = steps;
um_to_steps_y(steps, target->Y);
dda->y_delta = labs(target->Y - startpoint.Y); dda->y_delta = labs(steps - startpoint_steps.Y);
dda->z_delta = labs(target->Z - startpoint.Z); startpoint_steps.Y = steps;
dda->e_delta = labs(target->E - startpoint.E); um_to_steps_z(steps, target->Z);
dda->z_delta = labs(steps - startpoint_steps.Z);
startpoint_steps.Z = steps;
um_to_steps_e(steps, target->E);
dda->e_delta = labs(steps - startpoint_steps.E);
startpoint_steps.E = steps;
dda->x_direction = (target->X >= startpoint.X)?1:0; dda->x_direction = (target->X >= startpoint.X)?1:0;
dda->y_direction = (target->Y >= startpoint.Y)?1:0; dda->y_direction = (target->Y >= startpoint.Y)?1:0;
@ -262,15 +273,15 @@ void dda_create(DDA *dda, TARGET *target) {
e_enable(); e_enable();
// since it's unusual to combine X, Y and Z changes in a single move on reprap, check if we can use simpler approximations before trying the full 3d approximation. // since it's unusual to combine X, Y and Z changes in a single move on reprap, check if we can use simpler approximations before trying the full 3d approximation.
if (dda->z_delta == 0) if (z_delta_um == 0)
distance = approx_distance(x_delta_um, dda->y_delta * UM_PER_STEP_Y); distance = approx_distance(x_delta_um, y_delta_um);
else if (dda->x_delta == 0 && dda->y_delta == 0) else if (x_delta_um == 0 && y_delta_um == 0)
distance = dda->z_delta * UM_PER_STEP_Z; distance = z_delta_um;
else else
distance = approx_distance_3(x_delta_um, dda->y_delta * UM_PER_STEP_Y, dda->z_delta * UM_PER_STEP_Z); distance = approx_distance_3(x_delta_um, y_delta_um, z_delta_um);
if (distance < 2) if (distance < 2)
distance = dda->e_delta * UM_PER_STEP_E; distance = e_delta_um;
if (DEBUG_DDA && (debug_flags & DEBUG_DDA)) if (DEBUG_DDA && (debug_flags & DEBUG_DDA))
sersendf_P(PSTR(",ds:%lu"), distance); sersendf_P(PSTR(",ds:%lu"), distance);
@ -305,15 +316,15 @@ void dda_create(DDA *dda, TARGET *target) {
if (c_limit_calc > c_limit) if (c_limit_calc > c_limit)
c_limit = c_limit_calc; c_limit = c_limit_calc;
// check Y axis // check Y axis
c_limit_calc = ( (dda->y_delta * (UM_PER_STEP_Y * 2400L)) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_Y) << 8; c_limit_calc = ((y_delta_um * 2400L) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_Y) << 8;
if (c_limit_calc > c_limit) if (c_limit_calc > c_limit)
c_limit = c_limit_calc; c_limit = c_limit_calc;
// check Z axis // check Z axis
c_limit_calc = ( (dda->z_delta * (UM_PER_STEP_Z * 2400L)) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_Z) << 8; c_limit_calc = ((z_delta_um * 2400L) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_Z) << 8;
if (c_limit_calc > c_limit) if (c_limit_calc > c_limit)
c_limit = c_limit_calc; c_limit = c_limit_calc;
// check E axis // check E axis
c_limit_calc = ( (dda->e_delta * (UM_PER_STEP_E * 2400L)) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_E) << 8; c_limit_calc = ((e_delta_um * 2400L) / dda->total_steps * (F_CPU / 40000) / MAXIMUM_FEEDRATE_E) << 8;
if (c_limit_calc > c_limit) if (c_limit_calc > c_limit)
c_limit = c_limit_calc; c_limit = c_limit_calc;
@ -735,22 +746,28 @@ void update_current_position() {
move_state.x_steps * 1000 / ((STEPS_PER_M_X + 500) / 1000); move_state.x_steps * 1000 / ((STEPS_PER_M_X + 500) / 1000);
if (dda->y_direction) if (dda->y_direction)
current_position.Y = dda->endpoint.Y - move_state.y_steps; current_position.Y = dda->endpoint.Y -
move_state.y_steps * 1000 / ((STEPS_PER_M_Y + 500) / 1000);
else else
current_position.Y = dda->endpoint.Y + move_state.y_steps; current_position.Y = dda->endpoint.Y +
move_state.y_steps * 1000 / ((STEPS_PER_M_Y + 500) / 1000);
if (dda->z_direction) if (dda->z_direction)
current_position.Z = dda->endpoint.Z - move_state.z_steps; current_position.Z = dda->endpoint.Z -
move_state.z_steps * 1000 / ((STEPS_PER_M_Z + 500) / 1000);
else else
current_position.Z = dda->endpoint.Z + move_state.z_steps; current_position.Z = dda->endpoint.Z +
move_state.z_steps * 1000 / ((STEPS_PER_M_Z + 500) / 1000);
#ifndef E_ABSOLUTE #ifndef E_ABSOLUTE
current_position.E = move_state.e_steps; current_position.E = move_state.e_steps * 1000 / ((STEPS_PER_M_E + 500) / 1000);
#else #else
if (dda->e_direction) if (dda->z_direction)
current_position.E = dda->endpoint.E - move_state.e_steps; current_position.E = dda->endpoint.E -
move_state.e_steps * 1000 / ((STEPS_PER_M_E + 500) / 1000);
else else
current_position.E = dda->endpoint.E + move_state.e_steps; current_position.E = dda->endpoint.E +
move_state.e_steps * 1000 / ((STEPS_PER_M_E + 500) / 1000);
#endif #endif
// current_position.F is updated in dda_start() // current_position.F is updated in dda_start()

58
dda.h
View File

@ -28,13 +28,57 @@
do { dest = (src * (STEPS_PER_M_X / 1L) + 500000L) / 1000000L; } while (0) do { dest = (src * (STEPS_PER_M_X / 1L) + 500000L) / 1000000L; } while (0)
#endif #endif
// Used in distance calculation during DDA setup #if STEPS_PER_M_Y >= 4096000
/// micrometers per step Y #define um_to_steps_y(dest, src) \
#define UM_PER_STEP_Y 1000L / ((uint32_t) STEPS_PER_MM_Y) do { dest = (src * (STEPS_PER_M_Y / 10000L) + 50L) / 100L; } while (0)
/// micrometers per step Z #elif STEPS_PER_M_Y >= 409600
#define UM_PER_STEP_Z 1000L / ((uint32_t) STEPS_PER_MM_Z) #define um_to_steps_y(dest, src) \
/// micrometers per step E do { dest = (src * (STEPS_PER_M_Y / 1000L) + 500L) / 1000L; } while (0)
#define UM_PER_STEP_E 1000L / ((uint32_t) STEPS_PER_MM_E) #elif STEPS_PER_M_Y >= 40960
#define um_to_steps_y(dest, src) \
do { dest = (src * (STEPS_PER_M_Y / 100L) + 5000L) / 10000L; } while (0)
#elif STEPS_PER_M_Y >= 4096
#define um_to_steps_y(dest, src) \
do { dest = (src * (STEPS_PER_M_Y / 10L) + 50000L) / 100000L; } while (0)
#else
#define um_to_steps_y(dest, src) \
do { dest = (src * (STEPS_PER_M_Y / 1L) + 500000L) / 1000000L; } while (0)
#endif
#if STEPS_PER_M_Z >= 4096000
#define um_to_steps_z(dest, src) \
do { dest = (src * (STEPS_PER_M_Z / 10000L) + 50L) / 100L; } while (0)
#elif STEPS_PER_M_Z >= 409600
#define um_to_steps_z(dest, src) \
do { dest = (src * (STEPS_PER_M_Z / 1000L) + 500L) / 1000L; } while (0)
#elif STEPS_PER_M_Z >= 40960
#define um_to_steps_z(dest, src) \
do { dest = (src * (STEPS_PER_M_Z / 100L) + 5000L) / 10000L; } while (0)
#elif STEPS_PER_M_Z >= 4096
#define um_to_steps_z(dest, src) \
do { dest = (src * (STEPS_PER_M_Z / 10L) + 50000L) / 100000L; } while (0)
#else
#define um_to_steps_z(dest, src) \
do { dest = (src * (STEPS_PER_M_Z / 1L) + 500000L) / 1000000L; } while (0)
#endif
#if STEPS_PER_M_E >= 4096000
#define um_to_steps_e(dest, src) \
do { dest = (src * (STEPS_PER_M_E / 10000L) + 50L) / 100L; } while (0)
#elif STEPS_PER_M_E >= 409600
#define um_to_steps_e(dest, src) \
do { dest = (src * (STEPS_PER_M_E / 1000L) + 500L) / 1000L; } while (0)
#elif STEPS_PER_M_E >= 40960
#define um_to_steps_e(dest, src) \
do { dest = (src * (STEPS_PER_M_E / 100L) + 5000L) / 10000L; } while (0)
#elif STEPS_PER_M_E >= 4096
#define um_to_steps_e(dest, src) \
do { dest = (src * (STEPS_PER_M_E / 10L) + 50000L) / 100000L; } while (0)
#else
#define um_to_steps_e(dest, src) \
do { dest = (src * (STEPS_PER_M_E / 1L) + 500000L) / 1000000L; } while (0)
#endif
#ifdef ACCELERATION_REPRAP #ifdef ACCELERATION_REPRAP
#ifdef ACCELERATION_RAMPING #ifdef ACCELERATION_RAMPING

View File

@ -15,32 +15,6 @@
#include "gcode_process.h" #include "gcode_process.h"
/*
Switch user friendly values to coding friendly values
This also affects the possible build volume. We have +/- 2^31 numbers available and as we internally measure position in steps and use a precision factor of 1000, this translates into a possible range of
2^31 mm / STEPS_PER_MM_x / 1000
for each axis. For a M6 threaded rod driven machine and 1/16 microstepping this evaluates to
2^31 mm / 200 / 16 / 1000 = 671 mm,
which is about the worst case we have. All other machines have a bigger build volume.
*/
#define STEPS_PER_M_Y ((uint32_t) ((STEPS_PER_MM_Y * 1000.0) + 0.5))
#define STEPS_PER_M_Z ((uint32_t) ((STEPS_PER_MM_Z * 1000.0) + 0.5))
#define STEPS_PER_M_E ((uint32_t) ((STEPS_PER_MM_E * 1000.0) + 0.5))
/*
mm -> inch conversion
*/
#define STEPS_PER_IN_Y ((uint32_t) ((25.4 * STEPS_PER_MM_Y) + 0.5))
#define STEPS_PER_IN_Z ((uint32_t) ((25.4 * STEPS_PER_MM_Z) + 0.5))
#define STEPS_PER_IN_E ((uint32_t) ((25.4 * STEPS_PER_MM_E) + 0.5))
/// current or previous gcode word /// current or previous gcode word
/// for working out what to do with data just received /// for working out what to do with data just received
uint8_t last_field = 0; uint8_t last_field = 0;
@ -145,25 +119,25 @@ void gcode_parse_char(uint8_t c) {
break; break;
case 'Y': case 'Y':
if (next_target.option_inches) if (next_target.option_inches)
next_target.target.Y = decfloat_to_int(&read_digit, STEPS_PER_IN_Y, 0); next_target.target.Y = decfloat_to_int(&read_digit, 25400, 1);
else else
next_target.target.Y = decfloat_to_int(&read_digit, STEPS_PER_M_Y, 1); next_target.target.Y = decfloat_to_int(&read_digit, 1000, 0);
if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO)) if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO))
serwrite_int32(next_target.target.Y); serwrite_int32(next_target.target.Y);
break; break;
case 'Z': case 'Z':
if (next_target.option_inches) if (next_target.option_inches)
next_target.target.Z = decfloat_to_int(&read_digit, STEPS_PER_IN_Z, 0); next_target.target.Z = decfloat_to_int(&read_digit, 25400, 1);
else else
next_target.target.Z = decfloat_to_int(&read_digit, STEPS_PER_M_Z, 1); next_target.target.Z = decfloat_to_int(&read_digit, 1000, 0);
if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO)) if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO))
serwrite_int32(next_target.target.Z); serwrite_int32(next_target.target.Z);
break; break;
case 'E': case 'E':
if (next_target.option_inches) if (next_target.option_inches)
next_target.target.E = decfloat_to_int(&read_digit, STEPS_PER_IN_E, 0); next_target.target.E = decfloat_to_int(&read_digit, 25400, 1);
else else
next_target.target.E = decfloat_to_int(&read_digit, STEPS_PER_M_E, 1); next_target.target.E = decfloat_to_int(&read_digit, 1000, 0);
if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO)) if (DEBUG_ECHO && (debug_flags & DEBUG_ECHO))
serwrite_uint32(next_target.target.E); serwrite_uint32(next_target.target.E);
break; break;

View File

@ -82,24 +82,24 @@ void process_gcode_command() {
next_target.target.X = X_MIN * 1000.; next_target.target.X = X_MIN * 1000.;
#endif #endif
#ifdef X_MAX #ifdef X_MAX
if (next_target.target.X > X_MAX * 1000.)) if (next_target.target.X > X_MAX * 1000.)
next_target.target.X = X_MAX * 1000.; next_target.target.X = X_MAX * 1000.;
#endif #endif
#ifdef Y_MIN #ifdef Y_MIN
if (next_target.target.Y < (Y_MIN * STEPS_PER_MM_Y)) if (next_target.target.Y < Y_MIN * 1000.)
next_target.target.Y = Y_MIN * STEPS_PER_MM_Y; next_target.target.Y = Y_MIN * 1000.;
#endif #endif
#ifdef Y_MAX #ifdef Y_MAX
if (next_target.target.Y > (Y_MAX * STEPS_PER_MM_Y)) if (next_target.target.Y > Y_MAX * 1000.)
next_target.target.Y = Y_MAX * STEPS_PER_MM_Y; next_target.target.Y = Y_MAX * 1000.;
#endif #endif
#ifdef Z_MIN #ifdef Z_MIN
if (next_target.target.Z < (Z_MIN * STEPS_PER_MM_Z)) if (next_target.target.Z < Z_MIN * 1000.)
next_target.target.Z = Z_MIN * STEPS_PER_MM_Z; next_target.target.Z = Z_MIN * 1000.;
#endif #endif
#ifdef Z_MAX #ifdef Z_MAX
if (next_target.target.Z > (Z_MAX * STEPS_PER_MM_Z)) if (next_target.target.Z > Z_MAX * 1000.)
next_target.target.Z = Z_MAX * STEPS_PER_MM_Z; next_target.target.Z = Z_MAX * 1000.;
#endif #endif
@ -578,7 +578,7 @@ void process_gcode_command() {
queue_wait(); queue_wait();
#endif #endif
update_current_position(); update_current_position();
sersendf_P(PSTR("X:%lq,Y:%lq,Z:%lq,E:%lq,F:%ld"), current_position.X, current_position.Y * ((int32_t) UM_PER_STEP_Y), current_position.Z * ((int32_t) UM_PER_STEP_Z), current_position.E * ((int32_t) UM_PER_STEP_E), current_position.F); sersendf_P(PSTR("X:%lq,Y:%lq,Z:%lq,E:%lq,F:%ld"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);
// newline is sent from gcode_parse after we return // newline is sent from gcode_parse after we return
break; break;

26
home.c
View File

@ -92,7 +92,7 @@ void home_x_positive() {
// set X home // set X home
queue_wait(); queue_wait();
// set position to MAX // set position to MAX
startpoint.X = next_target.target.X = (int32_t)(X_MAX * 1000.0); startpoint.X = next_target.target.X = (int32_t)(X_MAX * 1000.);
dda_new_startpoint(); dda_new_startpoint();
// go to zero // go to zero
t.X = 0; t.X = 0;
@ -106,7 +106,7 @@ void home_y_negative() {
#if defined Y_MIN_PIN #if defined Y_MIN_PIN
TARGET t = startpoint; TARGET t = startpoint;
t.Y = -1000*STEPS_PER_MM_Y; t.Y = -1000000;
#ifdef SLOW_HOMING #ifdef SLOW_HOMING
// hit home soft // hit home soft
t.F = SEARCH_FEEDRATE_Y; t.F = SEARCH_FEEDRATE_Y;
@ -118,7 +118,7 @@ void home_y_negative() {
#ifndef SLOW_HOMING #ifndef SLOW_HOMING
// back off slowly // back off slowly
t.Y = +1000*STEPS_PER_MM_Y; t.Y = +1000000;
t.F = SEARCH_FEEDRATE_Y; t.F = SEARCH_FEEDRATE_Y;
enqueue_home(&t, 0x2, 0); enqueue_home(&t, 0x2, 0);
#endif #endif
@ -126,7 +126,7 @@ void home_y_negative() {
// set Y home // set Y home
queue_wait(); queue_wait();
#ifdef Y_MIN #ifdef Y_MIN
startpoint.Y = next_target.target.Y = (int32_t)(Y_MIN * STEPS_PER_MM_Y); startpoint.Y = next_target.target.Y = (int32_t)(Y_MIN * 1000.);
#else #else
startpoint.Y = next_target.target.Y = 0; startpoint.Y = next_target.target.Y = 0;
#endif #endif
@ -142,7 +142,7 @@ void home_y_positive() {
#if defined Y_MAX_PIN && defined Y_MAX #if defined Y_MAX_PIN && defined Y_MAX
TARGET t = startpoint; TARGET t = startpoint;
t.Y = +1000*STEPS_PER_MM_Y; t.Y = +1000000;
#ifdef SLOW_HOMING #ifdef SLOW_HOMING
// hit home soft // hit home soft
t.F = SEARCH_FEEDRATE_Y; t.F = SEARCH_FEEDRATE_Y;
@ -154,7 +154,7 @@ void home_y_positive() {
#ifndef SLOW_HOMING #ifndef SLOW_HOMING
// back off slowly // back off slowly
t.X = -1000*STEPS_PER_MM_Y; t.X = -1000000;
t.F = SEARCH_FEEDRATE_Y; t.F = SEARCH_FEEDRATE_Y;
enqueue_home(&t, 0x2, 0); enqueue_home(&t, 0x2, 0);
#endif #endif
@ -162,7 +162,7 @@ void home_y_positive() {
// set Y home // set Y home
queue_wait(); queue_wait();
// set position to MAX // set position to MAX
startpoint.Y = next_target.target.Y = (int32_t)(Y_MAX * STEPS_PER_MM_Y); startpoint.Y = next_target.target.Y = (int32_t)(Y_MAX * 1000.);
new_startpoint(); new_startpoint();
// go to zero // go to zero
t.Y = 0; t.Y = 0;
@ -176,7 +176,7 @@ void home_z_negative() {
#if defined Z_MIN_PIN #if defined Z_MIN_PIN
TARGET t = startpoint; TARGET t = startpoint;
t.Z = -1000*STEPS_PER_MM_Z; t.Z = -1000000;
#ifdef SLOW_HOMING #ifdef SLOW_HOMING
// hit home soft // hit home soft
t.F = SEARCH_FEEDRATE_Z; t.F = SEARCH_FEEDRATE_Z;
@ -188,7 +188,7 @@ void home_z_negative() {
#ifndef SLOW_HOMING #ifndef SLOW_HOMING
// back off slowly // back off slowly
t.Z = +1000*STEPS_PER_MM_Z; t.Z = +1000000;
t.F = SEARCH_FEEDRATE_Z; t.F = SEARCH_FEEDRATE_Z;
enqueue_home(&t, 0x4, 0); enqueue_home(&t, 0x4, 0);
#endif #endif
@ -196,7 +196,7 @@ void home_z_negative() {
// set Z home // set Z home
queue_wait(); queue_wait();
#ifdef Z_MIN #ifdef Z_MIN
startpoint.Z = next_target.target.Z = (int32_t)(Z_MIN * STEPS_PER_MM_Z); startpoint.Z = next_target.target.Z = (int32_t)(Z_MIN * 1000.);
#else #else
startpoint.Z = next_target.target.Z = 0; startpoint.Z = next_target.target.Z = 0;
#endif #endif
@ -213,7 +213,7 @@ void home_z_positive() {
#if defined Z_MAX_PIN && defined Z_MAX #if defined Z_MAX_PIN && defined Z_MAX
TARGET t = startpoint; TARGET t = startpoint;
t.Z = +1000*STEPS_PER_MM_Z; t.Z = +1000000;
#ifdef SLOW_HOMING #ifdef SLOW_HOMING
// hit home soft // hit home soft
t.F = SEARCH_FEEDRATE_Z; t.F = SEARCH_FEEDRATE_Z;
@ -225,7 +225,7 @@ void home_z_positive() {
#ifndef SLOW_HOMING #ifndef SLOW_HOMING
// back off slowly // back off slowly
t.Z = -1000*STEPS_PER_MM_Z; t.Z = -1000000;
t.F = SEARCH_FEEDRATE_Z; t.F = SEARCH_FEEDRATE_Z;
enqueue_home(&t, 0x4, 0); enqueue_home(&t, 0x4, 0);
#endif #endif
@ -233,7 +233,7 @@ void home_z_positive() {
// set Z home // set Z home
queue_wait(); queue_wait();
// set position to MAX // set position to MAX
startpoint.Z = next_target.target.Z = (int32_t)(Z_MAX * STEPS_PER_MM_Z); startpoint.Z = next_target.target.Z = (int32_t)(Z_MAX * 1000.);
dda_new_startpoint(); dda_new_startpoint();
// go to zero // go to zero
t.Z = 0; t.Z = 0;