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(); int getRotation();
void updateRotation(bool ANew, bool BNew); void updateRotation(bool ANew, bool BNew);
void changeLimitsVolume(int newMinimum, int newMaximum);
}; };
#endif #endif

View file

@ -73,3 +73,13 @@ void Knob::updateRotation(bool ANew, bool BNew) {
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;
};