Expand on serial debugging (#13577)
This commit is contained in:
@ -246,8 +246,6 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de
|
||||
// Yes: a 'normal' movement. No: a retract() or recover()
|
||||
feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5;
|
||||
|
||||
if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
|
||||
|
||||
destination[X_AXIS] = rx;
|
||||
destination[Y_AXIS] = ry;
|
||||
destination[E_AXIS] += e_delta;
|
||||
@ -327,19 +325,15 @@ inline bool look_for_lines_to_connect() {
|
||||
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation
|
||||
if (user_canceled()) return true;
|
||||
#endif
|
||||
|
||||
if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
|
||||
// This is already a half circle because we are at the edge of the bed.
|
||||
if (i < GRID_MAX_POINTS_X) { // Can't connect to anything to the right than GRID_MAX_POINTS_X.
|
||||
// Already a half circle at the edge of the bed.
|
||||
|
||||
if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
|
||||
if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) {
|
||||
|
||||
//
|
||||
// We found two circles that need a horizontal line to connect them
|
||||
// Print it!
|
||||
//
|
||||
// Two circles need a horizontal line to connect them
|
||||
sx = _GET_MESH_X( i ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
|
||||
ex = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
|
||||
|
||||
@ -347,27 +341,19 @@ inline bool look_for_lines_to_connect() {
|
||||
sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
|
||||
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOLNPAIR(" Connecting with horizontal line (sx=", sx, ", sy=", sy, ") -> (ex=", ex, ", ey=", ey, ")");
|
||||
//debug_current_and_destination(PSTR("Connecting horizontal line."));
|
||||
}
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
|
||||
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
||||
}
|
||||
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it
|
||||
|
||||
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark done, even if skipped
|
||||
}
|
||||
}
|
||||
|
||||
if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y.
|
||||
// This is already a half circle because we are at the edge of the bed.
|
||||
if (j < GRID_MAX_POINTS_Y) { // Can't connect to anything further back than GRID_MAX_POINTS_Y.
|
||||
// Already a half circle at the edge of the bed.
|
||||
|
||||
if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
|
||||
if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) {
|
||||
//
|
||||
// We found two circles that need a vertical line to connect them
|
||||
// Print it!
|
||||
//
|
||||
// Two circles that need a vertical line to connect them
|
||||
sy = _GET_MESH_Y( j ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
|
||||
ey = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
|
||||
|
||||
@ -375,23 +361,10 @@ inline bool look_for_lines_to_connect() {
|
||||
sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
|
||||
SERIAL_ECHOPAIR(", sy=", sy);
|
||||
SERIAL_ECHOPAIR(") -> (ex=", ex);
|
||||
SERIAL_ECHOPAIR(", ey=", ey);
|
||||
SERIAL_CHAR(')');
|
||||
SERIAL_EOL();
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
debug_current_and_destination(PSTR("Connecting vertical line."));
|
||||
#endif
|
||||
}
|
||||
if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
|
||||
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
||||
}
|
||||
bitmap_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped
|
||||
|
||||
bitmap_set(vertical_mesh_line_flags, i, j); // Mark done, even if skipped
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -725,8 +698,6 @@ void GcodeSuite::G26() {
|
||||
ui.capture();
|
||||
#endif
|
||||
|
||||
//debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
|
||||
|
||||
#if DISABLED(ARC_SUPPORT)
|
||||
|
||||
/**
|
||||
@ -819,18 +790,6 @@ void GcodeSuite::G26() {
|
||||
const float save_feedrate = feedrate_mm_s;
|
||||
feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0;
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]);
|
||||
SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]);
|
||||
SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]);
|
||||
SERIAL_ECHOPAIR(", len=", arc_length);
|
||||
SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]);
|
||||
SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]);
|
||||
SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]);
|
||||
SERIAL_CHAR(')');
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc
|
||||
feedrate_mm_s = save_feedrate;
|
||||
set_destination_from_current();
|
||||
@ -898,16 +857,13 @@ void GcodeSuite::G26() {
|
||||
retract_filament(destination);
|
||||
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
|
||||
|
||||
//debug_current_and_destination(PSTR("ready to do Z-Raise."));
|
||||
move_to(destination, 0); // Raise the nozzle
|
||||
//debug_current_and_destination(PSTR("done doing Z-Raise."));
|
||||
|
||||
destination[X_AXIS] = g26_x_pos; // Move back to the starting position
|
||||
destination[Y_AXIS] = g26_y_pos;
|
||||
//destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
||||
|
||||
move_to(destination, 0); // Move back to the starting position
|
||||
//debug_current_and_destination(PSTR("done doing X/Y move."));
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
parser.volumetric_enabled = volumetric_was_enabled;
|
||||
|
@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M49.cpp - Toggle the G26 debug flag
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/bedlevel/bedlevel.h"
|
||||
|
||||
void GcodeSuite::M49() {
|
||||
g26_debug_flag ^= true;
|
||||
SERIAL_ECHOPGM("G26 Debug: ");
|
||||
serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
|
||||
}
|
||||
|
||||
#endif // G26_MESH_VALIDATION
|
Reference in New Issue
Block a user