Skip to content

Commit

Permalink
fix roll/pitch scaling in fl2mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag committed Jan 28, 2021
1 parent e00aa8f commit 82f98d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/bltmqtt/bltmqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ func NewMQTTClient() *MQTTClient {
log.Fatal(err)
}

topic = u.Path[1:]
port, _ = strconv.Atoi(u.Port())
broker = u.Hostname()
port, _ = strconv.Atoi(u.Port())

if len(u.Path) > 0 {
topic = u.Path[1:]
}

up := u.User
user = up.Username()
Expand Down Expand Up @@ -147,11 +150,11 @@ func make_bullet_msg(b types.LogItem, homeamsl float64, elapsed int, ncells int)
sb.WriteByte(',')

sb.WriteString("ran:")
sb.WriteString(strconv.Itoa(int(b.Roll) * 10))
sb.WriteString(strconv.Itoa(int(b.Roll)))
sb.WriteByte(',')

sb.WriteString("pan:")
sb.WriteString(strconv.Itoa(int(b.Pitch) * 10))
sb.WriteString(strconv.Itoa(int(b.Pitch)))
sb.WriteByte(',')

sb.WriteString("hea:")
Expand Down

0 comments on commit 82f98d2

Please sign in to comment.