From 5c1f331b0ec6517018063de9630cb14379067f9b Mon Sep 17 00:00:00 2001 From: Lyubomir Penev Date: Fri, 31 Oct 2025 14:42:16 +0100 Subject: [PATCH] Made staffBolumeDown work --- include/staffFunctions.h | 4 ++-- src/main.cpp | 2 +- src/staffFunctions.cpp | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/staffFunctions.h b/include/staffFunctions.h index 6bdf2a2..0fce6ea 100644 --- a/include/staffFunctions.h +++ b/include/staffFunctions.h @@ -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. * - * @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 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); \ No newline at end of file +void staffVolumeDown(int *maxVolume, int *userVolume, int *oldUserVolume); \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 4fe31bb..38ba34b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,7 +51,7 @@ void loop() // SW2 - Staff Volume Down if (reader.debounceReadNC(BTN_STAFF_DWN)) { - staffVolumeDown(maxVolume, &userVolume, &oldUserVolume); + staffVolumeDown(&maxVolume, &userVolume, &oldUserVolume); } // Remote D - Mute diff --git a/src/staffFunctions.cpp b/src/staffFunctions.cpp index ad28b9b..7982f77 100644 --- a/src/staffFunctions.cpp +++ b/src/staffFunctions.cpp @@ -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. * - * @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 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(); } - *userVolume = maxVolume; + *userVolume = *maxVolume; *oldUserVolume = *userVolume; } - if (*oldUserVolume > maxVolume) + if (*oldUserVolume > *maxVolume) { - *oldUserVolume = maxVolume; + *oldUserVolume = *maxVolume; } } } \ No newline at end of file