Commit 1e7c5b2d authored by Pavel Vainerman's avatar Pavel Vainerman

Merge remote-tracking branch '1.x/master'

Conflicts: conf/libuniset2.spec conf/test.xml extensions/ModbusMaster/MBExchange.cc extensions/ModbusMaster/MBExchange.h extensions/UNetUDP/UNetExchange.cc extensions/UNetUDP/UNetReceiver.cc extensions/UNetUDP/UNetReceiver.h extensions/UNetUDP/UNetSender.h extensions/lib/MTR.cc src/Communications/Modbus/ModbusTCPMaster.cc
parents 2b8c397e 26d5e356
...@@ -149,6 +149,11 @@ void MBTCPMaster::poll_thread() ...@@ -149,6 +149,11 @@ void MBTCPMaster::poll_thread()
ptTimeout.reset(); ptTimeout.reset();
} }
while( !checkProcActive() )
{
uniset_mutex_lock l(mutex_start, 3000);
}
while( checkProcActive() ) while( checkProcActive() )
{ {
try try
......
...@@ -55,7 +55,7 @@ static void print_help() ...@@ -55,7 +55,7 @@ static void print_help()
printf(" reg - register of test. Default: 0\n"); printf(" reg - register of test. Default: 0\n");
printf(" fn - function of test [0x01,0x02,0x03,0x04]. Default: 0x04\n"); printf(" fn - function of test [0x01,0x02,0x03,0x04]. Default: 0x04\n");
printf("[--min-addr] - start addres for autodetect. Default: 0\n"); printf("[--min-addr] - start addres for autodetect. Default: 0\n");
printf("[--max-addr] - end addres for autodetect. Default: 255\n"); printf("[--max-addr] - end addres for autodetect. Default: 254\n");
printf("\n"); printf("\n");
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -87,7 +87,7 @@ int main( int argc, char** argv ) ...@@ -87,7 +87,7 @@ int main( int argc, char** argv )
ModbusRTU::ModbusAddr slaveaddr = 0x00; ModbusRTU::ModbusAddr slaveaddr = 0x00;
ModbusRTU::SlaveFunctionCode fn = ModbusRTU::fnReadInputRegisters; ModbusRTU::SlaveFunctionCode fn = ModbusRTU::fnReadInputRegisters;
ModbusRTU::ModbusAddr beg = 0; ModbusRTU::ModbusAddr beg = 0;
ModbusRTU::ModbusAddr end = 255; ModbusRTU::ModbusAddr end = 254;
int tout = 20; int tout = 20;
auto dlog = make_shared<DebugStream>(); auto dlog = make_shared<DebugStream>();
//string tofile(""); //string tofile("");
......
...@@ -213,9 +213,18 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg, ...@@ -213,9 +213,18 @@ mbErrCode ModbusTCPMaster::query( ModbusAddr addr, ModbusMessage& msg,
// //
// timeout = ptTimeout.getLeft(timeout); timeout = ptTimeout.getLeft(timeout);
// в tcp ответе задержек уже не должно быть..
mbErrCode res = recv(addr, msg.func, reply, 1); //timeout); if( timeout <= 0 )
{
if( dlog->is_warn() )
dlog->warn() << "(ModbusTCPMaster::query): processing reply timeout.." << endl;
return erTimeOut; // return erHardwareError;
}
mbErrCode res = recv(addr, msg.func, reply, timeout);
if( force_disconnect ) if( force_disconnect )
{ {
......
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