Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ hardcoded default**.
| `--parity` | `MYTHY_PARITY` | `N` | RTU parity: `N`, `E`, or `O` |
| `--stopbits` | `MYTHY_STOPBITS` | `1` | RTU stop bits |
| `--unit-id` | `MYTHY_UNIT_ID` | `1` | Modbus unit ID |
| `--request-timeout` | `MYTHY_REQUEST_TIMEOUT` | `2s` | per-request timeout |
| `--request-timeout` | `MYTHY_REQUEST_TIMEOUT` | `10s` | per-request timeout |
| `--connect-timeout` | `MYTHY_CONNECT_TIMEOUT` | `5s` | TCP connect timeout |
| `--retries` | `MYTHY_RETRIES` | `2` | transient-error retries on reads (writes never retry) |
| `--transport` | `MYTHY_TRANSPORT` | – | force `tcp` or `rtu`; auto-detected from `--host`/`--serial` |
Expand Down
2 changes: 1 addition & 1 deletion cmd/mythy/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c *connFlags) bind(cmd *cobra.Command) {
"RTU stop bits: 1 or 2 (or set MYTHY_STOPBITS)")
f.Uint8Var(&c.unitID, "unit-id", envOrUint8("MYTHY_UNIT_ID", 1),
"Modbus unit ID (default 1; or set MYTHY_UNIT_ID)")
f.DurationVar(&c.timeout, "request-timeout", envOrDuration("MYTHY_REQUEST_TIMEOUT", 2*time.Second),
f.DurationVar(&c.timeout, "request-timeout", envOrDuration("MYTHY_REQUEST_TIMEOUT", 10*time.Second),
"per-request timeout (or set MYTHY_REQUEST_TIMEOUT)")
f.DurationVar(&c.connTimeout, "connect-timeout", envOrDuration("MYTHY_CONNECT_TIMEOUT", 5*time.Second),
"TCP connect timeout (or set MYTHY_CONNECT_TIMEOUT)")
Expand Down
2 changes: 1 addition & 1 deletion pkg/transport/rtu.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewRTUClient(opts Options) *RTUClient {
opts.StopBits = 1
}
if opts.RequestTimeout == 0 {
opts.RequestTimeout = 2 * time.Second
opts.RequestTimeout = 10 * time.Second
}
return &RTUClient{opts: opts}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/transport/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewTCPClient(opts Options) *TCPClient {
opts.Port = 502
}
if opts.RequestTimeout == 0 {
opts.RequestTimeout = 2 * time.Second
opts.RequestTimeout = 10 * time.Second
}
if opts.ConnectTimeout == 0 {
opts.ConnectTimeout = 5 * time.Second
Expand Down