From b17104dc2f660a473738a4e1313a85c09e309556 Mon Sep 17 00:00:00 2001 From: leimingsheng Date: Thu, 26 Jun 2025 14:35:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(master=20:=20nicsensor)=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=83=A8=E5=88=86=E4=BC=A0=E6=84=9F=E5=99=A8=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E7=9A=84=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nicsensor.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nicsensor.sh b/nicsensor.sh index b9df545..c3faf5c 100755 --- a/nicsensor.sh +++ b/nicsensor.sh @@ -709,7 +709,8 @@ convert_emc1413_data(){ # print result to consol format_temp=$(echo "$temp" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - echo "$3 : $format_temp C, hex value : $hex_value1 $hex_value2" + format_log_print $INFO "$3 - Hex data : $hex_value1 $hex_value2" + echo "$3 : $format_temp C" } @@ -797,7 +798,8 @@ convert_adc128_data(){ volt=$(echo "scale=4; $dec_val / 16 / 4096 * 2.65 / $4" | bc) format_volt=$(echo "$volt" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - echo "$3 : $format_volt v, hex value: $upper_hex_value" + format_log_print $INFO "$3 - Hex data: $upper_hex_value" + echo "$3 : $format_volt V" } # Get the sensor data, then parse raw data @@ -881,7 +883,8 @@ convert_ina3221_data(){ if [ $4 -eq $INA3221_BUS_VOLT ];then volt=$(echo "scale=4; $dec_val / 8 * 40 / 10000 * 2" | bc) format_volt=$(echo "$volt" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - echo "$6 : $format_volt V, hex value: $upper_hex_value" + format_log_print $INFO "Channel $3 - bus volt - hex value: $upper_hex_value" + echo "$6 : $format_volt V" if [ $3 -eq 0 ];then ina3221_ch0_volt=$format_volt @@ -897,8 +900,8 @@ convert_ina3221_data(){ format_current=$(echo "$current" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') format_current_mv=$(echo "$current_mv" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - - echo "$6 : $format_current A, shunt volt: $format_current_mv mV, shunt resistor: $5 mOhm, hex value: $upper_hex_value" + format_log_print $INFO "Channel $3 - shunt volt - hex value: $upper_hex_value" + echo "$6 : $format_current A, shunt volt: $format_current_mv mV, shunt resistor: $5 mOhm" if [ $3 -eq 0 ];then ina3221_ch0_current=$format_current