|
|
|
@ -3792,7 +3792,14 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
int angleno = 0;
|
|
|
|
|
for(int num = 0; num < MAX_SERIAL_DEV_NUM; num++)
|
|
|
|
|
{
|
|
|
|
|
if(sensorParam[num].SensorsType == RALLY_PROTOCOL && sensorParam[num].IsNoInsta == 1)
|
|
|
|
|
if(sensorParam[num].SensorsType == RALLY_PROTOCOL)
|
|
|
|
|
{
|
|
|
|
|
if(sensorParam[num].IsNoInsta == 0)
|
|
|
|
|
{
|
|
|
|
|
iceInfo->t_sensor_data[pullno].original_tension = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,拉力传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
GetPullValue(num, &airt);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
@ -3810,51 +3817,74 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
status = 0;
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceInfo->t_sensor_data[pullno].original_tension = iceInfo->t_sensor_data[pullno].original_tension * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceInfo->t_sensor_data[pullno].original_tension = iceInfo->t_sensor_data[pullno].original_tension + sensorParam[num].offset;
|
|
|
|
|
if(iceInfo->tension == 0xff)
|
|
|
|
|
iceInfo->tension =0;
|
|
|
|
|
iceInfo->tension = iceInfo->tension + iceInfo->t_sensor_data[pullno].original_tension;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pullno++;
|
|
|
|
|
} else if(sensorParam[num].SensorsType == SLANT_PROTOCOL && sensorParam[num].IsNoInsta == 1)
|
|
|
|
|
} else if(sensorParam[num].SensorsType == SLANT_PROTOCOL)
|
|
|
|
|
{
|
|
|
|
|
GetAngleValue(num, &airt, 0);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
if(sensorParam[num].IsNoInsta == 0)
|
|
|
|
|
{
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,倾角x未接传感器",
|
|
|
|
|
sensorParam[num].devaddr, airt.AiState);
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,倾角传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
GetAngleValue(num, &airt, 0);
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,倾角x未接传感器",
|
|
|
|
|
sensorParam[num].devaddr, airt.AiState);
|
|
|
|
|
} else {
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = airt.EuValue;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,x = %f", sensorParam[num].devaddr,
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,x = %f",
|
|
|
|
|
sensorParam[num].devaddr,
|
|
|
|
|
airt.AiState, iceInfo->t_sensor_data[angleno].deflection_angle);
|
|
|
|
|
if (airt.AiState != 2 && iceInfo->t_sensor_data[angleno].deflection_angle == 0)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,倾角x未采集到数据,重新采样",
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO,
|
|
|
|
|
"地址%d,采样状态 = %d,倾角x未采集到数据,重新采样",
|
|
|
|
|
sensorParam[num].devaddr, airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else{
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = iceInfo->t_sensor_data[angleno].deflection_angle * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].deflection_angle = iceInfo->t_sensor_data[angleno].deflection_angle + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GetAngleValue(num, &airt, 1);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,倾角y未接传感器",
|
|
|
|
|
sensorParam[num].devaddr, airt.AiState);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = airt.EuValue;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,y = %f", sensorParam[num].devaddr,
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,y = %f",
|
|
|
|
|
sensorParam[num].devaddr,
|
|
|
|
|
airt.AiState, iceInfo->t_sensor_data[angleno].windage_yaw_angle);
|
|
|
|
|
if (airt.AiState != 2 && iceInfo->t_sensor_data[angleno].windage_yaw_angle == 0)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,采样状态 = %d,倾角y未采集到数据,重新采样",
|
|
|
|
|
if (airt.AiState != 2 &&
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle == 0) {
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO,
|
|
|
|
|
"地址%d,采样状态 = %d,倾角y未采集到数据,重新采样",
|
|
|
|
|
sensorParam[num].devaddr, airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
}else{
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = iceInfo->t_sensor_data[angleno].windage_yaw_angle * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceInfo->t_sensor_data[angleno].windage_yaw_angle = iceInfo->t_sensor_data[angleno].windage_yaw_angle + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
angleno++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3867,98 +3897,138 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_dataLocker);
|
|
|
|
|
for (int num = 0; num < MAX_SERIAL_DEV_NUM; num++) {
|
|
|
|
|
if (sensorParam[num].SensorsType == WIND_PROTOCOL && sensorParam[num].IsNoInsta == 0) {
|
|
|
|
|
iceTail->instantaneous_windspeed = 0xff;
|
|
|
|
|
iceTail->instantaneous_winddirection = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,风速风向传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
break;
|
|
|
|
|
} else if (sensorParam[num].SensorsType == WIND_PROTOCOL &&
|
|
|
|
|
sensorParam[num].IsNoInsta == 1) {
|
|
|
|
|
GetWindSpeedData(&airt);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceTail->instantaneous_windspeed = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风速未接传感器",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
iceTail->instantaneous_windspeed = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && iceTail->instantaneous_windspeed == 0 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
if (airt.AiState != 2 && iceTail->instantaneous_windspeed == 0 &&
|
|
|
|
|
m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风速未采集到数据,重新采样", airt.AiState);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风速未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_windspeed = iceTail->instantaneous_windspeed;
|
|
|
|
|
} else if (iceTail->instantaneous_windspeed == 0 && m_tempData.instantaneous_windspeed != 0xff)
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_windspeed = m_tempData.instantaneous_windspeed;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceTail->instantaneous_windspeed = iceTail->instantaneous_windspeed * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceTail->instantaneous_windspeed = iceTail->instantaneous_windspeed + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWindDirectionData(&airt);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceTail->instantaneous_winddirection = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风向未接传感器",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
iceTail->instantaneous_winddirection = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && iceTail->instantaneous_winddirection == 0 &&
|
|
|
|
|
m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风向未采集到数据,重新采样", airt.AiState);
|
|
|
|
|
m_tempData.instantaneous_winddirection == 0xff) {
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰风向未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
} else {
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_winddirection = iceTail->instantaneous_winddirection;
|
|
|
|
|
} else if (iceTail->instantaneous_winddirection == 0 && m_tempData.instantaneous_winddirection != 0xff)
|
|
|
|
|
{
|
|
|
|
|
iceTail->instantaneous_winddirection = m_tempData.instantaneous_winddirection;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceTail->instantaneous_winddirection = iceTail->instantaneous_winddirection * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceTail->instantaneous_winddirection = iceTail->instantaneous_winddirection + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetAirTempData(&airt);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
for (int num = 0; num < MAX_SERIAL_DEV_NUM; num++) {
|
|
|
|
|
if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && sensorParam[num].IsNoInsta == 0)
|
|
|
|
|
{
|
|
|
|
|
iceTail->air_temperature = 0xff;
|
|
|
|
|
iceTail->humidity = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,温湿度传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
break;
|
|
|
|
|
} else if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && sensorParam[num].IsNoInsta == 1) {
|
|
|
|
|
GetAirTempData(&airt);
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceTail->air_temperature = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰温度未接传感器",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
iceTail->air_temperature = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && iceTail->air_temperature == 0 &&
|
|
|
|
|
m_tempData.air_temperature == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.air_temperature == 0xff) {
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰温度未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.air_temperature == 0xff)
|
|
|
|
|
} else {
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.air_temperature == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.air_temperature = iceTail->air_temperature;
|
|
|
|
|
} else if (iceTail->air_temperature == 0 && m_tempData.air_temperature != 0xff)
|
|
|
|
|
} else if (iceTail->air_temperature == 0 &&
|
|
|
|
|
m_tempData.air_temperature != 0xff)
|
|
|
|
|
{
|
|
|
|
|
iceTail->air_temperature = m_tempData.air_temperature;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceTail->air_temperature = iceTail->air_temperature * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceTail->air_temperature = iceTail->air_temperature + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetHumidityData(&airt);
|
|
|
|
|
if(airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1) {
|
|
|
|
|
iceTail->humidity = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰湿度未接传感器",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
iceTail->humidity = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && iceTail->humidity == 0 && m_tempData.humidity == 0xff)
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState != 2 && iceTail->humidity == 0 &&
|
|
|
|
|
m_tempData.humidity == 0xff) {
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,覆冰湿度未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.humidity == 0xff)
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.humidity == 0xff) {
|
|
|
|
|
m_tempData.humidity = iceTail->humidity;
|
|
|
|
|
} else if (iceTail->humidity == 0 && m_tempData.humidity != 0xff)
|
|
|
|
|
{
|
|
|
|
|
} else if (iceTail->humidity == 0 && m_tempData.humidity != 0xff) {
|
|
|
|
|
iceTail->humidity = m_tempData.humidity;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
iceTail->humidity = iceTail->humidity * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
iceTail->humidity = iceTail->humidity + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(status)
|
|
|
|
@ -3967,7 +4037,7 @@ int CPhoneDevice::GetIceData(IDevice::ICE_INFO *iceInfo, IDevice::ICE_TAIL *iceT
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo, D_SENSOR_PARAM *sensorParam)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_windspeed = 0xff;
|
|
|
|
|
m_tempData.air_temperature = 0xff;
|
|
|
|
@ -3992,6 +4062,19 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
Data_DEF airt;
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(m_dataLocker);
|
|
|
|
|
for (int num = 0; num < MAX_SERIAL_DEV_NUM; num++)
|
|
|
|
|
{
|
|
|
|
|
if (sensorParam[num].SensorsType == WIND_PROTOCOL && sensorParam[num].IsNoInsta == 0)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_windspeed_10min = 0xff;
|
|
|
|
|
weatherInfo->extreme_windspeed = 0xff;
|
|
|
|
|
weatherInfo->standard_windspeed = 0xff;
|
|
|
|
|
weatherInfo->avg_winddirection_10min = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,风速风向传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
break;
|
|
|
|
|
} else if (sensorParam[num].SensorsType == WIND_PROTOCOL && sensorParam[num].IsNoInsta == 1)
|
|
|
|
|
{
|
|
|
|
|
GetWeatherData(&airt, 2);
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
@ -4004,13 +4087,13 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
weatherInfo->avg_windspeed_10min = airt.EuValue;
|
|
|
|
|
weatherInfo->extreme_windspeed = airt.EuValue;
|
|
|
|
|
weatherInfo->standard_windspeed = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->avg_windspeed_10min == 0 &&
|
|
|
|
|
m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->avg_windspeed_10min == 0 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象风速未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
} else {
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.instantaneous_windspeed == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.instantaneous_windspeed = weatherInfo->avg_windspeed_10min;
|
|
|
|
|
} else if (weatherInfo->avg_windspeed_10min == 0 &&
|
|
|
|
@ -4020,6 +4103,19 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
weatherInfo->extreme_windspeed = m_tempData.instantaneous_windspeed;
|
|
|
|
|
weatherInfo->standard_windspeed = m_tempData.instantaneous_windspeed;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_windspeed_10min = weatherInfo->avg_windspeed_10min * sensorParam[num].multiple;
|
|
|
|
|
weatherInfo->extreme_windspeed = weatherInfo->avg_windspeed_10min;
|
|
|
|
|
weatherInfo->standard_windspeed = weatherInfo->avg_windspeed_10min;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_windspeed_10min = weatherInfo->avg_windspeed_10min + sensorParam[num].offset;
|
|
|
|
|
weatherInfo->extreme_windspeed = weatherInfo->avg_windspeed_10min;
|
|
|
|
|
weatherInfo->standard_windspeed = weatherInfo->avg_windspeed_10min;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 3);
|
|
|
|
@ -4030,19 +4126,92 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->avg_winddirection_10min = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->avg_winddirection_10min == 0 &&
|
|
|
|
|
m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->avg_winddirection_10min == 0 && m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象风向未采集到数据,重新采样", airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if(airt.AiState == 2 && m_tempData.instantaneous_winddirection == 0xff)
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.instantaneous_winddirection == 0xff) {
|
|
|
|
|
m_tempData.instantaneous_winddirection = weatherInfo->avg_winddirection_10min;
|
|
|
|
|
}else if(weatherInfo->winddirection == 0 && m_tempData.instantaneous_winddirection != 0xff)
|
|
|
|
|
} else if (weatherInfo->winddirection == 0 && m_tempData.instantaneous_winddirection != 0xff) {
|
|
|
|
|
weatherInfo->avg_winddirection_10min = m_tempData.instantaneous_winddirection;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->avg_winddirection_10min = weatherInfo->avg_winddirection_10min * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->avg_winddirection_10min = weatherInfo->avg_winddirection_10min + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 4);
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->winddirection = m_tempData.instantaneous_winddirection;
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->precipitation = weatherInfo->precipitation * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->precipitation = weatherInfo->precipitation + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 5);
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->air_pressure = weatherInfo->air_pressure * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->air_pressure = weatherInfo->air_pressure + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 6);
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->radiation_intensity = weatherInfo->radiation_intensity * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->radiation_intensity = weatherInfo->radiation_intensity + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int num = 0; num < MAX_SERIAL_DEV_NUM; num++) {
|
|
|
|
|
if (sensorParam[num].SensorsType == WEATHER_PROTOCOL && sensorParam[num].IsNoInsta == 0)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->air_temperature = 0xff;
|
|
|
|
|
weatherInfo->humidity = 0xff;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "地址%d,温湿度传感器未启用",
|
|
|
|
|
sensorParam[num].devaddr);
|
|
|
|
|
break;
|
|
|
|
|
} else if (sensorParam[num].SensorsType == WEATHER_PROTOCOL &&
|
|
|
|
|
sensorParam[num].IsNoInsta == 1)
|
|
|
|
|
{
|
|
|
|
|
GetWeatherData(&airt, 0);
|
|
|
|
|
if (airt.AiState == 255 || airt.AiState == -1)
|
|
|
|
|
{
|
|
|
|
@ -4057,13 +4226,20 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象温度未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if (airt.AiState == 2 && m_tempData.air_temperature == 0xff)
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.air_temperature == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.air_temperature = weatherInfo->air_temperature;
|
|
|
|
|
} else if (weatherInfo->air_temperature == 0 && m_tempData.air_temperature != 0xff)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->air_temperature = m_tempData.air_temperature;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->air_temperature = weatherInfo->air_temperature * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->air_temperature = weatherInfo->air_temperature + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 1);
|
|
|
|
@ -4074,55 +4250,31 @@ int CPhoneDevice::GetWData(IDevice::WEATHER_INFO *weatherInfo)
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->humidity = airt.EuValue;
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->humidity == 0 && m_tempData.humidity == 0xff)
|
|
|
|
|
if (airt.AiState != 2 && weatherInfo->humidity == 0 &&
|
|
|
|
|
m_tempData.humidity == 0xff)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象湿度未采集到数据,重新采样", airt.AiState);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "采样状态 = %d,气象湿度未采集到数据,重新采样",
|
|
|
|
|
airt.AiState);
|
|
|
|
|
status = 0;
|
|
|
|
|
} else if(airt.AiState == 2 && m_tempData.humidity == 0xff)
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
if (airt.AiState == 2 && m_tempData.humidity == 0xff)
|
|
|
|
|
{
|
|
|
|
|
m_tempData.humidity = weatherInfo->humidity;
|
|
|
|
|
} else if (weatherInfo->humidity == 0 && m_tempData.humidity != 0xff)
|
|
|
|
|
{
|
|
|
|
|
weatherInfo->humidity = m_tempData.humidity;
|
|
|
|
|
}
|
|
|
|
|
if(sensorParam[num].multiple != 1 && sensorParam[num].multiple != 0)
|
|
|
|
|
weatherInfo->humidity = weatherInfo->humidity * sensorParam[num].multiple;
|
|
|
|
|
if(sensorParam[num].offset != 0)
|
|
|
|
|
weatherInfo->humidity = weatherInfo->humidity + sensorParam[num].offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 4);
|
|
|
|
|
weatherInfo->precipitation = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 5);
|
|
|
|
|
weatherInfo->air_pressure = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetWeatherData(&airt, 6);
|
|
|
|
|
weatherInfo->radiation_intensity = airt.EuValue;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|