|
|
@ -770,7 +770,7 @@ void Gm_InitSerialComm_Test()
|
|
|
|
devparam[0].IsNoInsta = 1;
|
|
|
|
devparam[0].IsNoInsta = 1;
|
|
|
|
//devparam[0].PowerPort = 2;
|
|
|
|
//devparam[0].PowerPort = 2;
|
|
|
|
//devparam[0].devaddr = 4;
|
|
|
|
//devparam[0].devaddr = 4;
|
|
|
|
devparam[0].devaddr = 2;
|
|
|
|
devparam[0].devaddr = 10;
|
|
|
|
|
|
|
|
|
|
|
|
devparam[1].ProtocolIdx = WEATHER_PROTOCOL;
|
|
|
|
devparam[1].ProtocolIdx = WEATHER_PROTOCOL;
|
|
|
|
devparam[1].baudrate = B9600;
|
|
|
|
devparam[1].baudrate = B9600;
|
|
|
@ -781,7 +781,7 @@ void Gm_InitSerialComm_Test()
|
|
|
|
devparam[1].IsNoInsta = 1;
|
|
|
|
devparam[1].IsNoInsta = 1;
|
|
|
|
//devparam[1].PowerPort = 14;
|
|
|
|
//devparam[1].PowerPort = 14;
|
|
|
|
//devparam[1].devaddr = 1;
|
|
|
|
//devparam[1].devaddr = 1;
|
|
|
|
devparam[1].devaddr = 13;
|
|
|
|
devparam[1].devaddr = 2;
|
|
|
|
|
|
|
|
|
|
|
|
devparam[2].ProtocolIdx = RALLY_PROTOCOL;
|
|
|
|
devparam[2].ProtocolIdx = RALLY_PROTOCOL;
|
|
|
|
devparam[2].baudrate = B9600;
|
|
|
|
devparam[2].baudrate = B9600;
|
|
|
@ -1036,7 +1036,7 @@ void Gm_InitSerialComm()
|
|
|
|
if(0 == devparam[i].IsNoInsta)
|
|
|
|
if(0 == devparam[i].IsNoInsta)
|
|
|
|
sprintf(szbuf, "没有启用!;");
|
|
|
|
sprintf(szbuf, "没有启用!;");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
sprintf(szbuf, "已启用!;");
|
|
|
|
sprintf(szbuf, "已启用!;");
|
|
|
|
LOGI("%s", szbuf);
|
|
|
|
LOGI("%s", szbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1201,13 +1201,15 @@ void GM_StartSerialComm()
|
|
|
|
for(;;)
|
|
|
|
for(;;)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
usleep(10);
|
|
|
|
usleep(10);
|
|
|
|
LOGW("polltime=%ldms", get_msec()-polltime);
|
|
|
|
//LOGW("polltime=%ldms", get_msec()-polltime);
|
|
|
|
polltime = get_msec();
|
|
|
|
polltime = get_msec();
|
|
|
|
if(GM_SerialTimer() < 0)
|
|
|
|
if(GM_SerialTimer() < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//LOGE("12V state=%d", getInt(CMD_SET_12V_EN_STATE));
|
|
|
|
//LOGE("12V state=%d", getInt(CMD_SET_12V_EN_STATE));
|
|
|
|
LOGV("退出采样流程!");
|
|
|
|
LOGV("退出采样流程!");
|
|
|
|
break;
|
|
|
|
sleep(15);
|
|
|
|
|
|
|
|
GM_StartSerialComm();
|
|
|
|
|
|
|
|
//break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -1223,10 +1225,11 @@ void GM_StartSerialCameraPhoto(BYTE channel, int cmdidx)
|
|
|
|
|
|
|
|
|
|
|
|
srdt.RephotographCnt = 0;
|
|
|
|
srdt.RephotographCnt = 0;
|
|
|
|
FindDevUseSerialCommNo();
|
|
|
|
FindDevUseSerialCommNo();
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
//sprintf(szbuf, "sampling=%02X !", srdt.sampling);
|
|
|
|
//sprintf(szbuf, "sampling=%02X !", srdt.sampling);
|
|
|
|
//DebugStringPrintf(szbuf, strlen(szbuf), 1);
|
|
|
|
//DebugStringPrintf(szbuf, strlen(szbuf), 1);
|
|
|
|
if(0 == srdt.selfflag)
|
|
|
|
//if(0 == srdt.selfflag)
|
|
|
|
srdt.selfflag = 1;
|
|
|
|
// srdt.selfflag = 1;
|
|
|
|
//Gm_OpenSerialPower();
|
|
|
|
//Gm_OpenSerialPower();
|
|
|
|
//Gm_OpenSensorsPower();
|
|
|
|
//Gm_OpenSensorsPower();
|
|
|
|
//if(0x00 == srdt.sampling)
|
|
|
|
//if(0x00 == srdt.sampling)
|
|
|
@ -1240,6 +1243,7 @@ void GM_StartSerialCameraPhoto(BYTE channel, int cmdidx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(0x01 == (srdt.sampling & 0x01))
|
|
|
|
if(0x01 == (srdt.sampling & 0x01))
|
|
|
|
flag = 0;
|
|
|
|
flag = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// 初始化串口使用状态
|
|
|
|
// 初始化串口使用状态
|
|
|
|
for(i=0; i<MAX_SERIAL_DEV_NUM; i++)
|
|
|
|
for(i=0; i<MAX_SERIAL_DEV_NUM; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1291,12 +1295,12 @@ void GM_StartSerialCameraPhoto(BYTE channel, int cmdidx)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(0x01 == flag)
|
|
|
|
//if(0x01 == flag)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
sprintf(szbuf, "非数据采样期间,摄像机拍照启动串口定时器!");
|
|
|
|
sprintf(szbuf, "摄像机拍照启动串口定时器!");
|
|
|
|
LOGI("%s", szbuf);
|
|
|
|
LOGI("%s", szbuf);
|
|
|
|
//StartTimer(GM_SERIAL_START, TIMER_CNT, GM_SerialTimer);
|
|
|
|
//StartTimer(GM_SERIAL_START, TIMER_CNT, GM_SerialTimer);
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1453,9 +1457,8 @@ void GM_AllSerialComRecv(void)
|
|
|
|
memset(recvbuf, 0, sizeof(recvbuf));
|
|
|
|
memset(recvbuf, 0, sizeof(recvbuf));
|
|
|
|
if(serialport[j].fd < 0)
|
|
|
|
if(serialport[j].fd < 0)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
for(;;)
|
|
|
|
//for(;;)
|
|
|
|
{
|
|
|
|
recvlen = read(serialport[j].fd, recvbuf, sizeof(recvbuf));/* 在串口读取字符串 */
|
|
|
|
recvlen = read(serialport[j].fd, recvbuf, sizeof(recvbuf));/* 在串口读取字符串 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(recvlen < 1)
|
|
|
|
if(recvlen < 1)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1463,7 +1466,7 @@ void GM_AllSerialComRecv(void)
|
|
|
|
BytestreamLOG(buf, recvbuf, recvlen, 'I');
|
|
|
|
BytestreamLOG(buf, recvbuf, recvlen, 'I');
|
|
|
|
|
|
|
|
|
|
|
|
SerialDataProcess(srdt.curdevidx[j], recvbuf, recvlen);
|
|
|
|
SerialDataProcess(srdt.curdevidx[j], recvbuf, recvlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2425,7 +2428,6 @@ void MakeShxyProtocolPollCommand(int portno, BYTE cmdidx)
|
|
|
|
//Gm_OMC_UART_DebugHex(buf, i-2, (char*)&sendbuf[2]);
|
|
|
|
//Gm_OMC_UART_DebugHex(buf, i-2, (char*)&sendbuf[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char CalLpc(unsigned char *msg, int len)
|
|
|
|
unsigned char CalLpc(unsigned char *msg, int len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
@ -2439,18 +2441,18 @@ unsigned char CalLpc(unsigned char *msg, int len)
|
|
|
|
/***************************************************************
|
|
|
|
/***************************************************************
|
|
|
|
* 读上海欣影传感器协议数据 *
|
|
|
|
* 读上海欣影传感器协议数据 *
|
|
|
|
***************************************************************/
|
|
|
|
***************************************************************/
|
|
|
|
void ShxyProtocolRecvData(int commid, u_char *buf, int len)// 规约读数据处理
|
|
|
|
void ShxyProtocolRecvData(int devno, u_char *buf, int len)// 规约读数据处理
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i, ictime;
|
|
|
|
int i, ictime;
|
|
|
|
//WORD crc, check;
|
|
|
|
//WORD crc, check;
|
|
|
|
//SERIAL_DEV_DEF *pPortParam;
|
|
|
|
//SERIAL_DEV_DEF *pPortParam;
|
|
|
|
SIO_PARAM_SERIAL_DEF *pPortParam;
|
|
|
|
SIO_PARAM_SERIAL_DEF *pPortParam;
|
|
|
|
|
|
|
|
|
|
|
|
if((commid<0) || (commid > MAX_SERIAL_DEV_NUM))
|
|
|
|
if((devno<0) || (devno > MAX_SERIAL_DEV_NUM))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pPortParam = &serialport[devparam[commid].commid];
|
|
|
|
pPortParam = &serialport[devparam[devno].commid];
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0; i<len; i++)
|
|
|
|
for(i=0; i<len; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2499,7 +2501,7 @@ void ShxyProtocolRecvData(int commid, u_char *buf, int len)// 规约读数据处
|
|
|
|
|
|
|
|
|
|
|
|
if(CheckShxyProtocolLpcError(pPortParam->m_au8RecvBuf, pPortParam->m_iRecvLen) == TRUE)
|
|
|
|
if(CheckShxyProtocolLpcError(pPortParam->m_au8RecvBuf, pPortParam->m_iRecvLen) == TRUE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ShxyProtocolDataProcess(commid);
|
|
|
|
ShxyProtocolDataProcess(devno);
|
|
|
|
pPortParam->m_iRevStatus = 0;
|
|
|
|
pPortParam->m_iRevStatus = 0;
|
|
|
|
pPortParam->RevCmdFlag = 1;
|
|
|
|
pPortParam->RevCmdFlag = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2563,7 +2565,7 @@ int CheckShxyProtocolLpcError( u_char* msg, int len )
|
|
|
|
/*********************************************************************************
|
|
|
|
/*********************************************************************************
|
|
|
|
上海欣影传感器协议数据处理
|
|
|
|
上海欣影传感器协议数据处理
|
|
|
|
**********************************************************************************/
|
|
|
|
**********************************************************************************/
|
|
|
|
void ShxyProtocolDataProcess( int commid)
|
|
|
|
void ShxyProtocolDataProcess( int devno)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
float fvalue, fcorvalue, *fvalua, frnb/*, fwind*/;
|
|
|
|
float fvalue, fcorvalue, *fvalua, frnb/*, fwind*/;
|
|
|
|
WORD uDevAddr;
|
|
|
|
WORD uDevAddr;
|
|
|
@ -2573,13 +2575,13 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
SIO_PARAM_SERIAL_DEF *curserial;
|
|
|
|
SIO_PARAM_SERIAL_DEF *curserial;
|
|
|
|
char szbuf[64];
|
|
|
|
char szbuf[64];
|
|
|
|
|
|
|
|
|
|
|
|
pPortParam = &srdt.ms_dev[commid];
|
|
|
|
pPortParam = &srdt.ms_dev[devno];
|
|
|
|
curserial = &serialport[devparam[commid].commid];
|
|
|
|
curserial = &serialport[devparam[devno].commid];
|
|
|
|
|
|
|
|
|
|
|
|
//取出装置地址,开始处理地址+++
|
|
|
|
//取出装置地址,开始处理地址+++
|
|
|
|
if(0x02 == curserial->m_au8RecvBuf[5])
|
|
|
|
if(0x02 == curserial->m_au8RecvBuf[5])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
devparam[commid].devaddr = curserial->m_au8RecvBuf[4];
|
|
|
|
devparam[devno].devaddr = curserial->m_au8RecvBuf[4];
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2613,7 +2615,7 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
slantpntmsg[aipnt][0].AiState = 1;
|
|
|
|
slantpntmsg[aipnt][0].AiState = 1;
|
|
|
|
//if ((gDisSunRain & 0x20) == 0x20)
|
|
|
|
//if ((gDisSunRain & 0x20) == 0x20)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sprintf(szbuf, "倾角ID:%d slantangle X=%0.3f ", devparam[commid].devaddr, fvalue);
|
|
|
|
sprintf(szbuf, "倾角ID:%d slantangle X=%0.3f ", devparam[devno].devaddr, fvalue);
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//XslantSec[aipnt][srdt.SectimesamplingCnt[0]] = (short)slantpntmsg[aipnt][0].EuValue;
|
|
|
|
//XslantSec[aipnt][srdt.SectimesamplingCnt[0]] = (short)slantpntmsg[aipnt][0].EuValue;
|
|
|
@ -2676,10 +2678,15 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
if((fvalue < -40) ||(fvalue > 85))
|
|
|
|
if((fvalue < -40) ||(fvalue > 85))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[0].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[0].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[0].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pPortParam->aiValue[0].EuValue = fvalue*pPortParam->aiValue[0].AiParam.fFactor + pPortParam->aiValue[0].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[0].EuValue = fvalue*weatherpntmsg[0].AiParam.fFactor + weatherpntmsg[0].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[0].EuValue = fvalue*weatherpntmsg[0].AiParam.fFactor + weatherpntmsg[0].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[0].AiState = 1;
|
|
|
|
weatherpntmsg[0].AiState = 1;
|
|
|
|
weatherpntmsg[0].AiState = 1;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x01);
|
|
|
|
//g_SelfTest.SensorsFault |= (0x01);
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
@ -2692,10 +2699,15 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
if((fvalue < 550) ||(fvalue > 1060))
|
|
|
|
if((fvalue < 550) ||(fvalue > 1060))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/10000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/10000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[5].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[5].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[5].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pPortParam->aiValue[5].EuValue = fvalue*pPortParam->aiValue[5].AiParam.fFactor + pPortParam->aiValue[5].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[5].EuValue = fvalue*weatherpntmsg[5].AiParam.fFactor + weatherpntmsg[5].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[5].EuValue = fvalue*weatherpntmsg[5].AiParam.fFactor + weatherpntmsg[5].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[5].AiState = 1;
|
|
|
|
weatherpntmsg[5].AiState = 1;
|
|
|
|
weatherpntmsg[5].AiState = 1;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x10);
|
|
|
|
//g_SelfTest.SensorsFault |= (0x10);
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
@ -2708,10 +2720,15 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
if((fvalue < 0) ||(fvalue > 100))
|
|
|
|
if((fvalue < 0) ||(fvalue > 100))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[1].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[1].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[1].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pPortParam->aiValue[1].EuValue = fvalue*pPortParam->aiValue[1].AiParam.fFactor + pPortParam->aiValue[1].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[1].EuValue = fvalue*weatherpntmsg[1].AiParam.fFactor + weatherpntmsg[1].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[1].EuValue = fvalue*weatherpntmsg[1].AiParam.fFactor + weatherpntmsg[1].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[1].AiState = 1;
|
|
|
|
weatherpntmsg[1].AiState = 1;
|
|
|
|
weatherpntmsg[1].AiState = 1;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x02);
|
|
|
|
//g_SelfTest.SensorsFault |= (0x02);
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
|
//if ((gDisSunRain & 0x80) == 0x80)
|
|
|
@ -2728,10 +2745,15 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
if((fvalue/1000 < 0) ||(fvalue/1000 > 80))
|
|
|
|
if((fvalue/1000 < 0) ||(fvalue/1000 > 80))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[2].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[2].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[2].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pPortParam->aiValue[2].EuValue = fvalue*pPortParam->aiValue[2].AiParam.fFactor + pPortParam->aiValue[2].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[2].EuValue = fvalue*weatherpntmsg[2].AiParam.fFactor + weatherpntmsg[2].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[2].EuValue = fvalue*weatherpntmsg[2].AiParam.fFactor + weatherpntmsg[2].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[2].AiState = 1;
|
|
|
|
weatherpntmsg[2].AiState = 1;
|
|
|
|
weatherpntmsg[2].AiState = 1;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x04);
|
|
|
|
//g_SelfTest.SensorsFault |= (0x04);
|
|
|
|
//if ((gDisSunRain & 0x10) == 0x10)
|
|
|
|
//if ((gDisSunRain & 0x10) == 0x10)
|
|
|
@ -2748,10 +2770,15 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
if((fvalue/1000 < 0) ||(fvalue/1000 > 359.99))
|
|
|
|
if((fvalue/1000 < 0) ||(fvalue/1000 > 359.99))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%41-20)/1000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[3].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[3].EuValue *= (1+frnb);
|
|
|
|
weatherpntmsg[3].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pPortParam->aiValue[3].EuValue = fvalue*pPortParam->aiValue[3].AiParam.fFactor + pPortParam->aiValue[3].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[3].EuValue = fvalue*weatherpntmsg[3].AiParam.fFactor + weatherpntmsg[3].AiParam.EuValueDelta;
|
|
|
|
weatherpntmsg[3].EuValue = fvalue*weatherpntmsg[3].AiParam.fFactor + weatherpntmsg[3].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[3].AiState = 1;
|
|
|
|
weatherpntmsg[3].AiState = 1;
|
|
|
|
weatherpntmsg[3].AiState = 1;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x08);
|
|
|
|
//g_SelfTest.SensorsFault |= (0x08);
|
|
|
|
//if ((gDisSunRain & 0x10) == 0x10)
|
|
|
|
//if ((gDisSunRain & 0x10) == 0x10)
|
|
|
@ -2777,56 +2804,58 @@ void ShxyProtocolDataProcess( int commid)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
pPortParam->recvdatacnt++;
|
|
|
|
pPortParam->recvdatacnt++;
|
|
|
|
if(pPortParam->recvdatacnt < 2)
|
|
|
|
if(pPortParam->recvdatacnt < 2)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
//g_SelfTest.SensorsFault |= (0x040<<aipnt);
|
|
|
|
|
|
|
|
//if(fvalue/1000.0 < rallypntmsg[aipnt][1].AiParam.EuValueDelta)
|
|
|
|
pPortParam->aiValue[0].EuValue = fvalue*pPortParam->aiValue[0].AiParam.fFactor\
|
|
|
|
// rallypntmsg[aipnt][0].EuValue = 0;
|
|
|
|
+pPortParam->aiValue[0].AiParam.EuValueDelta;
|
|
|
|
//else
|
|
|
|
//rallypntmsg[aipnt][0].EuValue = fvalue*rallypntmsg[aipnt][0].AiParam.fFactor\
|
|
|
|
rallypntmsg[aipnt][0].EuValue = fvalue*rallypntmsg[aipnt][0].AiParam.fFactor\
|
|
|
|
// +rallypntmsg[aipnt][0].AiParam.EuValueDelta;
|
|
|
|
+rallypntmsg[aipnt][0].AiParam.EuValueDelta;
|
|
|
|
pPortParam->aiValue[0].AiState = 1;
|
|
|
|
rallypntmsg[aipnt][0].AiState = 1;
|
|
|
|
//rallypntmsg[aipnt][0].AiState = 1;
|
|
|
|
//if ((gDisSunRain & 0x10) == 0x10)
|
|
|
|
sprintf(szbuf, "地址%d拉力:%0.3fKg ", devparam[devno].devaddr, fvalue);
|
|
|
|
{
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
sprintf(szbuf, "地址%d拉力:%0.3fKg ", devparam[commid].devaddr, fvalue);
|
|
|
|
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// yizhonghu 20110629
|
|
|
|
|
|
|
|
//rallyd[aipnt][srdt.SectimesamplingCnt[2]] = (short)slantpntmsg[aipnt][0].EuValue;
|
|
|
|
|
|
|
|
srdt.SectimesamplingCnt[2] += 1;
|
|
|
|
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 9: /*倾角传感器X轴倾角*/
|
|
|
|
case 9: /*倾角传感器X轴倾角*/
|
|
|
|
if((fvalue < -59) ||(fvalue > 59))
|
|
|
|
if((fvalue < -59) ||(fvalue > 59))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
slantpntmsg[aipnt][0].EuValue *= (1+frnb);
|
|
|
|
pPortParam->aiValue[0].EuValue *= (1+frnb);
|
|
|
|
|
|
|
|
//slantpntmsg[aipnt][0].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
slantpntmsg[aipnt][0].EuValue = fvalue*slantpntmsg[aipnt][0].AiParam.fFactor\
|
|
|
|
|
|
|
|
+slantpntmsg[aipnt][0].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
slantpntmsg[aipnt][0].AiState = 1;
|
|
|
|
|
|
|
|
//if ((gDisSunRain & 0x20) == 0x20)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sprintf(szbuf, "倾角ID:%d slantangle X=%0.3f ", devparam[commid].devaddr, fvalue);
|
|
|
|
pPortParam->aiValue[0].EuValue = fvalue*pPortParam->aiValue[0].AiParam.fFactor\
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
+pPortParam->aiValue[0].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
//slantpntmsg[aipnt][0].EuValue = fvalue*slantpntmsg[aipnt][0].AiParam.fFactor\
|
|
|
|
|
|
|
|
//+slantpntmsg[aipnt][0].AiParam.EuValueDelta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[0].AiState = 1;
|
|
|
|
|
|
|
|
//slantpntmsg[aipnt][0].AiState = 1;
|
|
|
|
|
|
|
|
sprintf(szbuf, "倾角ID:%d slantangle X=%0.3f ", devparam[devno].devaddr, fvalue);
|
|
|
|
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 10: /*倾角传感器Y轴倾角*/
|
|
|
|
case 10: /*倾角传感器Y轴倾角*/
|
|
|
|
{
|
|
|
|
|
|
|
|
sprintf(szbuf, "Y =%0.3f ", fvalue);
|
|
|
|
sprintf(szbuf, "Y =%0.3f ", fvalue);
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
LOGV("%s", szbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((fvalue < -59) ||(fvalue > 59))
|
|
|
|
if((fvalue < -59) ||(fvalue > 59))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
frnb = (GeneratingRandomNumber()%101-50)/1000.0;
|
|
|
|
|
|
|
|
pPortParam->aiValue[1].EuValue *= (1+frnb);
|
|
|
|
slantpntmsg[aipnt][1].EuValue *= (1+frnb);
|
|
|
|
slantpntmsg[aipnt][1].EuValue *= (1+frnb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
slantpntmsg[aipnt][1].EuValue = fvalue*slantpntmsg[aipnt][1].AiParam.fFactor\
|
|
|
|
{
|
|
|
|
+slantpntmsg[aipnt][1].AiParam.EuValueDelta;
|
|
|
|
pPortParam->aiValue[1].EuValue = fvalue*pPortParam->aiValue[1].AiParam.fFactor\
|
|
|
|
slantpntmsg[aipnt][1].AiState = 1;
|
|
|
|
+pPortParam->aiValue[1].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
//slantpntmsg[aipnt][1].EuValue = fvalue*slantpntmsg[aipnt][1].AiParam.fFactor\
|
|
|
|
|
|
|
|
// +slantpntmsg[aipnt][1].AiParam.EuValueDelta;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pPortParam->aiValue[1].AiState = 1;
|
|
|
|
|
|
|
|
//slantpntmsg[aipnt][1].AiState = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
case 11: /*测温球导线温度*/
|
|
|
|
case 11: /*测温球导线温度*/
|
|
|
|