This commit is contained in:
zhouhuang 2025-01-13 10:13:48 +08:00
parent 5a4928b4d2
commit 1b455c7e3b
3 changed files with 8 additions and 1 deletions

View File

@ -743,6 +743,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
pData = GetUnitYCParamByPoint(uid, n); pData = GetUnitYCParamByPoint(uid, n);
if (pData[4] == 1) continue; if (pData[4] == 1) continue;
registerAddr = MAKEWORD(pData[0], pData[1]); registerAddr = MAKEWORD(pData[0], pData[1]);
if (registerAddr <= 0) continue;
if (registerAddr < DATA_BLOCK_BOUNDARY) if (registerAddr < DATA_BLOCK_BOUNDARY)
{ {
if (!m_adsDatas[0].inuse) m_adsDatas[0].inuse = TRUE; if (!m_adsDatas[0].inuse) m_adsDatas[0].inuse = TRUE;
@ -770,6 +771,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
pData = GetUnitYMParamByPoint(uid, n); pData = GetUnitYMParamByPoint(uid, n);
if (pData[4] == 1) continue; if (pData[4] == 1) continue;
registerAddr = MAKEWORD(pData[0], pData[1]); registerAddr = MAKEWORD(pData[0], pData[1]);
if (registerAddr <= 0) continue;
if (registerAddr < DATA_BLOCK_BOUNDARY) if (registerAddr < DATA_BLOCK_BOUNDARY)
{ {
if (!m_adsDatas[0].inuse) m_adsDatas[0].inuse = TRUE; if (!m_adsDatas[0].inuse) m_adsDatas[0].inuse = TRUE;
@ -797,6 +799,7 @@ BOOLEAN CHostADSBFProcess::calc(void)
pData = GetUnitYXParamByPoint(uid, n); pData = GetUnitYXParamByPoint(uid, n);
if (pData[4] == 1) continue; if (pData[4] == 1) continue;
registerAddr = MAKEWORD(pData[0], pData[1]); registerAddr = MAKEWORD(pData[0], pData[1]);
if (registerAddr <= 0) continue;
value_type = pData[2]; value_type = pData[2];
if (registerAddr < DATA_BLOCK_BOUNDARY) if (registerAddr < DATA_BLOCK_BOUNDARY)
{ {
@ -1028,6 +1031,7 @@ BOOLEAN CHostADSBFProcess::readFileID()
myAdsVariable myPathInfoInvalid {*m_turbine, ".gwPathInfoInvalid"}; myAdsVariable myPathInfoInvalid {*m_turbine, ".gwPathInfoInvalid"};
if (!myPathInfoInvalid.Read(2, &wPathInfoInvalid)) if (!myPathInfoInvalid.Read(2, &wPathInfoInvalid))
{ {
vLog(LOG_ERROR, "Read .gwPathInfoInvalid error.\n");
m_bRouteAdded = FALSE; m_bRouteAdded = FALSE;
delete m_turbine; delete m_turbine;
m_turbine = NULL; m_turbine = NULL;

View File

@ -33,7 +33,9 @@ struct myAdsVariable {
{ {
if (!m_Route.IsConnected()) return FALSE; if (!m_Route.IsConnected()) return FALSE;
uint32_t bytesRead = 0; uint32_t bytesRead = 0;
//if (*m_Handle.get() == 0) return FALSE; if (*m_Handle.get() == 0xffffffff) {
return FALSE;
}
auto error = m_Route.ReadReqEx2(m_IndexGroup, auto error = m_Route.ReadReqEx2(m_IndexGroup,
*m_Handle, *m_Handle,
size, size,

View File

@ -123,6 +123,7 @@ AdsHandle AdsDevice::GetHandle(const std::string& symbolName) const
if (error || (sizeof(handle) != bytesRead)) { if (error || (sizeof(handle) != bytesRead)) {
LOG_ERROR("AdsDevice GetSymbolHandle is failed: " << symbolName << "."); LOG_ERROR("AdsDevice GetSymbolHandle is failed: " << symbolName << ".");
//throw AdsException(error); //throw AdsException(error);
return {new uint32_t {0xffffffff}, {[](uint32_t){ return 0; }}};
} }
else else
{ {