Skip to content

Commit

Permalink
✅ Custom logging for MBL
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 9, 2021
1 parent c753071 commit 245b6e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class G29_State {
* There's no extra effect if you have a fixed Z probe.
*/
G29_TYPE GcodeSuite::G29() {
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));

TERN_(PROBE_MANUALLY, static) G29_State abl;

TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
Expand All @@ -227,11 +229,7 @@ G29_TYPE GcodeSuite::G29() {

// G29 Q is also available if debugging
#if ENABLED(DEBUG_LEVELING_FEATURE)
const uint8_t old_debug_flags = marlin_debug_flags;
if (seenQ) marlin_debug_flags |= MARLIN_DEBUG_LEVELING;
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) log_machine_info();
marlin_debug_flags = old_debug_flags;
if (seenQ || DEBUGGING(LEVELING)) log_machine_info();
if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
#endif

Expand Down Expand Up @@ -472,10 +470,8 @@ G29_TYPE GcodeSuite::G29() {
// Query G29 status
if (abl.verbose_level || seenQ) {
SERIAL_ECHOPGM("Manual G29 ");
if (g29_in_progress) {
SERIAL_ECHOPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points));
SERIAL_ECHOLNPAIR(" of ", abl.abl_points);
}
if (g29_in_progress)
SERIAL_ECHOLNPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points), " of ", abl.abl_points);
else
SERIAL_ECHOLNPGM("idle");
}
Expand Down
13 changes: 13 additions & 0 deletions Marlin/src/gcode/bedlevel/mbl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
#include "../../../lcd/extui/ui_api.h"
#endif

#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"

// Save 130 bytes with non-duplication of PSTR
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }

Expand All @@ -59,6 +62,16 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
* S5 Reset and disable mesh
*/
void GcodeSuite::G29() {
DEBUG_SECTION(log_G29, "G29", true);

// G29 Q is also available if debugging
#if ENABLED(DEBUG_LEVELING_FEATURE)
const bool seenQ = parser.seen_test('Q');
if (seenQ || DEBUGGING(LEVELING)) {
log_machine_info();
if (seenQ) return;
}
#endif

TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));

Expand Down

0 comments on commit 245b6e0

Please sign in to comment.