fix encodeur update

This commit is contained in:
Clement 2023-11-17 21:40:02 +01:00
parent d4396b4e2a
commit 213456b6ab

View File

@ -45,6 +45,9 @@ 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 <= 0){
newPosition = 0;
}
if (newPosition != this->oldPosition || this->menu != this->oldMenu) { if (newPosition != this->oldPosition || this->menu != this->oldMenu) {
this->oldMenu = this->menu; this->oldMenu = this->menu;
this->oldPosition = newPosition; this->oldPosition = newPosition;
@ -62,4 +65,5 @@ int SwitchableEncodeur::getValue() {
void SwitchableEncodeur::resetValue() { void SwitchableEncodeur::resetValue() {
this->oldPosition = 0; this->oldPosition = 0;
this->readAndReset();
} }