feat: ajout start led on led lib #5

Merged
Clement merged 4 commits from feat/correction-libLed into master 2023-10-21 22:34:22 +00:00
Showing only changes of commit 743ca41758 - Show all commits

View File

@ -1,8 +1,13 @@
#include "../include/SwitchableEncodeur.h"
IRAM_ATTR void switchEncoder() {
SwitchableEncodeur::getInstance()->addMenu();
delay(200);
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it's a bounce and ignore
if (interrupt_time - last_interrupt_time > 200){
SwitchableEncodeur::getInstance()->addMenu();
}
last_interrupt_time = interrupt_time;
}
SwitchableEncodeur* SwitchableEncodeur::instance = nullptr;
@ -43,6 +48,9 @@ bool SwitchableEncodeur::update() {
if (newPosition != this->oldPosition || this->menu != this->oldMenu) {
this->oldMenu = this->menu;
this->oldPosition = newPosition;
if(this->oldPosition < 0){
this->oldPosition = 0;
}
sortie = true;
}
return sortie;