From ffc1df662b559a8d9057c149fed7298a5f53d8d8 Mon Sep 17 00:00:00 2001 From: xiaowusky Date: Mon, 4 Dec 2023 15:29:26 +0800 Subject: [PATCH] =?UTF-8?q?desc:=E6=B7=B7=E5=90=88=E5=A4=8D=E6=9D=82?= =?UTF-8?q?=E6=B0=94=E4=BD=93=E7=9B=B8=E4=BA=92=E5=BD=B1=E5=93=8D=E6=A0=A1?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yinuo/safetywatcher/watcher/port/ParseHelper.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/yinuo/safetywatcher/watcher/port/ParseHelper.kt b/app/src/main/java/com/yinuo/safetywatcher/watcher/port/ParseHelper.kt index d48e4b5..37ac6bb 100644 --- a/app/src/main/java/com/yinuo/safetywatcher/watcher/port/ParseHelper.kt +++ b/app/src/main/java/com/yinuo/safetywatcher/watcher/port/ParseHelper.kt @@ -116,6 +116,7 @@ object ParseHelper { } value = correctValueByOtherGas(type, value) + LogUtils.w("receive msg 多气体矫正后 $type, 浓度 = $value $unit") //根据单位进行数值转换 val localGasUnit = getLocalGasUnit(type.desc) @@ -318,8 +319,9 @@ object ParseHelper { if (gasMap.isNotEmpty()) { gasMap.forEach { entry -> val gas = entry.value - if (gas.gasValue > 0) { - offset += gas.gasValue * getInfluenceCoefficient(type, gas.gasName) + val coefficient = getInfluenceCoefficient(type, gas.gasName) + if (gas.gasValue > 0f && coefficient != 0f) { + offset += gas.gasValue * coefficient } } }