result of G92 also affects planner
This commit is contained in:
parent
c491324e89
commit
ef20be9f4c
6
gcode.c
6
gcode.c
@ -97,6 +97,7 @@ static float to_millimeters(double value) {
|
|||||||
return(gc.inches_mode ? (value * MM_PER_INCH) : value);
|
return(gc.inches_mode ? (value * MM_PER_INCH) : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __AVR_ATmega328P__
|
||||||
// Find the angle in radians of deviance from the positive y axis. negative angles to the left of y-axis,
|
// Find the angle in radians of deviance from the positive y axis. negative angles to the left of y-axis,
|
||||||
// positive to the right.
|
// positive to the right.
|
||||||
static double theta(double x, double y)
|
static double theta(double x, double y)
|
||||||
@ -113,6 +114,7 @@ static double theta(double x, double y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase
|
// Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase
|
||||||
// characters and signed floating point values (no whitespace).
|
// characters and signed floating point values (no whitespace).
|
||||||
@ -236,7 +238,9 @@ uint8_t gc_execute_line(char *line) {
|
|||||||
switch (next_action) {
|
switch (next_action) {
|
||||||
case NEXT_ACTION_GO_HOME: mc_go_home(); clear_vector(gc.position); break;
|
case NEXT_ACTION_GO_HOME: mc_go_home(); clear_vector(gc.position); break;
|
||||||
case NEXT_ACTION_DWELL: mc_dwell(trunc(p*1000)); break;
|
case NEXT_ACTION_DWELL: mc_dwell(trunc(p*1000)); break;
|
||||||
case NEXT_ACTION_SET_COORDINATE_OFFSET: break; // no action needed
|
case NEXT_ACTION_SET_COORDINATE_OFFSET:
|
||||||
|
mc_set_current_position(target[X_AXIS], target[Y_AXIS], target[Z_AXIS]);
|
||||||
|
break;
|
||||||
case NEXT_ACTION_DEFAULT:
|
case NEXT_ACTION_DEFAULT:
|
||||||
switch (gc.motion_mode) {
|
switch (gc.motion_mode) {
|
||||||
case MOTION_MODE_CANCEL: break;
|
case MOTION_MODE_CANCEL: break;
|
||||||
|
@ -24,14 +24,16 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include "planner.h"
|
#include "planner.h"
|
||||||
|
|
||||||
|
// NOTE: Although the following functions structurally belongs in this module, there is nothing to do but
|
||||||
|
// to forward the request to the planner.
|
||||||
|
|
||||||
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
|
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
|
||||||
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
|
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in
|
||||||
// (1 minute)/feed_rate time.
|
// (1 minute)/feed_rate time.
|
||||||
// NOTE: Although this function structurally belongs in this module, there is nothing to do but
|
|
||||||
// to forward the request to the planner. For efficiency the function is implemented with a macro.
|
|
||||||
|
|
||||||
#define mc_line(x, y, z, feed_rate, invert_feed_rate) plan_buffer_line(x, y, z, feed_rate, invert_feed_rate)
|
#define mc_line(x, y, z, feed_rate, invert_feed_rate) plan_buffer_line(x, y, z, feed_rate, invert_feed_rate)
|
||||||
|
|
||||||
|
#define mc_set_current_position(x, y, z) plan_set_current_position(x, y, z)
|
||||||
|
|
||||||
#ifdef __AVR_ATmega328P__
|
#ifdef __AVR_ATmega328P__
|
||||||
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
// Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc,
|
||||||
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
// positive angular_travel means clockwise, negative means counterclockwise. Radius == the radius of the
|
||||||
|
@ -391,9 +391,9 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert
|
|||||||
st_wake_up();
|
st_wake_up();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the position vector
|
// Reset the planner position vector
|
||||||
void plan_set_current_position(double x, double y, double z) {
|
void plan_set_current_position(double x, double y, double z) {
|
||||||
position[X_AXIS] = x;
|
position[X_AXIS] = lround(x*settings.steps_per_mm[X_AXIS]);
|
||||||
position[Y_AXIS] = y;
|
position[Y_AXIS] = lround(y*settings.steps_per_mm[Y_AXIS]);
|
||||||
position[Z_AXIS] = z;
|
position[Z_AXIS] = lround(z*settings.steps_per_mm[Z_AXIS]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user