@@ -297,7 +297,13 @@ G29_parameters_t unified_bed_leveling::param;
297
297
298
298
void unified_bed_leveling::G29 () {
299
299
300
- bool probe_deployed = false ;
300
+ #ifdef EVENT_GCODE_AFTER_G29
301
+ bool probe_deployed = false ;
302
+ #define SET_PROBE_DEPLOYED (N ) probe_deployed = N
303
+ #else
304
+ #define SET_PROBE_DEPLOYED (N )
305
+ #endif
306
+
301
307
if (G29_parse_parameters ()) return ; // Abort on parameter error
302
308
303
309
const uint8_t p_val = parser.byteval (' P' );
@@ -316,6 +322,11 @@ void unified_bed_leveling::G29() {
316
322
#endif
317
323
probe.use_probing_tool ();
318
324
325
+ #ifdef EVENT_GCODE_BEFORE_G29
326
+ if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" Before G29 G-code: " , EVENT_GCODE_BEFORE_G29);
327
+ gcode.process_subcommands_now (F (EVENT_GCODE_BEFORE_G29));
328
+ #endif
329
+
319
330
// Position bed horizontally and Z probe vertically.
320
331
#if HAS_SAFE_BED_LEVELING
321
332
xyze_pos_t safe_position = current_position;
@@ -430,7 +441,7 @@ void unified_bed_leveling::G29() {
430
441
do_blocking_move_to_xy (0 .5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0 .5f * ((MESH_MIN_Y) + (MESH_MAX_Y)));
431
442
#endif
432
443
report_current_position ();
433
- probe_deployed = true ;
444
+ SET_PROBE_DEPLOYED ( true ) ;
434
445
}
435
446
436
447
#endif // HAS_BED_PROBE
@@ -465,7 +476,7 @@ void unified_bed_leveling::G29() {
465
476
probe_entire_mesh (param.XY_pos , parser.seen_test (' T' ), parser.seen_test (' E' ), parser.seen_test (' U' ));
466
477
467
478
report_current_position ();
468
- probe_deployed = true ;
479
+ SET_PROBE_DEPLOYED ( true ) ;
469
480
} break ;
470
481
471
482
#endif // HAS_BED_PROBE
@@ -503,7 +514,7 @@ void unified_bed_leveling::G29() {
503
514
SERIAL_ECHOLNPGM (" ?Error in Business Card measurement." );
504
515
return ;
505
516
}
506
- probe_deployed = true ;
517
+ SET_PROBE_DEPLOYED ( true ) ;
507
518
}
508
519
509
520
if (!position_is_reachable (param.XY_pos )) {
@@ -681,13 +692,11 @@ void unified_bed_leveling::G29() {
681
692
#endif
682
693
683
694
#ifdef EVENT_GCODE_AFTER_G29
684
- if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" Z Probe End Script : " , EVENT_GCODE_AFTER_G29);
695
+ if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" After G29 G-code : " , EVENT_GCODE_AFTER_G29);
685
696
if (probe_deployed) {
686
697
planner.synchronize ();
687
698
gcode.process_subcommands_now (F (EVENT_GCODE_AFTER_G29));
688
699
}
689
- #else
690
- UNUSED (probe_deployed);
691
700
#endif
692
701
693
702
probe.use_probing_tool (false );
0 commit comments