fix negatif number
This commit is contained in:
parent
92493c7d8f
commit
76a2246882
@ -45,13 +45,14 @@ 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){
|
if(newPosition < 0){
|
||||||
newPosition = 0;
|
newPosition = 0;
|
||||||
|
this->readAndReset();
|
||||||
}
|
}
|
||||||
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;
|
||||||
if(this->oldPosition < 0){
|
if(this->oldPosition <= 0){
|
||||||
this->oldPosition = 0;
|
this->oldPosition = 0;
|
||||||
}
|
}
|
||||||
sortie = true;
|
sortie = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user