Closed adkron closed 7 years ago
I think this makes sense. Even for buttons, I could imagine people wanting to modify the polling rate if they feel like they're missing events or manually polling if they have a game loop-style application.
Right now the polling rate can be modified by passing in poll_inteval: x
as an option to start_link
Some sensors we might want to have polling only part of the time. Like the DHT. I think the DHT is a good candidate to have polling so that events can be fired when a certain humidity is reached, like in a dehumidifier. Sometimes, for resource management or other applications we may not want a continuous polling. I propose that we allow a
poll_interval
of0
to be passed to any sensor and have that sensor only work withread
. We can even have astop
function that sets the polling interval to0
so that after the next poll it will not poll any more. There could also be astart_polling
function that takes in a newpoll_interval
and starts up the polling again.Thoughts?