volume_set now with min volume value to 16

This commit is contained in:
vincent 2020-09-30 15:45:43 +02:00
parent 87dead9920
commit 18b7a5c0f1
1 changed files with 5 additions and 3 deletions

View File

@ -16,15 +16,17 @@ fi
# Scale new volume value between 0 and 63 # Scale new volume value between 0 and 63
volume_percent=${1} volume_percent=${1}
volume_scaled=$(echo "a = ${1} * 63 / 100 + 0.5; scale = 0; a / 1" | bc -l) vol_mini=16;
volume_scaled=$(echo "a = $volume_percent * (63 - $vol_mini) / 100 + $vol_mini + 0.5; scale = 0; a / 1" | bc -l)
echo $volume_scaled
# Get current value # Get current value
current_volume=$(volume_get) current_volume=$(volume_get)
# Turn on/off audio amplifier if necessary # Turn on/off audio amplifier if necessary
if [ ${current_volume} -eq 0 -a ${volume_scaled} -ne 0 ]; then if [ ${current_volume} -eq 0 -a ${volume_percent} -ne 0 ]; then
start_audio_amp 1 start_audio_amp 1
elif [ ${current_volume} -ne 0 -a ${volume_scaled} -eq 0 ]; then elif [ ${current_volume} -ne 0 -a ${volume_percent} -eq 0 ]; then
start_audio_amp 0 start_audio_amp 0
fi fi