dcs-bios / dcs-bios-arduino-library

Arduino Library to talk to DCS-BIOS
MIT License
61 stars 29 forks source link

Potentiometer "Jitter" #9

Closed OlHall closed 7 years ago

OlHall commented 9 years ago

Would it be possible/correct to provide a mechanism to allow a pot object to be defined with a "jitter" band. As it is, pots seem to generate a LOT of clutter on the output stream.

i.e. Add an optional parameter to the constructor for a "jitter band" value In the PollingInput method, test the new value against the previous value and ONLY if it falls outside the jitter band i.e. ( value < ( lastState - jitter )) || ( value > ( lastState + jitter )) /* need to test for under/overflow when applying +/- jitter */

If true, send the update message, and set the new "lastState". In the current code, you always set the value of lastState even if it was the same as the previous read?

jboecker commented 9 years ago

Yes, this definitely needs some work. Pull requests are welcome.

jboecker commented 7 years ago

fixed in v0.2.10 release