It is ignoring floating values
Opened this issue · 3 comments
w35l3y commented
HassOSArgonOneAddon/argonOneLinear/run.sh
Lines 141 to 157 in 64e912c
In my case, I tried:
tmini = 0
tmaxi = 60
CorF = C
cpuRawTemp = 56900
Line | Variable | Formula | Actual | Expected |
---|---|---|---|---|
141 | value_a | 100/(tmaxi-tmini) | 1 | 1.667 |
142 | value_b | -value_a*tmini | 0 | 0 |
146 | cpuTemp | cpuRawTemp/1000 | 56 | 56.900 |
154 | value | cpuTemp | 56 | 56.900 |
157 | fanPercent | value_a*value+value_b | 56 | 94.852 |
adamoutler commented
We will need to multiply the values by 100, perform the operations then divide by 100. I don't have time to do this now.
adamoutler commented
@mxr can you handle this? It's related to the way bash handles fp. It's truncated at the point.
mxr commented
I don't use this addon anymore (no longer using this hardware). Not sure if bc
is available but you could also try something like
value_a=$(bc <<< "scale=3; 100 / ($tmaxi - $tmini)")
value_b=$(bc <<< "scale=3; -$value_a*$tmini")