diff --git a/encoder_dir.h b/encoder_dir.h index 9c664e4..bfbe725 100644 --- a/encoder_dir.h +++ b/encoder_dir.h @@ -106,6 +106,7 @@ class EncoderDir { // Return the number of ticks change since last polled. int _rotate_change() { int position = encoder_.getPosition(); + unsigned long ms = encoder_.getMillisBetweenRotations(); // Validation (TODO: add debounce check). if (previous_pos_ == position) { @@ -116,6 +117,13 @@ class EncoderDir { change = position - previous_pos_; previous_pos_ = position; + // Encoder rotate acceleration. + if (ms < 16) { + change *= 3; + } else if (ms < 32) { + change *= 2; + } + return change; }