diff --git a/app/src/main/cpp/SensorsProtocol.cpp b/app/src/main/cpp/SensorsProtocol.cpp index 767d371d..e321e78e 100644 --- a/app/src/main/cpp/SensorsProtocol.cpp +++ b/app/src/main/cpp/SensorsProtocol.cpp @@ -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))