wobblyhead hg > arduino > Potentiometer
comparison Potentiometer.h @ 6:4e32bc18a7f7 default tip
adjusted jitter threshold, added ignore heuristic
| author | ark |
|---|---|
| date | 2017-07-03 00:24 +0200 |
| parents | ea44b28e12ab |
| children |
comparison
equal
deleted
inserted
replaced
| 5:ea44b28e12ab | 6:4e32bc18a7f7 |
|---|---|
| 40 | 40 |
| 41 /** jitter threshold. value changes smalled than the threshold will be | 41 /** jitter threshold. value changes smalled than the threshold will be |
| 42 * added to current average. value changes larger than the threshold | 42 * added to current average. value changes larger than the threshold |
| 43 * reset the average. | 43 * reset the average. |
| 44 */ | 44 */ |
| 45 const unsigned long JITTER_THRESHOLD = 3; | 45 const unsigned long JITTER_THRESHOLD = 15; |
| 46 | 46 |
| 47 /** max samples for de-jittering. | 47 /** max samples for de-jittering. |
| 48 */ | 48 */ |
| 49 const int MAX_SAMPLES = 20; | 49 const int MAX_SAMPLES = 20; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 byte pin; | 52 byte pin; |
| 53 float sum; | 53 float sum; |
| 54 float avg; | 54 float avg; |
| 55 int num; | 55 int num; |
| 56 bool ignore; | |
| 56 | 57 |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 #endif | 60 #endif |
