气象数据打印错误

rtmpsuck
jxjajs 6 months ago
parent a6134b860d
commit ef1a061fad

@ -692,7 +692,7 @@ void Gm_OpenSerialPort(int devidx)
fd = ::open(devparam[devidx].pathname, O_RDWR | O_NDELAY);
if (fd < 0)
{
sprintf(szbuf, "装置%d 打开串口%d %s失败fd=%d", devidx+1, devparam[devidx].pathname, devparam[devidx].commid+1, fd);
sprintf(szbuf, "装置%d 打开串口%d %s失败fd=%d", devidx+1, devparam[devidx].commid+1, devparam[devidx].pathname, fd);
DebugLog(devparam[devidx].commid, szbuf, 'E');
return;
}
@ -3094,7 +3094,7 @@ void ShxyProtocolDataProcess(int devno)
//if ((gDisSunRain & 0x80) == 0x80)
{
sprintf(szbuf, "%s气压:%0.3f ", szbuf, fvalue);
DebugLog(devparam[devno].commid, szbuf, 'V');
//DebugLog(devparam[devno].commid, szbuf, 'V');
}
break;
case 3: /*湿度*/
@ -3115,12 +3115,52 @@ void ShxyProtocolDataProcess(int devno)
//if ((gDisSunRain & 0x80) == 0x80)
{
sprintf(szbuf, "%s湿度:%0.3f ", szbuf, fvalue);
DebugLog(devparam[devno].commid, szbuf, 'V');
if(datanum < 6)
DebugLog(devparam[devno].commid, szbuf, 'V');
}
break;
case 4: /*雨量*/
if ((fvalue < 0) || (fvalue > 10000))
{
frnb = (GeneratingRandomNumber() % 41 - 20) / 1000.0;
pPortParam->aiValue[RainfallNo].EuValue *= (1 + frnb);
weatherpntmsg[RainfallNo].EuValue *= (1 + frnb);
}
else
{
pPortParam->aiValue[RainfallNo].EuValue = fvalue;/*pPortParam->aiValue[1].AiParam.fFactor + pPortParam->aiValue[1].AiParam.EuValueDelta;*/
weatherpntmsg[RainfallNo].EuValue = fvalue;/*weatherpntmsg[HumidityNo].AiParam.fFactor + weatherpntmsg[HumidityNo].AiParam.EuValueDelta;*/
}
pPortParam->aiValue[RainfallNo].AiState = SER_SAMPLE;
weatherpntmsg[RainfallNo].AiState = SER_SAMPLE;
//g_SelfTest.SensorsFault |= (0x02);
//if ((gDisSunRain & 0x80) == 0x80)
{
sprintf(szbuf, "%s雨量:%0.3f ", szbuf, fvalue);
if(datanum < 7)
DebugLog(devparam[devno].commid, szbuf, 'V');
}
break;
case 5: /*日照*/
if ((fvalue < 0) || (fvalue > 10000))
{
frnb = (GeneratingRandomNumber() % 41 - 20) / 1000.0;
pPortParam->aiValue[OpticalRadiationNo].EuValue *= (1 + frnb);
weatherpntmsg[OpticalRadiationNo].EuValue *= (1 + frnb);
}
else
{
pPortParam->aiValue[OpticalRadiationNo].EuValue = fvalue;/*pPortParam->aiValue[1].AiParam.fFactor + pPortParam->aiValue[1].AiParam.EuValueDelta;*/
weatherpntmsg[OpticalRadiationNo].EuValue = fvalue;/*weatherpntmsg[HumidityNo].AiParam.fFactor + weatherpntmsg[HumidityNo].AiParam.EuValueDelta;*/
}
pPortParam->aiValue[OpticalRadiationNo].AiState = SER_SAMPLE;
weatherpntmsg[OpticalRadiationNo].AiState = SER_SAMPLE;
//g_SelfTest.SensorsFault |= (0x02);
//if ((gDisSunRain & 0x80) == 0x80)
{
sprintf(szbuf, "%s日照:%0.3f ", szbuf, fvalue);
DebugLog(devparam[devno].commid, szbuf, 'V');
}
break;
case 6: /*风速*/
if ((fvalue < 0) || (fvalue > 80))

Loading…
Cancel
Save