prairiedogbeer / fermenator

Fermentation monitoring and management software
0 stars 0 forks source link

Support minimum off time with duty cycle #3

Closed geradcoles closed 7 years ago

geradcoles commented 7 years ago

This PR fixes #2, adding support for a minimum_off_time argument to all Relay objects, which works alongside duty_cycle. Additionally, duty_cycle was implemented homogeneously across all relay objects, greatly simplifying the code in the descendants of Relay. Relays are always turned on in a background thread, which waits for minimum_off_time seconds after the last time the relay was shut off before the thread will actually turn on a relay, either statically or in a duty cycle. Python threading.Event object waiters are used so that the entire thing is easily interrupted at any time.