mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 12:04:19 +00:00
Expand on serial debugging (#13577)
This commit is contained in:
parent
bf7b28b456
commit
cf12fc8366
@ -47,6 +47,7 @@
|
||||
#undef DEBUG_DELAY
|
||||
|
||||
#if DEBUG_OUT
|
||||
#define DEBUG_PRINT_P(P) serialprintPGM(P)
|
||||
#define DEBUG_ECHO_START SERIAL_ECHO_START
|
||||
#define DEBUG_ERROR_START SERIAL_ERROR_START
|
||||
#define DEBUG_CHAR SERIAL_CHAR
|
||||
@ -66,6 +67,7 @@
|
||||
#define DEBUG_XYZ SERIAL_XYZ
|
||||
#define DEBUG_DELAY(ms) serial_delay(ms)
|
||||
#else
|
||||
#define DEBUG_PRINT_P(P) NOOP
|
||||
#define DEBUG_ECHO_START() NOOP
|
||||
#define DEBUG_ERROR_START() NOOP
|
||||
#define DEBUG_CHAR(...) NOOP
|
||||
|
@ -50,8 +50,14 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P)
|
||||
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
|
||||
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) {
|
||||
if (pre) serialprintPGM(pre);
|
||||
serialprintPGM(onoff ? on : off);
|
||||
if (post) serialprintPGM(post);
|
||||
}
|
||||
void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
|
||||
void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
|
||||
void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
|
||||
|
||||
void print_bin(const uint16_t val) {
|
||||
uint16_t mask = 0x8000;
|
||||
|
@ -174,8 +174,10 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PG
|
||||
void serialprintPGM(PGM_P str);
|
||||
void serial_echo_start();
|
||||
void serial_error_start();
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL);
|
||||
void serialprint_onoff(const bool onoff);
|
||||
void serialprintln_onoff(const bool onoff);
|
||||
void serialprint_truefalse(const bool tf);
|
||||
void serial_spaces(uint8_t count);
|
||||
|
||||
void print_bin(const uint16_t val);
|
||||
|
@ -227,13 +227,11 @@ bool I2CPositionEncoder::passes_test(const bool report) {
|
||||
if (report) {
|
||||
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
|
||||
SERIAL_ECHO(axis_codes[encoderAxis]);
|
||||
SERIAL_ECHOPGM(" axis ");
|
||||
serialprintPGM(H == I2CPE_MAG_SIG_BAD ? PSTR("magnetic strip ") : PSTR("encoder "));
|
||||
serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder "));
|
||||
switch (H) {
|
||||
case I2CPE_MAG_SIG_GOOD:
|
||||
case I2CPE_MAG_SIG_MID:
|
||||
SERIAL_ECHOLNPGM("passes test; field strength ");
|
||||
serialprintPGM(H == I2CPE_MAG_SIG_GOOD ? PSTR("good.\n") : PSTR("fair.\n"));
|
||||
serial_ternary(H == I2CPE_MAG_SIG_GOOD, PSTR("passes test; field strength "), PSTR("good"), PSTR("fair"), PSTR(".\n"));
|
||||
break;
|
||||
default:
|
||||
SERIAL_ECHOLNPGM("not detected!");
|
||||
|
@ -275,9 +275,8 @@ class I2CPositionEncodersMgr {
|
||||
static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
encoders[idx].set_ec_enabled(enabled);
|
||||
SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis], " axis is ");
|
||||
serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis"));
|
||||
SERIAL_ECHOLNPGM("abled.");
|
||||
SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]);
|
||||
serial_ternary(encoders[idx].get_ec_enabled(), PSTR(" axis is "), PSTR("en"), PSTR("dis"), PSTR("abled.\n"));
|
||||
}
|
||||
|
||||
static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
|
||||
|
@ -42,10 +42,6 @@
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
bool g26_debug_flag; // = false
|
||||
#endif
|
||||
|
||||
bool leveling_is_valid() {
|
||||
return
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
|
@ -28,12 +28,6 @@ typedef struct {
|
||||
float distance; // When populated, the distance from the search location
|
||||
} mesh_index_pair;
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
extern bool g26_debug_flag;
|
||||
#else
|
||||
constexpr bool g26_debug_flag = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
extern bool g29_in_progress;
|
||||
#else
|
||||
|
@ -58,54 +58,10 @@
|
||||
|
||||
void unified_bed_leveling::report_state() {
|
||||
echo_name();
|
||||
SERIAL_ECHOPGM(" System v" UBL_VERSION " ");
|
||||
if (!planner.leveling_active) SERIAL_ECHOPGM("in");
|
||||
SERIAL_ECHOLNPGM("active.");
|
||||
serial_ternary(planner.leveling_active, PSTR(" System v" UBL_VERSION " "), PSTR(""), PSTR("in"), PSTR("active\n"));
|
||||
serial_delay(50);
|
||||
}
|
||||
|
||||
#if ENABLED(UBL_DEVEL_DEBUGGING)
|
||||
|
||||
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(PGM_P 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;
|
||||
|
||||
const float fpmm = de / xy_dist;
|
||||
SERIAL_ECHOPAIR_F(" fpmm=", fpmm, 6);
|
||||
SERIAL_ECHOPAIR_F(" current=( ", current_position[X_AXIS], 6);
|
||||
SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
|
||||
SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
|
||||
SERIAL_ECHOPAIR_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(" ) ");
|
||||
serialprintPGM(title);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
#endif // UBL_DEVEL_DEBUGGING
|
||||
|
||||
int8_t unified_bed_leveling::storage_slot;
|
||||
|
||||
float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
||||
|
@ -39,14 +39,6 @@
|
||||
#define USE_NOZZLE_AS_REFERENCE 0
|
||||
#define USE_PROBE_AS_REFERENCE 1
|
||||
|
||||
// ubl_motion.cpp
|
||||
|
||||
#if ENABLED(UBL_DEVEL_DEBUGGING)
|
||||
void debug_current_and_destination(PGM_P const title);
|
||||
#else
|
||||
FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); }
|
||||
#endif
|
||||
|
||||
// ubl_G29.cpp
|
||||
|
||||
enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };
|
||||
|
@ -24,8 +24,6 @@
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
//#define UBL_DEVEL_DEBUGGING
|
||||
|
||||
#include "ubl.h"
|
||||
|
||||
#include "../../../Marlin.h"
|
||||
|
@ -64,17 +64,6 @@
|
||||
cell_dest_xi = get_cell_index_x(end[X_AXIS]),
|
||||
cell_dest_yi = get_cell_index_y(end[Y_AXIS]);
|
||||
|
||||
if (g26_debug_flag) {
|
||||
SERIAL_ECHOLNPAIR(
|
||||
" ubl.line_to_destination_cartesian(xe=", destination[X_AXIS],
|
||||
", ye=", destination[Y_AXIS],
|
||||
", ze=", destination[Z_AXIS],
|
||||
", ee=", destination[E_AXIS],
|
||||
")"
|
||||
);
|
||||
debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()"));
|
||||
}
|
||||
|
||||
// A move within the same cell needs no splitting
|
||||
if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) {
|
||||
|
||||
@ -93,9 +82,6 @@
|
||||
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
|
||||
set_current_from_destination();
|
||||
|
||||
if (g26_debug_flag)
|
||||
debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,9 +105,6 @@
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder);
|
||||
|
||||
if (g26_debug_flag)
|
||||
debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()"));
|
||||
|
||||
set_current_from_destination();
|
||||
return;
|
||||
}
|
||||
@ -215,9 +198,6 @@
|
||||
} //else printf("FIRST MOVE PRUNED ");
|
||||
}
|
||||
|
||||
if (g26_debug_flag)
|
||||
debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()"));
|
||||
|
||||
// At the final destination? Usually not, but when on a Y Mesh Line it's completed.
|
||||
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
||||
goto FINAL_MOVE;
|
||||
@ -267,9 +247,6 @@
|
||||
} //else printf("FIRST MOVE PRUNED ");
|
||||
}
|
||||
|
||||
if (g26_debug_flag)
|
||||
debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()"));
|
||||
|
||||
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
||||
goto FINAL_MOVE;
|
||||
|
||||
@ -353,9 +330,6 @@
|
||||
if (xi_cnt < 0 || yi_cnt < 0) break; // Too far! Exit the loop and go to FINAL_MOVE
|
||||
}
|
||||
|
||||
if (g26_debug_flag)
|
||||
debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()"));
|
||||
|
||||
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
||||
goto FINAL_MOVE;
|
||||
|
||||
|
@ -50,6 +50,9 @@ job_recovery_info_t PrintJobRecovery::info;
|
||||
#include "fwretract.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
PrintJobRecovery recovery;
|
||||
|
||||
/**
|
||||
@ -110,9 +113,7 @@ void PrintJobRecovery::load() {
|
||||
(void)file.read(&info, sizeof(info));
|
||||
close();
|
||||
}
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
debug(PSTR("Load"));
|
||||
#endif
|
||||
debug(PSTR("Load"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,20 +217,14 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
||||
*/
|
||||
void PrintJobRecovery::write() {
|
||||
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
debug(PSTR("Write"));
|
||||
#endif
|
||||
debug(PSTR("Write"));
|
||||
|
||||
open(false);
|
||||
file.seekSet(0);
|
||||
const int16_t ret = file.write(&info, sizeof(info));
|
||||
close();
|
||||
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed.");
|
||||
#else
|
||||
UNUSED(ret);
|
||||
#endif
|
||||
if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,65 +362,65 @@ void PrintJobRecovery::resume() {
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
|
||||
void PrintJobRecovery::debug(PGM_P const prefix) {
|
||||
serialprintPGM(prefix);
|
||||
SERIAL_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
|
||||
DEBUG_PRINT_P(prefix);
|
||||
DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
|
||||
if (info.valid_head) {
|
||||
if (info.valid_head == info.valid_foot) {
|
||||
SERIAL_ECHOPGM("current_position: ");
|
||||
DEBUG_ECHOPGM("current_position: ");
|
||||
LOOP_XYZE(i) {
|
||||
if (i) SERIAL_CHAR(',');
|
||||
SERIAL_ECHO(info.current_position[i]);
|
||||
if (i) DEBUG_CHAR(',');
|
||||
DEBUG_ECHO(info.current_position[i]);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate);
|
||||
DEBUG_EOL();
|
||||
DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
|
||||
|
||||
#if HOTENDS > 1
|
||||
SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
|
||||
DEBUG_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOPGM("target_temperature: ");
|
||||
DEBUG_ECHOPGM("target_temperature: ");
|
||||
HOTEND_LOOP() {
|
||||
SERIAL_ECHO(info.target_temperature[e]);
|
||||
if (e < HOTENDS - 1) SERIAL_CHAR(',');
|
||||
DEBUG_ECHO(info.target_temperature[e]);
|
||||
if (e < HOTENDS - 1) DEBUG_CHAR(',');
|
||||
}
|
||||
SERIAL_EOL();
|
||||
DEBUG_EOL();
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
|
||||
DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
|
||||
#endif
|
||||
|
||||
#if FAN_COUNT
|
||||
SERIAL_ECHOPGM("fan_speed: ");
|
||||
DEBUG_ECHOPGM("fan_speed: ");
|
||||
FANS_LOOP(i) {
|
||||
SERIAL_ECHO(int(info.fan_speed[i]));
|
||||
if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
|
||||
DEBUG_ECHO(int(info.fan_speed[i]));
|
||||
if (i < FAN_COUNT - 1) DEBUG_CHAR(',');
|
||||
}
|
||||
SERIAL_EOL();
|
||||
DEBUG_EOL();
|
||||
#endif
|
||||
|
||||
#if HAS_LEVELING
|
||||
SERIAL_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
|
||||
DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
|
||||
#endif
|
||||
#if ENABLED(FWRETRACT)
|
||||
SERIAL_ECHOPGM("retract: ");
|
||||
DEBUG_ECHOPGM("retract: ");
|
||||
for (int8_t e = 0; e < EXTRUDERS; e++) {
|
||||
SERIAL_ECHO(info.retract[e]);
|
||||
if (e < EXTRUDERS - 1) SERIAL_CHAR(',');
|
||||
DEBUG_ECHO(info.retract[e]);
|
||||
if (e < EXTRUDERS - 1) DEBUG_CHAR(',');
|
||||
}
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop);
|
||||
DEBUG_EOL();
|
||||
DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop);
|
||||
#endif
|
||||
SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
|
||||
SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
|
||||
for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]);
|
||||
SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename);
|
||||
SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos);
|
||||
SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
|
||||
DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
|
||||
DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
|
||||
for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]);
|
||||
DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
|
||||
DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
|
||||
DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
|
||||
}
|
||||
else
|
||||
SERIAL_ECHOLNPGM("INVALID DATA");
|
||||
DEBUG_ECHOLNPGM("INVALID DATA");
|
||||
}
|
||||
SERIAL_ECHOLNPGM("---");
|
||||
DEBUG_ECHOLNPGM("---");
|
||||
}
|
||||
|
||||
#endif // DEBUG_POWER_LOSS_RECOVERY
|
||||
|
@ -125,9 +125,11 @@ class PrintJobRecovery {
|
||||
|
||||
static inline bool valid() { return info.valid_head && info.valid_head == info.valid_foot; }
|
||||
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
static void debug(PGM_P const prefix);
|
||||
#endif
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
static void debug(PGM_P const prefix);
|
||||
#else
|
||||
static inline void debug(PGM_P const prefix) {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void write();
|
||||
|
@ -474,7 +474,7 @@
|
||||
switch (i) {
|
||||
case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
|
||||
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
|
||||
case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@ -497,7 +497,7 @@
|
||||
switch (i) {
|
||||
case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
|
||||
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
|
||||
case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
|
||||
case TMC_GLOBAL_SCALER:
|
||||
{
|
||||
uint16_t value = st.GLOBAL_SCALER();
|
||||
@ -514,7 +514,7 @@
|
||||
static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
|
||||
switch (i) {
|
||||
case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
|
||||
case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
|
||||
case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break;
|
||||
case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break;
|
||||
default: break;
|
||||
@ -541,7 +541,7 @@
|
||||
SERIAL_CHAR('\t');
|
||||
switch (i) {
|
||||
case TMC_CODES: st.printLabel(); break;
|
||||
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
|
||||
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
|
||||
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
|
||||
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
|
||||
@ -578,9 +578,9 @@
|
||||
SERIAL_CHAR('-');
|
||||
}
|
||||
break;
|
||||
case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
|
||||
#endif
|
||||
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
|
||||
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
|
||||
@ -596,7 +596,7 @@
|
||||
SERIAL_CHAR('\t');
|
||||
switch (i) {
|
||||
case TMC_CODES: st.printLabel(); break;
|
||||
case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
|
||||
case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
|
||||
case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
|
||||
case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
|
||||
case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
|
||||
@ -606,8 +606,8 @@
|
||||
break;
|
||||
case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
|
||||
case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
|
||||
//case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
|
||||
//case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
|
||||
//case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
|
||||
//case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
|
||||
case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
|
||||
case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
|
||||
case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
|
||||
|
@ -227,7 +227,7 @@ void tmc_set_current(TMC &st, const int mA) {
|
||||
void tmc_report_otpw(TMC &st) {
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM(" temperature prewarn triggered: ");
|
||||
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
|
||||
serialprint_truefalse(st.getOTPW());
|
||||
SERIAL_EOL();
|
||||
}
|
||||
template<typename TMC>
|
||||
|
@ -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
|
@ -29,17 +29,20 @@
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../lcd/ultralcd.h"
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
void menu_job_recovery();
|
||||
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
|
||||
inline void plr_error(PGM_P const prefix) {
|
||||
SERIAL_ECHO_START();
|
||||
inline void plr_error(PGM_P const prefix) {
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
DEBUG_ECHO_START();
|
||||
serialprintPGM(prefix);
|
||||
SERIAL_ECHOLNPGM(" Power-Loss Recovery Data");
|
||||
}
|
||||
|
||||
#endif
|
||||
DEBUG_ECHOLNPGM(" Power-Loss Recovery Data");
|
||||
#else
|
||||
UNUSED(prefix);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* M1000: Resume from power-loss (undocumented)
|
||||
@ -54,11 +57,8 @@ void GcodeSuite::M1000() {
|
||||
else
|
||||
recovery.resume();
|
||||
}
|
||||
else {
|
||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||
plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
|
||||
|
||||
}
|
||||
|
||||
|
@ -348,10 +348,6 @@ void GcodeSuite::process_parsed_command(
|
||||
case 48: M48(); break; // M48: Z probe repeatability test
|
||||
#endif
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
case 73: M73(); break; // M73: Set progress percentage (for display on LCD)
|
||||
#endif
|
||||
|
@ -495,10 +495,6 @@ private:
|
||||
static void M48();
|
||||
#endif
|
||||
|
||||
#if ENABLED(G26_MESH_VALIDATION)
|
||||
static void M49();
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
static void M73();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user