# HG changeset patch # User ark # Date 1485381714 -3600 # Node ID c74204ea535c613fbb7c9b626cb43a26607c5d06 # Parent 4c32c9d4b94fbc5139b8d16fb24a6ef42a4577d4 added isStopped diff -r 4c32c9d4b94f -r c74204ea535c .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Jan 25 23:01:54 2017 +0100 @@ -0,0 +1,1 @@ +.DS_Store diff -r 4c32c9d4b94f -r c74204ea535c Potentiometer.cpp --- a/Potentiometer.cpp Mon Jan 23 01:50:42 2017 +0100 +++ b/Potentiometer.cpp Wed Jan 25 23:01:54 2017 +0100 @@ -24,6 +24,7 @@ if(this->num == Potentiometer::MAX_SAMPLES) { this->sum -= this->avg; this->num--; + this->isStopped = true; } this->sum += v; this->num++; @@ -36,6 +37,7 @@ this->sum = v; this->avg = v; this->num = 1; + this->isStopped = false; } #ifdef DEBUG Serial.print("pin="); @@ -46,6 +48,8 @@ Serial.print(num); Serial.print(", avg="); Serial.println(avg); + Serial.print(", isStopped="); + Serial.println(this->isStopped); #endif } diff -r 4c32c9d4b94f -r c74204ea535c Potentiometer.h --- a/Potentiometer.h Mon Jan 23 01:50:42 2017 +0100 +++ b/Potentiometer.h Wed Jan 25 23:01:54 2017 +0100 @@ -11,6 +11,9 @@ public: // dejittered pot value int value; + + // flag, if true the pot is not moving + bool isStopped; /** create an uninitialised Potentiometer. @@ -19,7 +22,7 @@ Potentiometer(); /** - setup pod instance. + setup pot instance. @param {byte} pin input pin */ void setup(byte pin);