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
|
// Remote A - Significantly Lower Volume
|
||||||
if (digitalRead(A3))
|
if (digitalRead(A3))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Check if we volume is already lowered
|
||||||
if (oldUserVolume > userVolume)
|
if (oldUserVolume > userVolume)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// If it is lowered - restore it
|
||||||
|
// Check if max volume has changed since lowering
|
||||||
if (oldUserVolume > maxVolume)
|
if (oldUserVolume > maxVolume)
|
||||||
{
|
{
|
||||||
|
// If the max volume has been lowered since lowering, then set the user volume to the new max volume
|
||||||
userVolume = maxVolume;
|
userVolume = maxVolume;
|
||||||
|
|
||||||
|
for (int i = 0; i < maxVolume; i++)
|
||||||
|
{
|
||||||
|
volumeUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
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;
|
userVolume = oldUserVolume;
|
||||||
|
|
||||||
|
for (int i = 0; i < oldUserVolume; i++)
|
||||||
|
{
|
||||||
|
volumeUp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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;
|
oldUserVolume = userVolume;
|
||||||
userVolume = 15;
|
userVolume -= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(300);
|
delay(300);
|
||||||
|
|||||||
Reference in New Issue
Block a user