Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] G76 - Probe temp compensation error #16995

Closed
freaked1234 opened this issue Feb 26, 2020 · 11 comments
Closed

[BUG] G76 - Probe temp compensation error #16995

freaked1234 opened this issue Feb 26, 2020 · 11 comments

Comments

@freaked1234
Copy link

freaked1234 commented Feb 26, 2020

Bug Description

Send: G76
Recv: !Probe position unreachable - aborting

Configuration_adv.txt
Configuration.txt

My Configurations

Both config files attached.
excerpt:

#define PTC_MAX_BED_TEMP 110

// Park position to wait for probe cooldown
#define PTC_PARK_POS_X 50.0F
#define PTC_PARK_POS_Y 50.0F
#define PTC_PARK_POS_Z 100.0F

// Probe position to probe and wait for probe to reach target temperature
#define PTC_PROBE_POS_X 90.0F
#define PTC_PROBE_POS_Y 100.0F

Steps to Reproduce

Using G76 always produces same error, no matter what "probe pos" and "park pos" is set. Nozzle-Probe offsets are correct. Prints fine, Auto level works fine.

Expected behavior: [What you expect to happen]

Temperature compensation calibration via G76 works

Actual behavior: [What actually happens]

Send: G76
Recv: !Probe position unreachable - aborting

Additional Information

I just dug out my Wanhao Duplicator I3 and did a few upgrades including SKR 1.4, TMC 2130 SPI and an inductive Z-probe.

It auto levels and prints fine but now I wanted to add temperature compensation for the probe by adding a thermistor. I installed a new thermistor to my probe using thermal compound and capton tape and set it up succesfully in Marlin 2.0 Bugfix. It compiled fine and the FW outputs the correct temp values for Probe Temp in addition to Nozzle and Bed temp.

When I run G76 I always get the same error, no matter what settings I apply for "park pos" and "probe pos".

Homing before doesnt make a difference.
My offsets are correct and the specified position is reachable manually.

@ellensp
Copy link
Contributor

ellensp commented Feb 27, 2020

Config file is 010109 ie older marlin. Please try current bugfix 2.0.x

@freaked1234
Copy link
Author

Config file is 010109 ie older marlin. Please try current bugfix 2.0.x

Oh? How´s that possible, I downloaded and built Marlin Bugfix 2.0.x last week and only edited the configs (not import).

@thinkyhead
Copy link
Member

thinkyhead commented Feb 27, 2020

Hmm, the configs look ok to me — both have 020004 as the version.

Quick note that PTC_PARK_POS_[XYZ] should be integers. Probably doesn't matter, but…

@ellensp
Copy link
Contributor

ellensp commented Feb 27, 2020

I'm must be senile.. version is 20004... not sue how I mucked that up.

@thinkyhead
Copy link
Member

thinkyhead commented Feb 27, 2020

Your NOZZLE_TO_PROBE_OFFSET for Y is very large: 60mm.

    // Ensure probe position is reachable
    destination.set(
      temp_comp.measure_point_x - probe.offset_xy.x, // 50 - 10 = 40
      temp_comp.measure_point_y - probe.offset_xy.y  // 50 - 60 = -10
    );
    if (!position_is_reachable_by_probe(destination)) {
      SERIAL_ECHOLNPGM("!Probe position unreachable - aborting.");
      return;
    }

But it seems like there could be some bad logic going on…

    inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
      return position_is_reachable(rx - probe.offset_xy.x, ry - probe.offset_xy.y)
                                // 40 - 10 = 30,           -10 - 60 = -70
          && WITHIN(rx, probe.min_x() - slop, probe.max_x() + slop)
          && WITHIN(ry, probe.min_y() - slop, probe.max_y() + slop);
    }

@thinkyhead
Copy link
Member

Other uses of position_is_reachable_by_probe imply that the intention was something like this:

    // Point where the probe would be when the nozzle is over the measure point
    destination.set(
      temp_comp.measure_point_x + probe.offset_xy.x, // 50 + 10 = 60
      temp_comp.measure_point_y + probe.offset_xy.y  // 50 + 60 = 110
    );

…but I believe the author (and myself) just missed that position_is_reachable_by_probe already subtracts the probe offset. So I believe you should change it to this:

    destination.set(temp_comp.measure_point_x, temp_comp.measure_point_y);

I'll push a patch shortly.

@freaked1234
Copy link
Author

So I just tryed reducing my nozzle offsets - didnt do anything

Then I changed both lines containing the values you posted in G76_m871.cpp and it didnt work either.

// Disable leveling so it won't mess with us
#if HAS_LEVELING
  set_bed_leveling_enabled(false);
#endif

bool timeout = false;
while (true) {
  // Move probe to probing point and wait for it to reach target temperature
  destination.set(temp_comp.measure_point_x, temp_comp.measure_point_y);
  do_blocking_move_to(destination);

  SERIAL_ECHOLNPAIR(
    "Bed temp: ", target_bed,
    "; Probe temp: ", target_probe,
    "  Waiting for probe heating."
  );

// Ensure probe position is reachable
destination.set(
  temp_comp.measure_point_x - probe.offset_xy.x,
  temp_comp.measure_point_y - probe.offset_xy.y
);
if (!position_is_reachable_by_probe(destination)) {
  SERIAL_ECHOLNPGM("!Probe position unreachable - aborting.");
  return;
}

  // Move probe to probing point and wait for probe to reach target temp
  destination.set(temp_comp.measure_point_x, temp_comp.measure_point_y);
  do_blocking_move_to(destination.x, destination.y, destination.z);
  SERIAL_ECHOLNPGM("Waiting for probe heating.");
  while (thermalManager.degProbe() < target_probe) {
    idle(
      #if ENABLED(ADVANCED_PAUSE_FEATURE)
        true
      #endif
    );

@freaked1234
Copy link
Author

freaked1234 commented Feb 27, 2020

Oh, I think there is an error in your fix
I think it should be this:

// Ensure probe position is reachable

if (!position_is_reachable_by_probe(temp_comp.measure_point_x, temp_comp.measure_point_y)) {
  SERIAL_ECHOLNPGM("!Probe position unreachable - aborting.");
  return;
}

G76 starts now, will report back when i finished everything

@thinkyhead
Copy link
Member

thinkyhead commented Feb 27, 2020

Oh, hi. Have a look at #17005. It looked to me like the probe position was not really referring to the position of the probe. So other changes are made there too.

@freaked1234
Copy link
Author

Thank you, everything works now, did a full calibration run!

@github-actions
Copy link

github-actions bot commented Jul 3, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants