feat: led-lib #3

Merged
Clement merged 5 commits from add--led-lib into master 2023-10-20 18:51:55 +00:00
Showing only changes of commit aa2cb1fb4c - Show all commits

View File

@ -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;
}