Made staffBolumeDown work
All checks were successful
Generate Documentation / build (push) Successful in 21s

This commit is contained in:
2025-10-31 14:42:16 +01:00
parent 2991f58c7d
commit 5c1f331b0e
3 changed files with 12 additions and 12 deletions

View File

@@ -10,8 +10,8 @@ void staffVolumeUp(int *maxVolume);
/** /**
* @brief Used to decrease the maximum staff volume. If the max volume is set lower than what the current user volume is, then the user volume will also be lowered. * @brief Used to decrease the maximum staff volume. If the max volume is set lower than what the current user volume is, then the user volume will also be lowered.
* *
* @param maxVolume Variable used to keep track of the max volume * @param maxVolume Pointer to the variable used to keep track of the max volume
* @param userVolume Pointer to the variable used to keep track of the user volume * @param userVolume Pointer to the variable used to keep track of the user volume
* @param oldUserVolume Pointer to the variable used to keep track of the user volume when in mute or lowered * @param oldUserVolume Pointer to the variable used to keep track of the user volume when in mute or lowered
*/ */
void staffVolumeDown(int maxVolume, int *userVolume, int *oldUserVolume); void staffVolumeDown(int *maxVolume, int *userVolume, int *oldUserVolume);

View File

@@ -51,7 +51,7 @@ void loop()
// SW2 - Staff Volume Down // SW2 - Staff Volume Down
if (reader.debounceReadNC(BTN_STAFF_DWN)) if (reader.debounceReadNC(BTN_STAFF_DWN))
{ {
staffVolumeDown(maxVolume, &userVolume, &oldUserVolume); staffVolumeDown(&maxVolume, &userVolume, &oldUserVolume);
} }
// Remote D - Mute // Remote D - Mute

View File

@@ -29,30 +29,30 @@ void staffVolumeUp(int *maxVolume)
/** /**
* @brief Used to decrease the maximum staff volume. If the max volume is set lower than what the current user volume is, then the user volume will also be lowered. * @brief Used to decrease the maximum staff volume. If the max volume is set lower than what the current user volume is, then the user volume will also be lowered.
* *
* @param maxVolume Variable used to keep track of the max volume * @param maxVolume Pointer to the variable used to keep track of the max volume
* @param userVolume Pointer to the variable used to keep track of the user volume * @param userVolume Pointer to the variable used to keep track of the user volume
* @param oldUserVolume Pointer to the variable used to keep track of the user volume when in mute or lowered * @param oldUserVolume Pointer to the variable used to keep track of the user volume when in mute or lowered
*/ */
void staffVolumeDown(int maxVolume, int *userVolume, int *oldUserVolume) void staffVolumeDown(int *maxVolume, int *userVolume, int *oldUserVolume)
{ {
if (maxVolume > STAFF_STEPS) if (*maxVolume > STAFF_STEPS)
{ {
maxVolume -= STAFF_STEPS; *maxVolume -= STAFF_STEPS;
if (*userVolume > maxVolume) if (*userVolume > *maxVolume)
{ {
for (int i = 0; i < (*userVolume - maxVolume); i++) for (int i = 0; i < (*userVolume - *maxVolume); i++)
{ {
potDecrement(); potDecrement();
} }
*userVolume = maxVolume; *userVolume = *maxVolume;
*oldUserVolume = *userVolume; *oldUserVolume = *userVolume;
} }
if (*oldUserVolume > maxVolume) if (*oldUserVolume > *maxVolume)
{ {
*oldUserVolume = maxVolume; *oldUserVolume = *maxVolume;
} }
} }
} }