-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Threading of sensor reads #41
Comments
That's right. The
You can certainly do that. There should be nothing in the code which would restrict it for single-threaded use. I'm not sure what you want exactly. Can you provide an example of something you want to achieve but doesn't work for you? That would help me to understand what you actually want to achieve :) |
At the command line when I use
w1thermsensor all
it is done one after the other.
or in Python with the example
from w1thermsensor import W1ThermSensor
for sensor in W1ThermSensor.get_available_sensors():
____ print("Sensor %s has temperature %.2f" % (sensor.id,
sensor.get_temperature()))
that loop waits on the the sensor to return it's value. I guess
.get_temperature() needs to be spwaned in the background module as a thread?
Though I guess if I figure out threading, I may be able to do it myself in
the loop now that I look at it. It's been a while, since I already use
threading to write files and collect data.
It was just an idea to have it 'built-in'.
…On 6 Oct 2017 16:00, "Timo Furrer" ***@***.***> wrote:
As far as I can tell, from use, you access each sensor sequencially.
That's right. The w1thermsensor module does not interact with anything
related to threading.
Would it be possible to implement threading to access them concurrently
You can certainly do that. There should be nothing in the code which would
restrict it for single-threaded use.
I'm not sure what you want exactly. Can you provide an example of
something you want to achieve but doesn't work for you? That would help me
to understand what you actually want to achieve :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALt-ZcFKeX63gHPbKWCychrdIEY1QEks5spkCNgaJpZM4PwktB>
.
|
Okay, I think I've got what you try to achieve. If you want multiple sensors to be read in parallel you can write a little wrapper around I'm going to close this issue since multi-threading is definitely not in the scope of this project. Thank you anyways 🍻 |
No problem, I guess i'll clone and try work it out myself :-) |
As far as I can tell, from use, you access each sensor sequencially.
Would it be possible to implement threading to access them concurrently, this would speed up reading taking for more than one sensor.
I assume people would want to be able to disable the use of threads for whatever reason.
I've had a search and found this that may or may not give an idea.
https://gist.github.com/RobThree/c6b9a5dc16357eeb0e011d3ed9a281b0
The text was updated successfully, but these errors were encountered: