Merge pull request #160 from daapp/edge
Replace some constants with N_AXIS.
This commit is contained in:
commit
aad8b0468d
2
gcode.c
2
gcode.c
@ -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 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)
|
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(target); // XYZ(ABC) axes parameters.
|
||||||
clear_vector(offset); // IJK Arc offsets are incremental. Value of zero indicates no change.
|
clear_vector(offset); // IJK Arc offsets are incremental. Value of zero indicates no change.
|
||||||
|
|
||||||
|
2
gcode.h
2
gcode.h
@ -72,7 +72,7 @@ typedef struct {
|
|||||||
int8_t spindle_direction; // 1 = CW, -1 = CCW, 0 = Stop {M3, M4, M5}
|
int8_t spindle_direction; // 1 = CW, -1 = CCW, 0 = Stop {M3, M4, M5}
|
||||||
uint8_t coolant_mode; // 0 = Disable, 1 = Flood Enable {M8, M9}
|
uint8_t coolant_mode; // 0 = Disable, 1 = Flood Enable {M8, M9}
|
||||||
float feed_rate; // Millimeters/min
|
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;
|
uint8_t tool;
|
||||||
// uint16_t spindle_speed; // RPM/100
|
// uint16_t spindle_speed; // RPM/100
|
||||||
uint8_t plane_axis_0,
|
uint8_t plane_axis_0,
|
||||||
|
2
limits.c
2
limits.c
@ -96,7 +96,7 @@ static void homing_cycle(uint8_t cycle_mask, int8_t pos_dir, bool invert_pin, fl
|
|||||||
// and speedy homing routine.
|
// and speedy homing routine.
|
||||||
// NOTE: For each axes enabled, the following calculations assume they physically move
|
// 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.
|
// 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;
|
uint8_t dist = 0;
|
||||||
clear_vector(steps);
|
clear_vector(steps);
|
||||||
if (cycle_mask & (1<<X_AXIS)) {
|
if (cycle_mask & (1<<X_AXIS)) {
|
||||||
|
@ -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];
|
block_t *block = &block_buffer[block_buffer_head];
|
||||||
|
|
||||||
// Calculate target position in absolute steps
|
// 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[X_AXIS] = lround(x*settings.steps_per_mm[X_AXIS]);
|
||||||
target[Y_AXIS] = lround(y*settings.steps_per_mm[Y_AXIS]);
|
target[Y_AXIS] = lround(y*settings.steps_per_mm[Y_AXIS]);
|
||||||
target[Z_AXIS] = lround(z*settings.steps_per_mm[Z_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; };
|
if (block->step_event_count == 0) { return; };
|
||||||
|
|
||||||
// Compute path vector in terms of absolute step target and current positions
|
// 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[X_AXIS] = x-pl.last_x;
|
||||||
delta_mm[Y_AXIS] = y-pl.last_y;
|
delta_mm[Y_AXIS] = y-pl.last_y;
|
||||||
delta_mm[Z_AXIS] = z-pl.last_z;
|
delta_mm[Z_AXIS] = z-pl.last_z;
|
||||||
|
10
report.c
10
report.c
@ -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
|
// 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.
|
// for a user to select the desired real-time data.
|
||||||
uint8_t i;
|
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));
|
memcpy(current_position,sys.position,sizeof(sys.position));
|
||||||
float print_position[3];
|
float print_position[N_AXIS];
|
||||||
|
|
||||||
// Report current machine state
|
// Report current machine state
|
||||||
switch (sys.state) {
|
switch (sys.state) {
|
||||||
@ -310,7 +310,7 @@ void report_realtime_status()
|
|||||||
|
|
||||||
// Report machine position
|
// Report machine position
|
||||||
printPgmString(PSTR(",MPos:"));
|
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];
|
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; }
|
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) { print_position[i] *= INCH_PER_MM; }
|
||||||
printFloat(print_position[i]);
|
printFloat(print_position[i]);
|
||||||
@ -319,14 +319,14 @@ void report_realtime_status()
|
|||||||
|
|
||||||
// Report work position
|
// Report work position
|
||||||
printPgmString(PSTR("WPos:"));
|
printPgmString(PSTR("WPos:"));
|
||||||
for (i=0; i<= 2; i++) {
|
for (i=0; i< N_AXIS; i++) {
|
||||||
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) {
|
if (bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)) {
|
||||||
print_position[i] -= (gc.coord_system[i]+gc.coord_offset[i])*INCH_PER_MM;
|
print_position[i] -= (gc.coord_system[i]+gc.coord_offset[i])*INCH_PER_MM;
|
||||||
} else {
|
} else {
|
||||||
print_position[i] -= gc.coord_system[i]+gc.coord_offset[i];
|
print_position[i] -= gc.coord_system[i]+gc.coord_offset[i];
|
||||||
}
|
}
|
||||||
printFloat(print_position[i]);
|
printFloat(print_position[i]);
|
||||||
if (i < 2) { printPgmString(PSTR(",")); }
|
if (i < N_AXIS-1) { printPgmString(PSTR(",")); }
|
||||||
}
|
}
|
||||||
|
|
||||||
printPgmString(PSTR(">\r\n"));
|
printPgmString(PSTR(">\r\n"));
|
||||||
|
@ -32,7 +32,7 @@ settings_t settings;
|
|||||||
|
|
||||||
// Version 4 outdated settings record
|
// Version 4 outdated settings record
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float steps_per_mm[3];
|
float steps_per_mm[N_AXIS];
|
||||||
uint8_t microsteps;
|
uint8_t microsteps;
|
||||||
uint8_t pulse_microseconds;
|
uint8_t pulse_microseconds;
|
||||||
float default_feed_rate;
|
float default_feed_rate;
|
||||||
|
Loading…
Reference in New Issue
Block a user