Skip to content

feat: load-cell tool detection and latch helpers - #26

Open
charliemayall wants to merge 9 commits into
BondtechAB:mainfrom
charliemayall:feat/indx-helpers
Open

feat: load-cell tool detection and latch helpers#26
charliemayall wants to merge 9 commits into
BondtechAB:mainfrom
charliemayall:feat/indx-helpers

Conversation

@charliemayall

@charliemayall charliemayall commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

feat: load-cell tool detection and latch helpers

Summary

Adds macros/indx-helpers.cfg for latch helpers and load-cell tool presence.

The helpers aid users in recovering from awkward states.

Tool presence detection fixes the fact that the current macros don't maintain correct tool state. They also provide a means to pause / resume printing when a pickup fails, rather than erroring out.

Helpers (in place, alter state):

  • INDX_LOCK / INDX_UNLOCK
  • INDX_FORCE_STATE ACTIVE_TOOL=<n|-1> - soft-state only

Tool presence:

  • VERIFY_TOOL_PRESENT - manual seat check
  • Pickup runs detect automatically after latch lock
  • Mid-print fail -> PAUSE, user can run CHANGE_TOOL TOOL=<n> or seat tool by hand, then RESUME
  • Idle fail -> Error

Requires a calibrated [load_cell_probe] (CALIBRATE_LOAD_CELL / CALIBRATE_LOAD_CELL_APPLY).

Files

File Change
macros/indx-helpers.cfg New - helpers + verify + RESUME recovery
macros/indx-tc-macros.cfg Detect constants; pickup calls verify; fail paths

Include order

[include indx.cfg]
[include indx-tc-macros.cfg]
[include indx-cal.cfg]
[include indx-helpers.cfg]

@ogland

ogland commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

First off, sorry this has been sitting. You've opened a lot of PRs and got nothing back from us for a month, which isn't good enough. I went through all of them today and merged #4, #6, #10, #11, #12, #13, #28 and #33. #6 in particular was a proper bug, thanks for catching that one.

This one I want to take, but not as a single PR. There are three separate things in here and they have very different review costs: homing.cfg, the load-cell tool detection helpers, and print_start.cfg.

If you can split them I'll take the homing one more or less immediately, it closes #8, which is one of the oldest things in the tracker. It's also better than what I'd have written. Reusing probe_z_clearance and probe_x/probe_y instead of adding new variables is the right call, and SET_KINEMATIC_POSITION ... CLEAR_HOMED is cleaner than force-moving the Z steppers. The VERIFY split across follow-up macros to read last_ok is a nice bit of work, that one isn't obvious at all.

Two things on it though. It depends on VERIFY_TOOL_PRESENT from the helpers file, so as it stands homing can't go in without the tool detection, is that separable, with the verify steps skipped when the helpers aren't included? And it homes Z with whatever tool is seated rather than always T0, which changes what the docs currently promise. I'm not saying no, your reasoning about re-applying offsets holds, I just want to think it through before it becomes the documented behaviour. Happy to add the sensorless current reduce/restore into it too, we've got a version of that block already, so you don't need to write it.

The thing I'm least sure about is RESUME. Having INDX own RESUME and asking everyone to hand-patch their mainsail.cfg is a lot to put on users, and it'll generate support traffic every time Mainsail changes that file. Is there a way to get the mid-print presence check without taking the command over? Happy to be told there isn't, but I'd like to rule it out first.

Also worth noting the tool detection basically answers #29 as well.

@charliemayall

Copy link
Copy Markdown
Contributor Author

Hi Olof,

So essentially I agree with everything you have pointed out in terms of this being rather multi-targeted.

I don't actually use this myself anymore, as I have transitioned to a load cell + induction coil voltage detection klippy extra. I will take a look regarding the split, I'm sure it will be possible, but I will need a moment to test as my config has largely diverged from this setup.

Re mainsail. Agreed this is a burden. There may be a better way, but I did not find it.

Z-offsets: The idea I had with this is:

  • Most of the time, I am printing the 1st layer with 1 tool. This is the most sensitive layer, in terms of z offset, so I may as well home with the tool I will be using.
  • Because I perform a brush before Z homing, and a brush for the tool being printed with, I wanted to roll that into one and not have to select T0 and brush it for the sole purpose of homing.

Charlie

@ogland

ogland commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Went through the whole thing properly now, and I want to revise what I said above.

Two things worth calling out first. Not raising an error on a mid-print detect failure is exactly right; I hadn't thought about SD printing treating that as a print failure. And homing_busy is a cleaner answer to the self-homing recursion than what I'd have reached for.

What I'd like to take, in order:

  1. homing.cfg plus the homing_busy flag. I'll take this as soon as it stands alone and it closes homing.cfg not provided, G28's called by your macros likely to crash #8, the oldest thing in the tracker. The blocker is the VERIFY_TOOL_PRESENT dependency: can the verify steps be skipped when the helpers file isn't included?

  2. The latch helpersINDX_LOCK, INDX_UNLOCK, INDX_FORCE_STATE. Small, no dock movement, obviously useful for digging yourself out of a bad state. Happy to take these largely as-is.

  3. print_start.cfg — I'd rather this were a documented example than a file we ship. It hard-depends on KAMP and SAFE_Z_TILT_ADJUST, which most people won't have, and it redoes the homing that homing.cfg is already handling.

On tool detection, I'd like to hold off, and it's worth explaining why rather than just saying no. We've tried presence detection off the load cell in our own testing and couldn't get it consistent. If you want to keep going at it I'd be interested to see it, but I don't want it gating every pickup by default since a false negative mid-print is worse than no detection at all.

That also means the RESUME work isn't needed, since owning RESUME only existed to serve the mid-print recheck. Which is a relief since I wasn't keen on a five-step manual edit to everyone's mainsail.cfg being a prerequisite for resume working properly.

The T0 question from my last comment still stands on the homing piece. That's the only part I'm genuinely undecided on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants