feat: V1 fonctionnel OK (#8)
Reviewed-on: #8 Co-authored-by: Clement <c.boesmier@aptatio.com> Co-committed-by: Clement <c.boesmier@aptatio.com>
This commit is contained in:
@ -39,6 +39,13 @@ public:
|
||||
*/
|
||||
int getValue();
|
||||
|
||||
/**
|
||||
* @brief set the encodeur value
|
||||
*
|
||||
* @param val the new encodeur value
|
||||
*/
|
||||
void setValue(int val);
|
||||
|
||||
/**
|
||||
* @brief update the encodeur value
|
||||
*
|
||||
|
@ -45,10 +45,14 @@ SwitchableEncodeur* SwitchableEncodeur::getInstance() {
|
||||
bool SwitchableEncodeur::update() {
|
||||
bool sortie = false;
|
||||
long newPosition = this->read()/4;
|
||||
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;
|
||||
@ -62,4 +66,9 @@ int SwitchableEncodeur::getValue() {
|
||||
|
||||
void SwitchableEncodeur::resetValue() {
|
||||
this->oldPosition = 0;
|
||||
this->readAndReset();
|
||||
}
|
||||
|
||||
void SwitchableEncodeur::setValue(int val){
|
||||
this->write(val*4);
|
||||
}
|
||||
|
Reference in New Issue
Block a user