a
Dependents: wheelchaircontrol wheelchaircontrol2 wheelchaircontrol3 wheelchaircontrol4 ... more
Diff: QEI.cpp
- Revision:
- 2:2a173fdae3ca
- Parent:
- 1:f57640259245
- Child:
- 3:0035b165ecc4
diff -r f57640259245 -r 2a173fdae3ca QEI.cpp --- a/QEI.cpp Wed Jul 25 22:51:54 2018 +0000 +++ b/QEI.cpp Fri Aug 03 20:28:47 2018 +0000 @@ -277,14 +277,16 @@ float QEI::getRevolutions(){ if (encoding_ == X2_ENCODING) - return (float) ((float)pulses_ /(pulsesPerRev_)); + { + return (float)pulses_ / pulsesPerRev_; + } else - return (float) (pulses_ / 4 * pulsesPerRev_); + return (float)pulses_ / (4 * pulsesPerRev_); } -float QEI::getDistance(float radius) +float QEI::getDistance(float diameter) { - return getRevolutions()*radius*3.1415926*2; + return getRevolutions()*diameter*3.1415926; } void QEI::index(void) {