fix encodeur lib
This commit is contained in:
parent
f5e79c6405
commit
aa2cb1fb4c
@ -13,6 +13,7 @@ SwitchableEncodeur::SwitchableEncodeur(uint8_t pin1, uint8_t pin2, uint8_t pinSW
|
|||||||
pinMode(pinSW, INPUT_PULLUP);
|
pinMode(pinSW, INPUT_PULLUP);
|
||||||
attachInterrupt(digitalPinToInterrupt(pinSW), switchEncoder, RISING);//FIXME: maybe change to FALLING
|
attachInterrupt(digitalPinToInterrupt(pinSW), switchEncoder, RISING);//FIXME: maybe change to FALLING
|
||||||
this->oldPosition = -999;
|
this->oldPosition = -999;
|
||||||
|
this->oldMenu = -999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +39,8 @@ SwitchableEncodeur* SwitchableEncodeur::getInstance() {
|
|||||||
bool SwitchableEncodeur::update() {
|
bool SwitchableEncodeur::update() {
|
||||||
bool sortie = false;
|
bool sortie = false;
|
||||||
long newPosition = this->read()/4;
|
long newPosition = this->read()/4;
|
||||||
if (newPosition != this->oldPosition) {
|
if (newPosition != this->oldPosition || this->menu != this->oldMenu) {
|
||||||
|
this->oldMenu = this->menu;
|
||||||
this->oldPosition = newPosition;
|
this->oldPosition = newPosition;
|
||||||
sortie = true;
|
sortie = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user