️ Apply PTC on all probing (#23764)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
tombrazier
2022-02-22 01:15:52 +00:00
committed by Scott Lahteine
parent 56cec9690a
commit 7ec2167a73
8 changed files with 48 additions and 14 deletions

View File

@ -109,7 +109,9 @@ static void say_failed_to_calibrate() { SERIAL_ECHOPGM("!Failed to calibra
auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) {
do_z_clearance(5.0); // Raise nozzle before probing
ptc.set_enabled(false);
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
ptc.set_enabled(true);
if (isnan(measured_z))
SERIAL_ECHOLNPGM("!Received NAN. Aborting.");
else {

View File

@ -35,11 +35,15 @@
#include "../../module/planner.h"
#endif
#if HAS_PTC
#include "../../feature/probe_temp_comp.h"
#endif
/**
* M48: Z probe repeatability measurement function.
*
* Usage:
* M48 <P#> <X#> <Y#> <V#> <E> <L#> <S>
* M48 <P#> <X#> <Y#> <V#> <E> <L#> <S> <C#>
* P = Number of sampled points (4-50, default 10)
* X = Sample X position
* Y = Sample Y position
@ -47,6 +51,7 @@
* E = Engage Z probe for each reading
* L = Number of legs of movement before probe
* S = Schizoid (Or Star if you prefer)
* C = Enable probe temperature compensation (0 or 1, default 1)
*
* This function requires the machine to be homed before invocation.
*/
@ -107,6 +112,8 @@ void GcodeSuite::M48() {
set_bed_leveling_enabled(false);
#endif
TERN_(HAS_PTC, ptc.set_enabled(!parser.seen('C') || parser.value_bool()));
// Work with reasonable feedrates
remember_feedrate_scaling_off();
@ -269,6 +276,9 @@ void GcodeSuite::M48() {
// Re-enable bed level correction if it had been on
TERN_(HAS_LEVELING, set_bed_leveling_enabled(was_enabled));
// Re-enable probe temperature correction
TERN_(HAS_PTC, ptc.set_enabled(true));
report_current_position();
}