Extracted lowerVolume to seperate file
All checks were successful
Build Code / build (push) Successful in 1m12s

This commit is contained in:
2025-10-22 14:49:29 +02:00
parent bb063a4e33
commit f77318fcdb
3 changed files with 44 additions and 39 deletions

View File

@@ -125,45 +125,7 @@ void loop()
// Remote A - Significantly Lower Volume
if (debounceRead(REMOTE_A))
{
// 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++)
{
potIncrement();
}
}
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++)
{
potIncrement();
}
}
}
else
{
// This is if the user is not lowered and is aksing to be lowered
for (int i = 0; i < userVolume - 10; i++)
{
potDecrement();
}
oldUserVolume = userVolume;
userVolume -= 10;
}
lowerVolume(&userVolume, &oldUserVolume, maxVolume);
}
// Remote B - Volume Up