From e664a5f7661fdfe0020d48da8f74299627c54706 Mon Sep 17 00:00:00 2001 From: "XI.CHEN" <2311041011@qq.com> Date: Tue, 17 Dec 2024 11:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E7=85=A7=E9=99=8D=E9=9B=A8=E9=87=8F?= =?UTF-8?q?=E7=AD=89=E6=9C=AA=E9=85=8D=E7=BD=AE=E4=BC=A0255?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index a0e234ed..74e22855 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -4049,33 +4049,40 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo) GetWeatherData(&airt, 4); weatherInfo->precipitation = airt.EuValue; -#if 0 - if (airt.AiState != 2 && weatherInfo->precipitation == 0) { + if(airt.AiState == 255 || airt.AiState == -1) + { + weatherInfo->precipitation = 0xff; + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,降雨量未接传感器", airt.AiState); + }else if (airt.AiState != 2 && weatherInfo->precipitation == 0) + { XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,降雨量未采集到数据,重新采样", weatherInfo->precipitation, airt.AiState); status = 0; } -#endif GetWeatherData(&airt, 5); weatherInfo->air_pressure = airt.EuValue; -#if 0 - if (airt.AiState != 2 && weatherInfo->air_pressure == 0) { + if(airt.AiState == 255 || airt.AiState == -1) + { + weatherInfo->air_pressure = 0xff; + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气压未接传感器", airt.AiState); + }else if (airt.AiState != 2 && weatherInfo->air_pressure == 0) { XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气压未采集到数据,重新采样", weatherInfo->air_pressure, airt.AiState); status = 0; } -#endif GetWeatherData(&airt, 6); weatherInfo->radiation_intensity = airt.EuValue; -#if 0 - if (airt.AiState != 2 && weatherInfo->radiation_intensity == 0) { + if(airt.AiState == 255 || airt.AiState == -1) + { + weatherInfo->radiation_intensity = 0xff; + XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,光照强度未接传感器", airt.AiState); + }else if (airt.AiState != 2 && weatherInfo->radiation_intensity == 0) { XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,光照强度未采集到数据,重新采样", weatherInfo->radiation_intensity, airt.AiState); status = 0; } -#endif if (status) return true; else