fix (master : nicsensor)修复tmp112的读数时对数位取值的问题
This commit is contained in:
parent
75658f06e8
commit
78a17a2843
@ -937,7 +937,8 @@ convert_tmp112_data(){
|
||||
dec_val=$(echo "ibase=16; $upper_hex_value" | bc)
|
||||
|
||||
binary_number=$(echo "ibase=16;obase=2;$upper_hex_value" | bc)
|
||||
last_digit=$(echo $binary_number | cut -c 16)
|
||||
bin_length=$(echo $binary_number | awk '{print length($0)}')
|
||||
last_digit=$(echo $binary_number | cut -c $bin_length)
|
||||
if [ $last_digit -eq 0 ];then
|
||||
temp=$(echo "scale=4; $dec_val / 16 * 0.0625" | bc)
|
||||
elif [ $last_digit -eq 1];then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user