|
|
|
@ -30,63 +30,12 @@
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
extern float destination[XYZE];
|
|
|
|
|
|
|
|
|
|
#if AVR_AT90USB1286_FAMILY // Teensyduino & Printrboard IDE extensions have compile errors without this
|
|
|
|
|
inline void set_current_from_destination() { COPY(current_position, destination); }
|
|
|
|
|
#else
|
|
|
|
|
extern void set_current_from_destination();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static void debug_echo_axis(const AxisEnum axis) {
|
|
|
|
|
if (current_position[axis] == destination[axis])
|
|
|
|
|
SERIAL_ECHOPGM("-------------");
|
|
|
|
|
else
|
|
|
|
|
SERIAL_ECHO_F(destination[X_AXIS], 6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void debug_current_and_destination(const char *title) {
|
|
|
|
|
|
|
|
|
|
// if the title message starts with a '!' it is so important, we are going to
|
|
|
|
|
// ignore the status of the g26_debug_flag
|
|
|
|
|
if (*title != '!' && !g26_debug_flag) return;
|
|
|
|
|
|
|
|
|
|
const float de = destination[E_AXIS] - current_position[E_AXIS];
|
|
|
|
|
|
|
|
|
|
if (de == 0.0) return; // Printing moves only
|
|
|
|
|
|
|
|
|
|
const float dx = destination[X_AXIS] - current_position[X_AXIS],
|
|
|
|
|
dy = destination[Y_AXIS] - current_position[Y_AXIS],
|
|
|
|
|
xy_dist = HYPOT(dx, dy);
|
|
|
|
|
|
|
|
|
|
if (xy_dist == 0.0) return;
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" fpmm=");
|
|
|
|
|
const float fpmm = de / xy_dist;
|
|
|
|
|
SERIAL_ECHO_F(fpmm, 6);
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM(" current=( ");
|
|
|
|
|
SERIAL_ECHO_F(current_position[X_AXIS], 6);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
SERIAL_ECHO_F(current_position[Y_AXIS], 6);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
SERIAL_ECHO_F(current_position[Z_AXIS], 6);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
SERIAL_ECHO_F(current_position[E_AXIS], 6);
|
|
|
|
|
SERIAL_ECHOPGM(" ) destination=( ");
|
|
|
|
|
debug_echo_axis(X_AXIS);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
debug_echo_axis(Y_AXIS);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
debug_echo_axis(Z_AXIS);
|
|
|
|
|
SERIAL_ECHOPGM(", ");
|
|
|
|
|
debug_echo_axis(E_AXIS);
|
|
|
|
|
SERIAL_ECHOPGM(" ) ");
|
|
|
|
|
SERIAL_ECHO(title);
|
|
|
|
|
SERIAL_EOL();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void unified_bed_leveling::line_to_destination_cartesian(const float &feed_rate, uint8_t extruder) {
|
|
|
|
|
/**
|
|
|
|
|
* Much of the nozzle movement will be within the same cell. So we will do as little computation
|
|
|
|
|