From d8f00d5805bb546c4fb87528ffe34c54378919d0 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Tue, 21 Nov 2023 18:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portconfig.ini | 2 +- src/MySQLAdo.cpp | 4 ++-- src/buban104.cpp | 26 +++++++++++++------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/portconfig.ini b/portconfig.ini index 1738cbf..4b76758 100644 --- a/portconfig.ini +++ b/portconfig.ini @@ -191,7 +191,7 @@ NetCommMode=TCP,Server NetPort=50104 NetCommAddr=10.142.247.14 AiNum=65500 -DiNum=256 +DiNum=0 PiNum=64 Retry=1 RetryTime=3 diff --git a/src/MySQLAdo.cpp b/src/MySQLAdo.cpp index 5102740..e131b2a 100644 --- a/src/MySQLAdo.cpp +++ b/src/MySQLAdo.cpp @@ -307,7 +307,7 @@ int GetAIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCur sCurTime->Hour = hour; sCurTime->Min = min; sCurTime->Sec = sec; - sCurTime->mSec = 0; + sCurTime->mSec = sec * 1000; } } 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->Min = min; sCurTime->Sec = sec; - sCurTime->mSec = 0; + sCurTime->mSec = sec * 1000; } } mysql_free_result(res); diff --git a/src/buban104.cpp b/src/buban104.cpp index a5f5a70..be2dba1 100644 --- a/src/buban104.cpp +++ b/src/buban104.cpp @@ -1414,7 +1414,7 @@ void Buban104SendCmdFormPollCmdBuf(int commid) if (isUdpSocketExist() == TRUE) #endif { - if (buf[4] & 0x01) + /*if (buf[4] & 0x01) { // format_s if ((buf[4] & 0x02) == 0) @@ -1436,8 +1436,8 @@ void Buban104SendCmdFormPollCmdBuf(int commid) //发送数据后应当立即将发送序号+1,而不应当在清除命令时+1 pPortParam->wSendSequence++; pPortParam->wSendSequence %= MAX_SEQUENCE; - } - + }*/ + pPortParam->bSendFormatI = TRUE; SendDataToPort(commid, (char *)&buf[2], len - 2); pPortParam->m_psBaoHu->SendCmdFlag = 1; @@ -2998,7 +2998,7 @@ void ProvBuban104FormatI(int commid, RTUMSG *rtumsg) } */ iSequenceInc = pPortParam->wSendSequence - pPortParam->wAckSequence; - if (iSequenceInc < 0) + /*if (iSequenceInc < 0) { iSequenceInc += MAX_SEQUENCE; } @@ -3012,11 +3012,11 @@ void ProvBuban104FormatI(int commid, RTUMSG *rtumsg) { pPortParam->bCloseSocket = FALSE; pPortParam->bAckRight = TRUE; - } + }*/ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// - pPortParam->wRecvSequence = ((rtumsg->MsgData[2] + (rtumsg->MsgData[3] << 8)) >> 1) + 1; - pPortParam->wRecvSequence %= MAX_SEQUENCE; + //pPortParam->wRecvSequence = ((rtumsg->MsgData[2] + (rtumsg->MsgData[3] << 8)) >> 1) + 1; + //pPortParam->wRecvSequence %= MAX_SEQUENCE; switch (rtumsg->MsgData[6]) { @@ -4705,7 +4705,7 @@ void ProvBuban104SendAIwithFloat(int commid, RTUMSG *rtumsg, int iGroupNo) commandbuf[iLenth++] = 1; // 描述类别KOD(实际值) commandbuf[iLenth++] = 7; // 数据类型 commandbuf[iLenth++] = 4; // 数据宽度 - commandbuf[iLenth++] = 4; // 数据数目 + commandbuf[iLenth++] = 0x83; // 数据数目 commandbuf[iLenth++] = sCurTime.mSec % 256; commandbuf[iLenth++] = sCurTime.mSec / 256; 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); i = iAllDataCount; } - if (i >= iAllDataCount) + /*if (i >= iAllDataCount) { commandbuf[14] = j; // 通用分类数据集数目NGD } else - commandbuf[14] = (j | 0x80); // 通用分类数据集数目NGD - + commandbuf[14] = (j | 0x80);*/ // 通用分类数据集数目NGD + commandbuf[14] = j; // 通用分类数据集数目NGD commandbuf[1] = (char)(iLenth - 2); PutPollCmdToBuf(commid, iCmdType, 0, (char *)commandbuf, iLenth); @@ -4848,14 +4848,14 @@ void ProvBuban104Send103DI(int commid, RTUMSG *rtumsg, int iGroupNo) commandbuf[11] = 254; // 功能类型FUN commandbuf[12] = 241; // 信息序号INF commandbuf[13] = 0; // 返回信息标识码RII - commandbuf[14] = 0x81; // 通用分类数据集数目NGD + commandbuf[14] = 0x01; // 通用分类数据集数目NGD iLenth = 15; commandbuf[iLenth++] = igno0; commandbuf[iLenth++] = iItemNo0; commandbuf[iLenth++] = 1; // 描述类别KOD(实际值) commandbuf[iLenth++] = 7; // 数据类型 commandbuf[iLenth++] = 4; // 数据宽度 - commandbuf[iLenth++] = 4; // 数据数目 + commandbuf[iLenth++] = 0x83; // 数据数目 commandbuf[iLenth++] = sCurTime.mSec % 256; commandbuf[iLenth++] = sCurTime.mSec / 256; commandbuf[iLenth++] = (u_char)sCurTime.Min;