fix negatif number

This commit is contained in:
Clement 2023-12-03 12:23:52 +01:00
parent 92493c7d8f
commit 76a2246882

View File

@ -45,13 +45,14 @@ SwitchableEncodeur* SwitchableEncodeur::getInstance() {
bool SwitchableEncodeur::update() {
bool sortie = false;
long newPosition = this->read()/4;
if(newPosition <= 0){
if(newPosition < 0){
newPosition = 0;
this->readAndReset();
}
if (newPosition != this->oldPosition || this->menu != this->oldMenu) {
this->oldMenu = this->menu;
this->oldPosition = newPosition;
if(this->oldPosition < 0){
if(this->oldPosition <= 0){
this->oldPosition = 0;
}
sortie = true;