From c3958f3752e0fe43a66f8ba5bafff47b2a52b1cf Mon Sep 17 00:00:00 2001 From: snickersun Date: Mon, 28 Dec 2020 21:18:10 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E6=B8=A9=E5=BA=A6=E6=A3=80?= =?utf8?q?=E6=B5=8B=E9=80=BB=E8=BE=91=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=97=A0?= =?utf8?q?=E7=94=A8=E6=A3=80=E6=B5=8B=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../enqualcomm/support/utils/TempAlgUtil.java | 8 +++ .../support/utils/TemperatureUtil.java | 60 +++++++++---------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/com/enqualcomm/support/utils/TempAlgUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TempAlgUtil.java index 95b60312..e72eed01 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TempAlgUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TempAlgUtil.java @@ -13,13 +13,21 @@ public class TempAlgUtil { private static double tempOut_value = 0.0f; public static double get_tempOut_value_origin() { + long tmp=System.currentTimeMillis(); tempOut_value = ICJniUtils.getTemperatureOrigin(); + long tmp1=System.currentTimeMillis()-tmp; + if (tmp1>1000) + ICLogger.i("测量环境温度 原始值 " + tempOut_value+" 超过1秒 "+tmp1); ICLogger.i( "测量环境温度 原始值 " + tempOut_value); return tempOut_value; } public static double get_temp_value_adjusted() { + long tmp=System.currentTimeMillis(); temp_value_orig = ICJniUtils.getTemperature(); + long tmp1=System.currentTimeMillis()-tmp; + if (tmp1>1000) + ICLogger.i("测量体温 原始值 " + temp_value_orig+" 超过1秒 "+tmp1); ICLogger.i("测量体温 原始值 " + temp_value_orig); return temp_value_orig; } diff --git a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java index 891dcdef..5fec64df 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java @@ -23,17 +23,26 @@ public class TemperatureUtil { private static double tempOut_value = 0.0f; public static double get_tempOut_value_origin() { + long tmp=System.currentTimeMillis(); tempOut_value = ICJniUtils.getTemperatureOrigin(); - ICLogger.i("测量环境温度 原始值 " + tempOut_value); + long tmp1=System.currentTimeMillis()-tmp; + if (tmp1>1000) + ICLogger.i("1测量环境温度 原始值 " + tempOut_value+" 超过1秒 "+tmp1); + ICLogger.i( "1测量环境温度 原始值 " + tempOut_value); return tempOut_value; } public static double get_temp_value_adjusted() { + long tmp=System.currentTimeMillis(); temp_value_orig = ICJniUtils.getTemperature(); - ICLogger.i("测量体温 原始值 " + temp_value_orig); + long tmp1=System.currentTimeMillis()-tmp; + if (tmp1>1000) + ICLogger.i("1测量体温 原始值 " + temp_value_orig+" 超过1秒 "+tmp1); + ICLogger.i("1测量体温 原始值 " + temp_value_orig); return temp_value_orig; } + public static double getTempAdjustValue() { // temp_adjust_value=ICJniUtils.getTemperatureAdjustValue(); @@ -51,13 +60,12 @@ public class TemperatureUtil { public static void doTempTestInThread() { - new Handler().postDelayed(new Runnable() { + ThreadPool.newInstance().submitThreadPool(new Runnable() { @Override public void run() { - DoTempTest(); } - }, 500); + }); } public static final String ACTION_TEMP_RESULT = "com.ic.action.temp_result"; @@ -100,14 +108,9 @@ public class TemperatureUtil { double wrist_temp, body_temp, temout; temout = 0.0f; + wrist_temp=0.0f; + body_temp=0.0f; while (true) { - wrist_temp = TemperatureUtil.get_temp_value_adjusted(); - if (wrist_temp < 10) { - Util.mSleep(1000); - ICLogger.i("retry read temp for <10"); - wrist_temp = TemperatureUtil.get_temp_value_adjusted(); - } - if (ICJniUtils.isTemperatureDevAvailable() == ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_IC68.ordinal()) { //此处温度会走一个算法,跟主板挂钩,不同的主板有不同的公式,需要做实验,配置。 //具体可以点击进去看里面的代码。 @@ -123,29 +126,20 @@ public class TemperatureUtil { } else { body_temp = TemperatureUtil.getBodyTemp(wrist_temp, 26.0f); } - } else { - ICLogger.log(TAG, "temperatureItem is null..."); - if (Config.disableWristTemp) { - body_temp = wrist_temp; - } else { - temout = TemperatureUtil.get_tempOut_value_origin(); - if (temout < 10) { - Util.mSleep(1000); - ICLogger.i("retry read tempOut for <10"); - temout = TemperatureUtil.get_tempOut_value_origin(); - } - if (temout > 60 || temout < 10) { - temout = 0.0f; - } - if (temout > 10) { - body_temp = TemperatureUtil.getBodyTemp(wrist_temp, temout); - } else { - body_temp = TemperatureUtil.getBodyTemp(wrist_temp, 26.0f); - } - } } } else { - body_temp = TemperatureUtil.getBodyTemp(wrist_temp, 26.0f); + wrist_temp = TemperatureUtil.get_temp_value_adjusted(); + if (wrist_temp < 10) { + Util.mSleep(1000); + ICLogger.i("retry read temp for <10"); + wrist_temp = TemperatureUtil.get_temp_value_adjusted(); + } + ICLogger.log(TAG, "temperatureItem is null..."); + if (Config.disableWristTemp) { + body_temp = wrist_temp; + } else { + body_temp = TemperatureUtil.getBodyTemp(wrist_temp, 26.0f); + } } try { Thread.sleep(1000); -- 2.17.1