Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
4e700a91
Commit
4e700a91
authored
Sep 04, 2018
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mbrtutest): added 'polltime' option
eterbug #13154
parent
277625c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
mbrtutester.cc
Utilities/MBTester/mbrtutester.cc
+11
-4
No files found.
Utilities/MBTester/mbrtutester.cc
View file @
4e700a91
...
...
@@ -34,6 +34,7 @@ static struct option longopts[] =
{
"speed"
,
required_argument
,
0
,
's'
},
{
"use485F"
,
no_argument
,
0
,
'y'
},
{
"num-cycles"
,
required_argument
,
0
,
'l'
},
{
"polltime"
,
required_argument
,
0
,
'p'
},
{
NULL
,
0
,
0
,
0
}
};
// --------------------------------------------------------------------------
...
...
@@ -67,6 +68,7 @@ static void print_help()
printf
(
"[-a|--myaddr] addr - Modbus address for master. Default: 0x01.
\n
"
);
printf
(
"[-s|--speed] speed - 9600,14400,19200,38400,57600,115200. Default: 38400.
\n
"
);
printf
(
"[-t|--timeout] msec - Timeout. Default: 2000.
\n
"
);
printf
(
"[-p|--polltime] msec - Polling time. Default: 200 msec.
\n
"
);
printf
(
"[-l|--num-cycles] num - Number of cycles of exchange. Default: -1 - infinitely.
\n
"
);
printf
(
"[-v|--verbose] - Print all messages to stdout
\n
"
);
}
...
...
@@ -119,6 +121,7 @@ int main( int argc, char** argv )
string
tofile
(
""
);
int
use485
=
0
;
int
ncycles
=
-
1
;
int
polltime
=
200
;
ModbusRTU
::
ModbusByte
devID
=
0
;
ModbusRTU
::
ModbusByte
objID
=
0
;
...
...
@@ -126,7 +129,7 @@ int main( int argc, char** argv )
{
while
(
1
)
{
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:e:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:e:
p:
"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
break
;
...
...
@@ -274,6 +277,10 @@ int main( int argc, char** argv )
tout
=
uni_atoi
(
optarg
);
break
;
case
'p'
:
polltime
=
uni_atoi
(
optarg
);
break
;
case
'a'
:
myaddr
=
ModbusRTU
::
str2mbAddr
(
optarg
);
break
;
...
...
@@ -298,7 +305,7 @@ int main( int argc, char** argv )
}
}
break
;
#if 0
case 'g':
{
if( cmd == cmdNOP )
...
...
@@ -318,7 +325,7 @@ int main( int argc, char** argv )
}
}
break;
#endif
case
'v'
:
verb
=
1
;
break
;
...
...
@@ -739,7 +746,7 @@ int main( int argc, char** argv )
break
;
}
msleep
(
200
);
msleep
(
polltime
);
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment