diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-12-26 21:25:16 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-12-26 21:25:16 +0100 |
commit | f3ddfd65a21e56647264aba819c054fa2830995a (patch) | |
tree | 64dc1eba10a3ad16e8f127ec62106b13ba348bcb /commandline/examples | |
parent | 05b06034a8ec920e6f01632e0688d249f330aaf5 (diff) |
lm75 example: Add support for LM75BD (with 11-bit resolution)
Diffstat (limited to 'commandline/examples')
-rwxr-xr-x | commandline/examples/lm75 | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/commandline/examples/lm75 b/commandline/examples/lm75 index 2dfd956..81fd497 100755 --- a/commandline/examples/lm75 +++ b/commandline/examples/lm75 @@ -5,16 +5,11 @@ cmd=$1 arg=$2 function read_temp { - typeset buf num + typeset buf buf=($(vusb-i2cget $addr 2 $1)) - num=$buf[1] - if (( buf[2] > 127 )); then - num="${num}.5" - fi - - echo $num + printf "%.2f\n" $(( buf[1] + (buf[2] / 256.) )) } function set_temp { |