mirror of
https://github.com/supleed2/ELEC60013-ES-CW2.git
synced 2024-12-22 21:55:50 +00:00
Add changeLimitsVolume to Encoder Driver
This commit is contained in:
commit
f1ff21fb94
|
@ -19,6 +19,7 @@ class Knob {
|
||||||
int getRotation();
|
int getRotation();
|
||||||
|
|
||||||
void updateRotation(bool ANew, bool BNew);
|
void updateRotation(bool ANew, bool BNew);
|
||||||
|
void changeLimitsVolume(int newMinimum, int newMaximum);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -72,4 +72,14 @@ void Knob::updateRotation(bool ANew, bool BNew) {
|
||||||
if (rotationInternal > maximum)
|
if (rotationInternal > maximum)
|
||||||
rotationInternal = maximum;
|
rotationInternal = maximum;
|
||||||
rotation = rotationInternal;
|
rotation = rotationInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Knob::changeLimitsVolume(int newMinimum, int newMaximum) {
|
||||||
|
if(newMaximum>maximum){
|
||||||
|
rotation = rotation<<1;
|
||||||
|
}else if(newMaximum<maximum){
|
||||||
|
rotation = rotation>>1;
|
||||||
|
}else{}
|
||||||
|
minimum = newMinimum;
|
||||||
|
maximum = newMaximum;
|
||||||
|
};
|
Loading…
Reference in a new issue