igorantolic / ai-esp32-rotary-encoder

Easy implement rotary encoder to your application using microcontroler like ESP32
GNU General Public License v2.0
284 stars 70 forks source link

rotaryEncoder.setEncoderValue(maxValue); sets to 0 when circleValues set to true #80

Open grankee opened 5 months ago

grankee commented 5 months ago

rotaryEncoder.setBoundaries(0, 3, true); //minValue, maxValue, circleValues true|false (when max go to min and vice versa) if circleValues is set to true and I set value to maximum in boundires(in this case it's 3) then it sets to 0 rotaryEncoder.setEncoderValue(3); Problem does not appear if circleValues is set to false.

rotaryEncoder.setBoundaries(0, 3, true); //minValue, maxValue, circleValues true|false (when max go to min and vice versa)
rotaryEncoder.setAcceleration(0);
rotaryEncoder.setEncoderValue(_currentLEDs);
Serial.print("Cur _currentLEDs:");
Serial.println(_currentLEDs);
Serial.print("Cur encoder:");
Serial.println(rotaryEncoder.readEncoder());
Serial.println("0-3, 0acc,set LEDs");

Results in:

Cur _currentLEDs:3 Cur encoder:0

It works just fine with smaller values:

Cur _currentLEDs:0 Cur encoder:0 0-3, 0acc,set LEDs Value: 1 0-255, 25acc,set brightness //printed by another part of program Cur _currentLEDs:1 Cur encoder:1 0-3, 0acc,set LEDs Value: 2 0-255, 25acc,set brightness //printed by another part of program Cur _currentLEDs:2 Cur encoder:2 0-3, 0acc,set LEDs Value: 3 0-255, 25acc,set brightness //printed by another part of program Cur _currentLEDs:3 Cur encoder:0 0-3, 0acc,set LEDs