-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
TMC2240: Allow control and use of temperature report #6769
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Timofey Titovets <[email protected]>
Signed-off-by: Timofey Titovets <[email protected]>
Signed-off-by: Timofey Titovets <[email protected]>
f94719b
to
5fb89f8
Compare
Thanks. In general the first two patches look fine. The new comments seem a little odd though - I'm not aware of any sensor that will return 0 - we should definitely fix any sensor doing that. I'm not sure about the third patch. Why would one use temperture_combined on a tmc2240 temperature? What would they combine it with? If the goal is to use a tmc2240 temperature sensor as a regular sensor, maybe we should consider adding an internal mechanism to indicate to the tmc2240 that it always needs to provide temperature (that is, have the temperature code signal the tmc2240 instead of a user config option signalling tmc2240). -Kevin |
I think that about the first patch and the delay in initialization. So, get_status which always just returns the last value of Maybe there is a more clever solution, like ... do
Maybe I misunderstood the goal of temperature combined and misused it, but I have only 2 use cases, like:
I do not see a reason to use any individual data from the drivers to control anything, AFAIK there is no external TMC2240 like TMC5160, which can be cooled individually.
If there is a way to avoid adding strange config options and do some magic behind the scenes - I agree it is a better solution (like query always if there are consumers of data - it will be a better solution). My original intention here is to just allow us to use it somehow at least because right now it is only for graphs. |
I took another look at the code, ADC sensors were provided through the heater factory, and in the end have queried through the callback which is protected with a lock. As this is a callback any structure above it will receive data when they are ready, but combined sensor - query object directly, without a callback, so it can receive data before they are ready and between readings. I think there are 2.5 possibilities to work with:
For me, it feels like callback is the correct way to go here, cause all internal users should use it, and it will automatically disallow the use of tmc2240, cause there is no setup_callback, and will update its own data on each update of sensors beneath (or maybe just cache values and still use internal 0.3s update cycle). But it is a lot of changes in different places. I'm not sure I'm qualified here to choose the correct way to fix this, I will be pleased to hear your opinion on this, maybe I just have a strong misunderstanding there. |
I like to mention that the scenario is real 😉
That is exactly my scenario. I do have a manta m8p board with 6 tmc2240 drivers and the cb1/cm4 pi on it. I would like to run the fan not faster than needed, defined by the max of all these temperature sensors. At the moment I combined the manta and the cb1 temperature sensor only. It's OK - but could be better 😊 Best regards |
Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html There are some steps that you can take now:
Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available. Best regards, PS: I'm just an automated script, not a human being. |
My personal goal:
I like to control all fans, the printer is at home and I try to minimize noise if possible.
There are 3 patches:
Duct tape fix for race conditions with temperature combined sensor and other sensors during klippy initialization, where sensors can return 0. This may be by design, but it currently limits the minimum possible deviation between sensors. Like there, it is adc + i2c:
Temperature combined allows us to set "any" object in the sensor list, but with tmc2240, there is a corner case, it has method
get_status()
andtemperature
field, but it has no value. So, it will crush Klippy cause max/min can't handleNone
.Proposal to allow monitoring of TMC2240 continuously, which in the end allows the use of it as combined sensor to control fans.
I can split PR if needed.
Should close: #6675