Skip to content

Commit

Permalink
change default component ID to 191; add --hb-componentid (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Oct 5, 2023
1 parent e8983d2 commit aa7f6c6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 40 deletions.
71 changes: 32 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,50 +128,43 @@ _mavp2p_ vs _mavlink-router_
## Full command-line usage

```
usage: mavp2p [<flags>] [<endpoints>...]
Usage: mavp2p [<endpoints> ...]
mavp2p v0.0.0
Link together Mavlink endpoints.
Arguments:
[<endpoints> ...] Space-separated list of endpoints. At least one endpoint is required. Possible endpoints types are:
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
--version print version
-q, --quiet suppress info messages
--print print routed frames
--print-errors print parse errors singularly, instead of
printing only their quantity every 5 seconds
--hb-disable disable heartbeats
--hb-version=1 set mavlink version of heartbeats
--hb-systemid=125 set system id of heartbeats. it is
recommended to set a different system
id for each router in the network
--hb-period=5 set period of heartbeats
--streamreq-disable do not request streams to Ardupilot
devices, that need an explicit request
in order to emit telemetry streams.
this task is usually delegated to the
router, in order to avoid conflicts when
multiple ground stations are active
--streamreq-frequency=4 set the stream frequency to request
Args:
[<endpoints>] Space-separated list of endpoints. At least one
endpoint is required. Possible endpoints kinds are:
udps:listen_ip:port (udp, server mode)
udpc:dest_ip:port (udp, client mode)
udpb:broadcast_ip:port (udp, broadcast mode)
tcps:listen_ip:port (tcp, server mode)
tcpc:dest_ip:port (tcp, client mode)
serial:port:baudrate (serial)
udpc:dest_ip:port (udp, client mode)
udpb:broadcast_ip:port (udp, broadcast mode)
tcps:listen_ip:port (tcp, server mode)
tcpc:dest_ip:port (tcp, client mode)
serial:port:baudrate (serial)
udps:listen_ip:port (udp, server mode)
Flags:
-h, --help Show context-sensitive help.
--version print version.
-q, --quiet suppress info messages.
--print print routed frames.
--print-errors print parse errors singularly, instead of printing only their quantity every 5 seconds.
--read-timeout=10s timeout of read operations.
--write-timeout=10s timeout of write operations.
--idle-timeout=60s disconnect idle connections after a timeout.
--hb-disable disable heartbeats.
--hb-version="1" set mavlink version of heartbeats.
--hb-systemid=125 set system ID of heartbeats. it is recommended to set a different system id for each router in the network.
--hb-componentid=191 set component ID of heartbeats.
--hb-period=5 set period of heartbeats.
--streamreq-disable do not request streams to Ardupilot devices, that need an explicit request
in order to emit telemetry streams. this task is usually delegated to the router,
in order to avoid conflicts when multiple ground stations are active.
--streamreq-frequency=4 set the stream frequency to request.
```

## Standards
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ var cli struct {
HbDisable bool `help:"disable heartbeats."`
HbVersion string `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
HbSystemid int `default:"125"`
HbComponentid int `help:"set component ID of heartbeats." default:"191"`
HbPeriod int `help:"set period of heartbeats." default:"5"`
StreamreqDisable bool
StreamreqFrequency int `help:"set the stream frequency to request." default:"4"`
Expand All @@ -175,7 +176,7 @@ func newProgram(args []string) (*program, error) {
return "print parse errors singularly, instead of printing only their quantity every 5 seconds."

case "hb-systemid":
return "set system id of heartbeats. it is recommended to set a different system id for each router in the network."
return "set system ID of heartbeats. it is recommended to set a different system id for each router in the network."

Check warning on line 179 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L179

Added line #L179 was not covered by tests

case "streamreq-disable":
return "do not request streams to Ardupilot devices," +
Expand Down Expand Up @@ -237,6 +238,7 @@ func newProgram(args []string) (*program, error) {
return gomavlib.V1
}(),
OutSystemID: byte(cli.HbSystemid),
OutComponentID: byte(cli.HbComponentid),
HeartbeatDisable: cli.HbDisable,
HeartbeatPeriod: (time.Duration(cli.HbPeriod) * time.Second),
StreamRequestEnable: !cli.StreamreqDisable,
Expand Down

0 comments on commit aa7f6c6

Please sign in to comment.