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