Merge pull request #160 from daapp/edge

Replace some constants with N_AXIS.
This commit is contained in:
Sonny Jeon 2013-01-09 14:55:31 -08:00
commit aad8b0468d
6 changed files with 11 additions and 11 deletions

View File

@ -98,7 +98,7 @@ uint8_t gc_execute_line(char *line)
uint8_t absolute_override = false; // true(1) = absolute motion for this block only {G53}
uint8_t non_modal_action = NON_MODAL_NONE; // Tracks the actions of modal group 0 (non-modal)
float target[3], offset[3];
float target[N_AXIS], offset[N_AXIS];
clear_vector(target); // XYZ(ABC) axes parameters.
clear_vector(offset); // IJK Arc offsets are incremental. Value of zero indicates no change.

View File

@ -72,7 +72,7 @@ typedef struct {
int8_t spindle_direction; // 1 = CW, -1 = CCW, 0 = Stop {M3, M4, M5}
uint8_t coolant_mode; // 0 = Disable, 1 = Flood Enable {M8, M9}
float feed_rate; // Millimeters/min
float position[3]; // Where the interpreter considers the tool to be at this point in the code
float position[N_AXIS]; // Where the interpreter considers the tool to be at this point in the code
uint8_t tool;
// uint16_t spindle_speed; // RPM/100
uint8_t plane_axis_0,

View File

@ -96,7 +96,7 @@ static void homing_cycle(uint8_t cycle_mask, int8_t pos_dir, bool invert_pin, fl
// and speedy homing routine.
// NOTE: For each axes enabled, the following calculations assume they physically move
// an equal distance over each time step until they hit a limit switch, aka dogleg.
uint32_t steps[3];
uint32_t steps[N_AXIS];
uint8_t dist = 0;
clear_vector(steps);
if (cycle_mask & (1<<X_AXIS)) {

View File

@ -393,7 +393,7 @@ void plan_buffer_line(float x, float y, float z, float feed_rate, uint8_t invert
block_t *block = &block_buffer[block_buffer_head];
// Calculate target position in absolute steps
int32_t target[3];
int32_t target[N_AXIS];
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(z*settings.steps_per_mm[Z_AXIS]);
@ -408,7 +408,7 @@ void plan_buffer_line(float x, float y, float z, float feed_rate, uint8_t invert
if (block->step_event_count == 0) { return; };
// Compute path vector in terms of absolute step target and current positions
float delta_mm[3];
float delta_mm[N_AXIS];
delta_mm[X_AXIS] = x-pl.last_x;
delta_mm[Y_AXIS] = y-pl.last_y;
delta_mm[Z_AXIS] = z-pl.last_z;

View File

@ -292,9 +292,9 @@ void report_realtime_status()
// to be added are distance to go on block, processed block id, and feed rate. Also a settings bitmask
// for a user to select the desired real-time data.
uint8_t i;
int32_t current_position[3]; // Copy current state of the system position variable
int32_t current_position[N_AXIS]; // Copy current state of the system position variable
memcpy(current_position,sys.position,sizeof(sys.position));
float print_position[3];
float print_position[N_AXIS];
// Report current machine state
switch (sys.state) {
@ -310,7 +310,7 @@ void report_realtime_status()
// Report machine position
printPgmString(PSTR(",MPos:"));
for (i=0; i<= 2; i++) {
for (i=0; i< N_AXIS; i++) {
print_position[i] = current_position[i]/settings.steps_per_mm[i];
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { print_position[i] *= INCH_PER_MM; }
printFloat(print_position[i]);
@ -319,14 +319,14 @@ void report_realtime_status()
// Report work position
printPgmString(PSTR("WPos:"));
for (i=0; i<= 2; i++) {
for (i=0; i< N_AXIS; i++) {
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) {
print_position[i] -= (gc.coord_system[i]+gc.coord_offset[i])*INCH_PER_MM;
} else {
print_position[i] -= gc.coord_system[i]+gc.coord_offset[i];
}
printFloat(print_position[i]);
if (i < 2) { printPgmString(PSTR(",")); }
if (i < N_AXIS-1) { printPgmString(PSTR(",")); }
}
printPgmString(PSTR(">\r\n"));

View File

@ -32,7 +32,7 @@ settings_t settings;
// Version 4 outdated settings record
typedef struct {
float steps_per_mm[3];
float steps_per_mm[N_AXIS];
uint8_t microsteps;
uint8_t pulse_microseconds;
float default_feed_rate;