Skip to content

Commit

Permalink
Added additional print statement to allow route debbugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Kester-Broatch committed May 3, 2023
1 parent f5bc3d1 commit df0da26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ var cli struct {
Version bool `help:"print version."`
Quiet bool `short:"q" help:"suppress info messages."`
Print bool `help:"print routed frames."`
PrintRoutes bool `help:"print routes applied for messages with targets."`
PrintErrors bool
HbDisable bool `help:"disable heartbeats."`
HbVersion string `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
Expand Down Expand Up @@ -264,7 +265,9 @@ func run() error {
if remoteNode.SystemID == targetSystem {
if remoteNode.ComponentID == targetComponent || targetComponent < 1 { // Route if compid matches or is a broadcast
if remoteNode.Channel != evt.Channel { // Prevents Loops
fmt.Println("Routing msg ", evt.Message().GetID(), " from ", evt.Channel, "--->", remoteNode.Channel)
if cli.PrintRoutes {
fmt.Println("Routing msg ", evt.Message().GetID(), " from ", evt.Channel, "--->", remoteNode.Channel)
}
node.WriteFrameTo(remoteNode.Channel, evt.Frame)
} else {
fmt.Println("Warning: channel ", remoteNode.Channel, " attempted to send to itself, discarding ")
Expand Down

0 comments on commit df0da26

Please sign in to comment.