Made lowering button work
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -146,21 +146,44 @@ void loop()
|
||||
// Remote A - Significantly Lower Volume
|
||||
if (digitalRead(A3))
|
||||
{
|
||||
|
||||
// Check if we volume is already lowered
|
||||
if (oldUserVolume > userVolume)
|
||||
{
|
||||
|
||||
// If it is lowered - restore it
|
||||
// Check if max volume has changed since lowering
|
||||
if (oldUserVolume > maxVolume)
|
||||
{
|
||||
// If the max volume has been lowered since lowering, then set the user volume to the new max volume
|
||||
userVolume = maxVolume;
|
||||
|
||||
for (int i = 0; i < maxVolume; i++)
|
||||
{
|
||||
volumeUp();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the max volume hasn't changed then, or the old user volume is lower than the new max - restore it to where it was
|
||||
userVolume = oldUserVolume;
|
||||
|
||||
for (int i = 0; i < oldUserVolume; i++)
|
||||
{
|
||||
volumeUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is if the user is not lowered and is aksing to be lowered
|
||||
for (int i = 0; i < userVolume - 10; i++)
|
||||
{
|
||||
volumeDown();
|
||||
}
|
||||
|
||||
oldUserVolume = userVolume;
|
||||
userVolume = 15;
|
||||
userVolume -= 10;
|
||||
}
|
||||
|
||||
delay(300);
|
||||
|
||||
Reference in New Issue
Block a user