Add changeLimitsVolume to Encoder Driver

This commit is contained in:
Aadi Desai 2022-03-25 15:18:26 +00:00
commit f1ff21fb94
No known key found for this signature in database
GPG key ID: CFFFE425830EF4D9
2 changed files with 12 additions and 1 deletions

View file

@ -19,6 +19,7 @@ class Knob {
int getRotation();
void updateRotation(bool ANew, bool BNew);
void changeLimitsVolume(int newMinimum, int newMaximum);
};
#endif

View file

@ -72,4 +72,14 @@ void Knob::updateRotation(bool ANew, bool BNew) {
if (rotationInternal > maximum)
rotationInternal = maximum;
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;
};