update code base to Marlin 2.0.9.2
This commit is contained in:
79
Marlin/src/gcode/host/M114.cpp
Executable file → Normal file
79
Marlin/src/gcode/host/M114.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -34,34 +34,34 @@
|
||||
#include "../../core/debug_out.h"
|
||||
#endif
|
||||
|
||||
void report_xyze(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
|
||||
void report_all_axis_pos(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
LOOP_L_N(a, n) {
|
||||
SERIAL_CHAR(' ', axis_codes[a], ':');
|
||||
if (pos[a] >= 0) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
inline void report_xyz(const xyze_pos_t &pos) { report_xyze(pos, 3); }
|
||||
inline void report_linear_axis_pos(const xyze_pos_t &pos) { report_all_axis_pos(pos, XYZ); }
|
||||
|
||||
void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
void report_linear_axis_pos(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a), ':');
|
||||
LOOP_LINEAR_AXES(a) {
|
||||
SERIAL_CHAR(' ', AXIS_CHAR(a), ':');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void report_current_position_detail() {
|
||||
|
||||
// Position as sent by G-code
|
||||
SERIAL_ECHOPGM("\nLogical:");
|
||||
report_xyz(current_position.asLogical());
|
||||
report_linear_axis_pos(current_position.asLogical());
|
||||
|
||||
// Cartesian position in native machine space
|
||||
SERIAL_ECHOPGM("Raw: ");
|
||||
report_xyz(current_position);
|
||||
report_linear_axis_pos(current_position);
|
||||
|
||||
xyze_pos_t leveled = current_position;
|
||||
|
||||
@@ -69,24 +69,20 @@
|
||||
// Current position with leveling applied
|
||||
SERIAL_ECHOPGM("Leveled:");
|
||||
planner.apply_leveling(leveled);
|
||||
report_xyz(leveled);
|
||||
report_linear_axis_pos(leveled);
|
||||
|
||||
// Test planner un-leveling. This should match the Raw result.
|
||||
SERIAL_ECHOPGM("UnLevel:");
|
||||
xyze_pos_t unleveled = leveled;
|
||||
planner.unapply_leveling(unleveled);
|
||||
report_xyz(unleveled);
|
||||
report_linear_axis_pos(unleveled);
|
||||
#endif
|
||||
|
||||
#if IS_KINEMATIC
|
||||
// Kinematics applied to the leveled position
|
||||
#if IS_SCARA
|
||||
SERIAL_ECHOPGM("ScaraK: ");
|
||||
#else
|
||||
SERIAL_ECHOPGM("DeltaK: ");
|
||||
#endif
|
||||
SERIAL_ECHOPGM(TERN(IS_SCARA, "ScaraK: ", "DeltaK: "));
|
||||
inverse_kinematics(leveled); // writes delta[]
|
||||
report_xyz(delta);
|
||||
report_linear_axis_pos(delta);
|
||||
#endif
|
||||
|
||||
planner.synchronize();
|
||||
@@ -129,6 +125,15 @@
|
||||
#if AXIS_IS_L64XX(Z4)
|
||||
REPORT_ABSOLUTE_POS(Z4);
|
||||
#endif
|
||||
#if AXIS_IS_L64XX(I)
|
||||
REPORT_ABSOLUTE_POS(I);
|
||||
#endif
|
||||
#if AXIS_IS_L64XX(J)
|
||||
REPORT_ABSOLUTE_POS(J);
|
||||
#endif
|
||||
#if AXIS_IS_L64XX(K)
|
||||
REPORT_ABSOLUTE_POS(K);
|
||||
#endif
|
||||
#if AXIS_IS_L64XX(E0)
|
||||
REPORT_ABSOLUTE_POS(E0);
|
||||
#endif
|
||||
@@ -157,7 +162,7 @@
|
||||
#endif // HAS_L64XX
|
||||
|
||||
SERIAL_ECHOPGM("Stepper:");
|
||||
LOOP_XYZE(i) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
SERIAL_CHAR(' ', axis_codes[i], ':');
|
||||
SERIAL_ECHO(stepper.position((AxisEnum)i));
|
||||
}
|
||||
@@ -169,17 +174,25 @@
|
||||
planner.get_axis_position_degrees(B_AXIS)
|
||||
};
|
||||
SERIAL_ECHOPGM("Degrees:");
|
||||
report_xyze(deg, 2);
|
||||
report_all_axis_pos(deg, 2);
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPGM("FromStp:");
|
||||
get_cartesian_from_steppers(); // writes 'cartes' (with forward kinematics)
|
||||
xyze_pos_t from_steppers = { cartes.x, cartes.y, cartes.z, planner.get_axis_position_mm(E_AXIS) };
|
||||
report_xyze(from_steppers);
|
||||
xyze_pos_t from_steppers = LOGICAL_AXIS_ARRAY(
|
||||
planner.get_axis_position_mm(E_AXIS),
|
||||
cartes.x, cartes.y, cartes.z,
|
||||
planner.get_axis_position_mm(I_AXIS),
|
||||
planner.get_axis_position_mm(J_AXIS),
|
||||
planner.get_axis_position_mm(K_AXIS)
|
||||
);
|
||||
report_all_axis_pos(from_steppers);
|
||||
|
||||
const xyze_float_t diff = from_steppers - leveled;
|
||||
SERIAL_ECHOPGM("Diff: ");
|
||||
report_xyze(diff);
|
||||
SERIAL_ECHOPGM("Diff: ");
|
||||
report_all_axis_pos(diff);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
}
|
||||
|
||||
#endif // M114_DETAIL
|
||||
@@ -195,7 +208,7 @@
|
||||
void GcodeSuite::M114() {
|
||||
|
||||
#if ENABLED(M114_DETAIL)
|
||||
if (parser.seen('D')) {
|
||||
if (parser.seen_test('D')) {
|
||||
#if DISABLED(M114_LEGACY)
|
||||
planner.synchronize();
|
||||
#endif
|
||||
@@ -203,18 +216,20 @@ void GcodeSuite::M114() {
|
||||
report_current_position_detail();
|
||||
return;
|
||||
}
|
||||
if (parser.seen('E')) {
|
||||
SERIAL_ECHOLNPAIR("Count E:", stepper.position(E_AXIS));
|
||||
return;
|
||||
}
|
||||
#if HAS_EXTRUDERS
|
||||
if (parser.seen_test('E')) {
|
||||
SERIAL_ECHOLNPGM("Count E:", stepper.position(E_AXIS));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(M114_REALTIME)
|
||||
if (parser.seen('R')) { report_real_position(); return; }
|
||||
if (parser.seen_test('R')) { report_real_position(); return; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(M114_LEGACY)
|
||||
planner.synchronize();
|
||||
#endif
|
||||
TERN_(M114_LEGACY, planner.synchronize());
|
||||
report_current_position_projected();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
}
|
||||
|
Reference in New Issue
Block a user