Commit c1b4f4bc authored by Pavel Vainerman's avatar Pavel Vainerman

fixed bug: stand debugging

parent bb0b29c8
...@@ -133,6 +133,10 @@ ...@@ -133,6 +133,10 @@
<item name="IO_Test2_S" textname="io test" node="" iotype="DI" priority="Medium" io="1"/> <item name="IO_Test2_S" textname="io test" node="" iotype="DI" priority="Medium" io="1"/>
<item name="IO_Test3_S" textname="io test" node="" iotype="AO" priority="Medium" io="1"/> <item name="IO_Test3_S" textname="io test" node="" iotype="AO" priority="Medium" io="1"/>
<item name="IO_Test4_S" textname="io test" node="" iotype="AI" priority="Medium" io="1"/> <item name="IO_Test4_S" textname="io test" node="" iotype="AI" priority="Medium" io="1"/>
<item name="W_Test2_S" textname="io test" node="" iotype="DI" priority="Medium" mbtype="rtu" mbaddr="0x02" mbfunc="0x03" mbreg="0x3001" rs="wago" />
<item name="W_Test3_S" textname="io test" node="" iotype="DI" priority="Medium" mbtype="rtu" mbaddr="0x02" mbfunc="0x03" mbreg="0x3002" rs="wago" />
<item name="W_Test4_S" textname="io test" node="" iotype="AI" priority="Medium" mbtype="rtu" mbaddr="0x02" mbfunc="0x06" mbreg="0x3008" rs="wago" default="4"/>
<item name="Input6_S" textname=" 6" node="" iotype="DI" priority="Medium"> <item name="Input6_S" textname=" 6" node="" iotype="DI" priority="Medium">
<depends> <depends>
......
...@@ -253,7 +253,7 @@ void RTUExchange::poll() ...@@ -253,7 +253,7 @@ void RTUExchange::poll()
if( dlog.debugging(Debug::INFO) ) if( dlog.debugging(Debug::INFO) )
{ {
dlog[Debug::INFO] << myname << "(pollRTU): poll RTU188 " dlog[Debug::INFO] << myname << "(pollRTU188): poll RTU188 "
<< " mbaddr=" << ModbusRTU::addr2str(d->mbaddr) << " mbaddr=" << ModbusRTU::addr2str(d->mbaddr)
<< endl; << endl;
} }
...@@ -336,6 +336,8 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -336,6 +336,8 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
ModbusRTU::ReadInputRetMessage ret = mb->read04(dev->mbaddr,p->mbreg,p->q_count); ModbusRTU::ReadInputRetMessage ret = mb->read04(dev->mbaddr,p->mbreg,p->q_count);
for( int i=0; i<p->q_count; i++,it++ ) for( int i=0; i<p->q_count; i++,it++ )
it->second->mbval = ret.data[i]; it->second->mbval = ret.data[i];
it--;
} }
break; break;
...@@ -344,6 +346,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -344,6 +346,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
ModbusRTU::ReadOutputRetMessage ret = mb->read03(dev->mbaddr, p->mbreg,p->q_count); ModbusRTU::ReadOutputRetMessage ret = mb->read03(dev->mbaddr, p->mbreg,p->q_count);
for( int i=0; i<p->q_count; i++,it++ ) for( int i=0; i<p->q_count; i++,it++ )
it->second->mbval = ret.data[i]; it->second->mbval = ret.data[i];
it--;
} }
break; break;
...@@ -352,6 +355,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -352,6 +355,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
ModbusRTU::ReadInputStatusRetMessage ret = mb->read02(dev->mbaddr, p->mbreg,p->q_count); ModbusRTU::ReadInputStatusRetMessage ret = mb->read02(dev->mbaddr, p->mbreg,p->q_count);
for( int i=0; i<p->q_count; i++,it++ ) for( int i=0; i<p->q_count; i++,it++ )
it->second->mbval = ret.data[i]; it->second->mbval = ret.data[i];
it--;
} }
break; break;
...@@ -360,6 +364,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -360,6 +364,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
ModbusRTU::ReadCoilRetMessage ret = mb->read01(dev->mbaddr,p->mbreg,p->q_count); ModbusRTU::ReadCoilRetMessage ret = mb->read01(dev->mbaddr,p->mbreg,p->q_count);
for( int i=0; i<p->q_count; i++,it++ ) for( int i=0; i<p->q_count; i++,it++ )
it->second->mbval = ret.data[i]; it->second->mbval = ret.data[i];
it--;
} }
break; break;
...@@ -372,7 +377,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -372,7 +377,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
} }
else else
ModbusRTU::WriteSingleOutputRetMessage ret = mb->write06(dev->mbaddr,p->mbreg,p->q_count); ModbusRTU::WriteSingleOutputRetMessage ret = mb->write06(dev->mbaddr,p->mbreg,p->mbval);
} }
break; break;
...@@ -381,6 +386,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it ) ...@@ -381,6 +386,7 @@ void RTUExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
ModbusRTU::WriteOutputMessage msg(dev->mbaddr,p->mbreg); ModbusRTU::WriteOutputMessage msg(dev->mbaddr,p->mbreg);
for( int i=0; i<p->q_count; i++,it++ ) for( int i=0; i<p->q_count; i++,it++ )
msg.addData(it->second->mbval); msg.addData(it->second->mbval);
it--;
ModbusRTU::WriteOutputRetMessage ret = mb->write10(msg); ModbusRTU::WriteOutputRetMessage ret = mb->write10(msg);
} }
break; break;
...@@ -1472,6 +1478,8 @@ void RTUExchange::rtuQueryOptimization( RTUDeviceMap& m ) ...@@ -1472,6 +1478,8 @@ void RTUExchange::rtuQueryOptimization( RTUDeviceMap& m )
if( (it->second->mbreg - reg) > 1 ) if( (it->second->mbreg - reg) > 1 )
break; break;
if( beg->second->mbfunc != it->second->mbfunc )
break;
beg->second->q_count++; beg->second->q_count++;
reg = it->second->mbreg; reg = it->second->mbreg;
......
#!/bin/sh #!/bin/sh
uniset-start.sh -f ./uniset-rtuexchange --rs-name RTUExchange --confile test.xml \ uniset-start.sh -f ./uniset-rtuexchange --rs-name RTUExchange --confile test.xml \
--rs-filter-field rs --rs-filter-value 1 \ --rs-filter-field rs --rs-filter-value wago \
--rs-dev /dev/cbsideA0 \ --rs-dev /dev/ttyUSB0 \
--dlog-add-levels info,crit,warn --dlog-add-levels info,crit,warn
#,level3 #,level3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment