Hall Filament Width Sensor Improvments

I’m hoping to get some more feedback and review of a PR I submitted to improve the hall filament width sensor: hall_filament_width_sensor: Add option to enable or disable flow compensation, add command descriptions, and improve query command output by benlye · Pull Request #7210 · Klipper3d/klipper · GitHub

This started as a “simple” change to implement a switch which would disable the flow compensation but keep the width sensor and runout sensor active. This option would be very useful for anyone running the FreeDi firmware on their Qidi printer as our width sensors are not really good enough to provide helpful flow compensation, but work fine for filament detection. Implementing this option in mainline Klipper will allow us to remove a custom variant of the module.

Along the way I found and fixed a few other bugs in the width sensor code and made a couple of other minor improvements which will benefit all users of the module:

  • Fixed a bug where the filament sensor state could be out of sync with the width sensor state, leading to the filament sensor being stuck in the state it was in when the width sensor was disabled and the UI being out of sync with the printer’s state
  • Fixed a race condition when the sensor was being disabled and the M221 S100 reset commands were ignored
  • Normalized the output of the query command
  • Added command descriptions

Importantly, the default behavior of the code hasn’t changed (other than the bug fixes) so there should be no unexpected impact to existing users.

  • The user can choose to have flow compensation enabled or disabled at startup (default is enabled), independent of having the width sensor enabled or disabled
  • The runout sensor is properly controlled/configured when the flow sensor is enabled/disabled
  • The UI toggle switch in Mainsail works properly

We’ve had a bit of discussion in the PR thread, and I think I’ve made all the necessary changes. I’ve been running this code on my Qidi Q1 Pro for several weeks and all my tests show that everything works as expected.

Is there anything more I need to do?

I was coming here to do the same.

That patch has been checked already by Kevin before the latest change in function parameters, it would take only few minutes to any dev to review it.

I did what I could by having multiple AI review and and they all passed without remarks.

A real person should do it, and then hopefully Kevin can merge it.

The patch introduces a feature (disable the flow compensation but keep the width sensor and runout sensor active) which is really really important to the users with a Hall filament sensor!