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