Skip to content

Commit aec4094

Browse files
committed
1.1.1
1 parent 9eb458b commit aec4094

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## **Versatile_RotaryEncoder Library V1.1.0** for Arduino
1+
## **Versatile_RotaryEncoder Library V1.1.1** for Arduino
22
**Written by:** _Rui Seixas Monteiro_.
33

44
## Installation

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Versatile_RotaryEncoder
2-
version=1.1.0
2+
version=1.1.1
33
author=ruiseixasm, Rui Seixas Monteiro
44
maintainer=Rui Seixas Monteiro
55
sentence=A rotary encoder library that allows the callback of up to 9 different functions representing the same number of different encoder events. These different functions can be associated with events like press rotate and long press among many others.

src/Versatile_RotaryEncoder.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ bool Versatile_RotaryEncoder::ReadEncoder() {
6565
buttonBits = 0b001;
6666
else
6767
buttonBits = 0b110;
68+
last_switch = millis();
6869
}
6970
} else {
7071
// Sets last time since button was physically operated
@@ -73,10 +74,9 @@ bool Versatile_RotaryEncoder::ReadEncoder() {
7374

7475
// CASCATE
7576
switch (buttonBits) {
76-
case 0b110:
77-
buttonBits = 0b100;
78-
button = switchdown;
79-
last_switchdown = millis();
77+
case 0b111: break; // OFF cascate dead end
78+
case 0b000: // ON cascate dead end
79+
button = held;
8080
break;
8181
case 0b100:
8282
if (button == pressed && millis() - last_switchdown > (uint32_t)long_press_duration) {
@@ -86,20 +86,21 @@ bool Versatile_RotaryEncoder::ReadEncoder() {
8686
button = pressed;
8787
}
8888
break;
89-
case 0b000: // ON cascate dead end
90-
button = held;
89+
case 0b011:
90+
buttonBits = 0b111;
91+
button = released;
9192
break;
9293
case 0b001:
9394
buttonBits = 0b011;
94-
if (button == held || button == holddown) {
95+
if (button == held || button == holddown)
9596
button = holdup;
96-
} else {
97+
else
9798
button = switchup;
98-
}
9999
break;
100-
case 0b011: // OFF cascate dead end
101-
buttonBits = 0b111;
102-
button = released;
100+
case 0b110:
101+
buttonBits = 0b100;
102+
button = switchdown;
103+
last_switchdown = millis();
103104
break;
104105
}
105106

0 commit comments

Comments
 (0)