diff --git a/settings.c b/settings.c index 96ba201..a3c33dd 100644 --- a/settings.c +++ b/settings.c @@ -40,9 +40,9 @@ typedef struct { } settings_v1_t; void settings_reset() { - settings.steps_per_mm[0] = DEFAULT_X_STEPS_PER_MM; - settings.steps_per_mm[1] = DEFAULT_Y_STEPS_PER_MM; - settings.steps_per_mm[2] = DEFAULT_Z_STEPS_PER_MM; + settings.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM; + settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM; + settings.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM; settings.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS; settings.default_feed_rate = DEFAULT_FEEDRATE; settings.default_seek_rate = DEFAULT_RAPID_FEEDRATE; @@ -53,9 +53,9 @@ void settings_reset() { } void settings_dump() { - printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[0]); - printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[1]); - printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[2]); + printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]); + printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[Y_AXIS]); + printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[Z_AXIS]); printPgmString(PSTR(" (steps/mm z)\r\n$3 = ")); printInteger(settings.pulse_microseconds); printPgmString(PSTR(" (microseconds step pulse)\r\n$4 = ")); printFloat(settings.default_feed_rate); printPgmString(PSTR(" (mm/min default feed rate)\r\n$5 = ")); printFloat(settings.default_seek_rate); diff --git a/stepper_plan.c b/stepper_plan.c index 9a7d3bd..0d972f9 100644 --- a/stepper_plan.c +++ b/stepper_plan.c @@ -359,9 +359,9 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert // Calculate target position in absolute steps int32_t target[3]; - target[0] = lround(x*settings.steps_per_mm[0]); - target[1] = lround(y*settings.steps_per_mm[1]); - target[2] = lround(y*settings.steps_per_mm[2]); + target[X_AXIS] = lround(x*settings.steps_per_mm[X_AXIS]); + target[Y_AXIS] = lround(y*settings.steps_per_mm[Y_AXIS]); + target[Z_AXIS] = lround(y*settings.steps_per_mm[Z_AXIS]); // Calculate the buffer head after we push this byte int next_buffer_head = (block_buffer_head + 1) % BLOCK_BUFFER_SIZE; @@ -371,13 +371,13 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert // Prepare to set up new block block_t *block = &block_buffer[block_buffer_head]; // Number of steps for each axis - block->steps_x = labs(position[0]-target[0]); - block->steps_y = labs(position[1]-target[1]); - block->steps_z = labs(position[2]-target[2]); + block->steps_x = labs(position[X_AXIS]-target[X_AXIS]); + block->steps_y = labs(position[Y_AXIS]-target[Y_AXIS]); + block->steps_z = labs(position[Z_AXIS]-target[Z_AXIS]); block->millimeters = sqrt( - square(block->steps_x/settings.steps_per_mm[0])+ - square(block->steps_y/settings.steps_per_mm[1])+ - square(block->steps_z/settings.steps_per_mm[2])); + square(block->steps_x/settings.steps_per_mm[X_AXIS])+ + square(block->steps_y/settings.steps_per_mm[Y_AXIS])+ + square(block->steps_z/settings.steps_per_mm[Z_AXIS])); block->step_event_count = max(block->steps_x, max(block->steps_y, block->steps_z)); // Bail if this is a zero-length block @@ -427,9 +427,9 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert // Compute direction bits for this block block->direction_bits = 0; - if (target[0] < position[0]) { block->direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<