修复bug

main
BlueMatthew 2 years ago
parent b7138f89a5
commit d8f00d5805

@ -191,7 +191,7 @@ NetCommMode=TCP,Server
NetPort=50104 NetPort=50104
NetCommAddr=10.142.247.14 NetCommAddr=10.142.247.14
AiNum=65500 AiNum=65500
DiNum=256 DiNum=0
PiNum=64 PiNum=64
Retry=1 Retry=1
RetryTime=3 RetryTime=3

@ -307,7 +307,7 @@ int GetAIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCur
sCurTime->Hour = hour; sCurTime->Hour = hour;
sCurTime->Min = min; sCurTime->Min = min;
sCurTime->Sec = sec; sCurTime->Sec = sec;
sCurTime->mSec = 0; sCurTime->mSec = sec * 1000;
} }
} }
mysql_free_result(res); mysql_free_result(res);
@ -403,7 +403,7 @@ int GetDIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCur
sCurTime->Hour = hour; sCurTime->Hour = hour;
sCurTime->Min = min; sCurTime->Min = min;
sCurTime->Sec = sec; sCurTime->Sec = sec;
sCurTime->mSec = 0; sCurTime->mSec = sec * 1000;
} }
} }
mysql_free_result(res); mysql_free_result(res);

@ -1414,7 +1414,7 @@ void Buban104SendCmdFormPollCmdBuf(int commid)
if (isUdpSocketExist() == TRUE) if (isUdpSocketExist() == TRUE)
#endif #endif
{ {
if (buf[4] & 0x01) /*if (buf[4] & 0x01)
{ {
// format_s // format_s
if ((buf[4] & 0x02) == 0) if ((buf[4] & 0x02) == 0)
@ -1436,8 +1436,8 @@ void Buban104SendCmdFormPollCmdBuf(int commid)
//发送数据后应当立即将发送序号1而不应当在清除命令时1 //发送数据后应当立即将发送序号1而不应当在清除命令时1
pPortParam->wSendSequence++; pPortParam->wSendSequence++;
pPortParam->wSendSequence %= MAX_SEQUENCE; pPortParam->wSendSequence %= MAX_SEQUENCE;
} }*/
pPortParam->bSendFormatI = TRUE;
SendDataToPort(commid, (char *)&buf[2], len - 2); SendDataToPort(commid, (char *)&buf[2], len - 2);
pPortParam->m_psBaoHu->SendCmdFlag = 1; pPortParam->m_psBaoHu->SendCmdFlag = 1;
@ -2998,7 +2998,7 @@ void ProvBuban104FormatI(int commid, RTUMSG *rtumsg)
} }
*/ */
iSequenceInc = pPortParam->wSendSequence - pPortParam->wAckSequence; iSequenceInc = pPortParam->wSendSequence - pPortParam->wAckSequence;
if (iSequenceInc < 0) /*if (iSequenceInc < 0)
{ {
iSequenceInc += MAX_SEQUENCE; iSequenceInc += MAX_SEQUENCE;
} }
@ -3012,11 +3012,11 @@ void ProvBuban104FormatI(int commid, RTUMSG *rtumsg)
{ {
pPortParam->bCloseSocket = FALSE; pPortParam->bCloseSocket = FALSE;
pPortParam->bAckRight = TRUE; pPortParam->bAckRight = TRUE;
} }*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
pPortParam->wRecvSequence = ((rtumsg->MsgData[2] + (rtumsg->MsgData[3] << 8)) >> 1) + 1; //pPortParam->wRecvSequence = ((rtumsg->MsgData[2] + (rtumsg->MsgData[3] << 8)) >> 1) + 1;
pPortParam->wRecvSequence %= MAX_SEQUENCE; //pPortParam->wRecvSequence %= MAX_SEQUENCE;
switch (rtumsg->MsgData[6]) switch (rtumsg->MsgData[6])
{ {
@ -4705,7 +4705,7 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
commandbuf[iLenth++] = 1; // 描述类别KOD实际值 commandbuf[iLenth++] = 1; // 描述类别KOD实际值
commandbuf[iLenth++] = 7; // 数据类型 commandbuf[iLenth++] = 7; // 数据类型
commandbuf[iLenth++] = 4; // 数据宽度 commandbuf[iLenth++] = 4; // 数据宽度
commandbuf[iLenth++] = 4; // 数据数目 commandbuf[iLenth++] = 0x83; // 数据数目
commandbuf[iLenth++] = sCurTime.mSec % 256; commandbuf[iLenth++] = sCurTime.mSec % 256;
commandbuf[iLenth++] = sCurTime.mSec / 256; commandbuf[iLenth++] = sCurTime.mSec / 256;
commandbuf[iLenth++] = (u_char)sCurTime.Min; commandbuf[iLenth++] = (u_char)sCurTime.Min;
@ -4731,13 +4731,13 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo)
printf("get total %d item!\n", i); printf("get total %d item!\n", i);
i = iAllDataCount; i = iAllDataCount;
} }
if (i >= iAllDataCount) /*if (i >= iAllDataCount)
{ {
commandbuf[14] = j; // 通用分类数据集数目NGD commandbuf[14] = j; // 通用分类数据集数目NGD
} }
else else
commandbuf[14] = (j | 0x80); // 通用分类数据集数目NGD commandbuf[14] = (j | 0x80);*/ // 通用分类数据集数目NGD
commandbuf[14] = j; // 通用分类数据集数目NGD
commandbuf[1] = (char)(iLenth - 2); commandbuf[1] = (char)(iLenth - 2);
PutPollCmdToBuf(commid, iCmdType, 0, (char *)commandbuf, iLenth); PutPollCmdToBuf(commid, iCmdType, 0, (char *)commandbuf, iLenth);
@ -4848,14 +4848,14 @@ void ProvBuban104Send103DI(int commid, RTUMSG *rtumsg, int iGroupNo)
commandbuf[11] = 254; // 功能类型FUN commandbuf[11] = 254; // 功能类型FUN
commandbuf[12] = 241; // 信息序号INF commandbuf[12] = 241; // 信息序号INF
commandbuf[13] = 0; // 返回信息标识码RII commandbuf[13] = 0; // 返回信息标识码RII
commandbuf[14] = 0x81; // 通用分类数据集数目NGD commandbuf[14] = 0x01; // 通用分类数据集数目NGD
iLenth = 15; iLenth = 15;
commandbuf[iLenth++] = igno0; commandbuf[iLenth++] = igno0;
commandbuf[iLenth++] = iItemNo0; commandbuf[iLenth++] = iItemNo0;
commandbuf[iLenth++] = 1; // 描述类别KOD实际值 commandbuf[iLenth++] = 1; // 描述类别KOD实际值
commandbuf[iLenth++] = 7; // 数据类型 commandbuf[iLenth++] = 7; // 数据类型
commandbuf[iLenth++] = 4; // 数据宽度 commandbuf[iLenth++] = 4; // 数据宽度
commandbuf[iLenth++] = 4; // 数据数目 commandbuf[iLenth++] = 0x83; // 数据数目
commandbuf[iLenth++] = sCurTime.mSec % 256; commandbuf[iLenth++] = sCurTime.mSec % 256;
commandbuf[iLenth++] = sCurTime.mSec / 256; commandbuf[iLenth++] = sCurTime.mSec / 256;
commandbuf[iLenth++] = (u_char)sCurTime.Min; commandbuf[iLenth++] = (u_char)sCurTime.Min;

Loading…
Cancel
Save