Skip to content

Commit

Permalink
support private LTM 'a' (amps) frame
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag committed Sep 11, 2021
1 parent 76f9f73 commit 422ee57
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/ltmgen/ltmgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func newLTM(mtype byte) *ltmbuf {
paylen = 1
case 'q':
paylen = 2
case 'a':
paylen = 2
default:
log.Fatalf("LTM: No payload defined for type '%c'\n", mtype)
}
Expand Down Expand Up @@ -72,6 +74,11 @@ func (l *ltmbuf) aframe(b types.LogItem) {
l.checksum()
}

func (l *ltmbuf) paframe(b types.LogItem) {
binary.LittleEndian.PutUint16(l.msg[3:5], uint16(b.Amps*100))
l.checksum()
}

func (l *ltmbuf) gframe(b types.LogItem) {
lat := int32(b.Lat * 1.0e7)
lon := int32(b.Lon * 1.0e7)
Expand Down Expand Up @@ -330,6 +337,9 @@ func LTMGen(seg types.LogSegment, meta types.FlightMeta) {
l = newLTM('S')
l.sframe(b)
s.Write(l.msg)
l = newLTM('a') // provate current
l.paframe(b)
s.Write(l.msg)
g2t = b.Utc.Add(g2diff)
}

Expand Down

0 comments on commit 422ee57

Please sign in to comment.