fixed min max value

This commit is contained in:
mrbesen 2020-06-24 00:54:57 +02:00
parent 32e0b3ec4d
commit 64fd020216
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 2 additions and 2 deletions

View File

@ -5,11 +5,11 @@ load=$(cut -d" " -f1 /proc/loadavg)
gpu=$(nvidia-smi -q -d Utilization -i 0 | head -n 11 | tail -n 1 | cut -d" " -f35)
#calculate speed, avg load, r, g, b
pout=($(python3 -c "p=($load/16); print(int((p)*4)+1, int(p), int(p*255), int((1-p)*255))"))
pout=($(python3 -c "p=min(max(($load/16), 0), 1); print(int((p)*4)+1, int(p), int(p*255), int((1-p)*255))"))
speed=${pout[0]}
#gpu color
gp=($(python3 -c "p=($gpu/100); print(int(p*255), int((1-p)*255))"))
gp=($(python3 -c "p=min(max(($gpu/100), 0), 1); print(int(p*255), int((1-p)*255))"))
#setgpu color
gpucolor="${gp[0]},${gp[1]},0"