BED_SCREWS_ADJUST infinite loop

BED_SCREWS_ADJUST will go through screw1, screw2, etc. in adjust mode, and then it goes through screw1_fine_adjust, screw2_fine_adjust, etc. in fine mode.

The above works fine as long as there is the same number of “adjust” and “fine” positions, but if we have less “fine” ones, this will enter an infinite loop

For this, I have tested with the following configuration section:

[bed_screws]
screw1: 100, 50
screw1_fine_adjust: 0, 0
screw2: 100, 150
screw3: 150, 100

Current implementation is based on comparing with number_of_screws, and that is the number of “adjust” screws, so in “fine” mode it will just fail the check and go back to “adjust” mode.

I see at least 2 ways of fixing this:

  • do a check that the number of screws is the same for “adjust” and “fine” modes
  • change the code to not rely on “adjust” screws count only

More than anything, I just want to understand what is the correct/expected behavior here as I am buiding the UI for this in Fluidd!

From my tests, the sample configuration I posted above will perform this behavior:

  • Adjust screw1, send ACCEPT
  • Adjust screw2, send ACCEPT
  • Adjust screw3, send ACCEPT
  • Adjust screw1 (“fine” mode), send ACCEPT
  • Adjust screw1 (back to “adjust” mode)…

So we are back on the same flow, even though we always choose to do ACCEPT!

It seems very few people configure the “fine adjust” mode. It was useful on my Makergear M2, which has screws under the bed. Most printers place the bed screws near the outside of the bed, where there is little gain in having a fine adjust pass.

FWIW, I intended there to be an equal number of fine adjust points as regular points. So, I’d problably just add a config check for that.

Cheers,
-Kevin

Cheers Kevin, thanks for clearing that!

In fairness, I see little reason to have the “fine” screws as one could just add extra “adjust” screws and achieve the same result!

I will work on the assumption that we have the same number of “adjust” and “fine” screws and will try to send a PR to Klipper at a later time with a check for this (unless someone else beats me to it!)