From 422ee575d57c387412bb9cbc7806cfe15d436931 Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Sat, 11 Sep 2021 19:39:27 +0100 Subject: [PATCH] support private LTM 'a' (amps) frame --- pkg/ltmgen/ltmgen.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/ltmgen/ltmgen.go b/pkg/ltmgen/ltmgen.go index 2bf9554..4a7fb57 100644 --- a/pkg/ltmgen/ltmgen.go +++ b/pkg/ltmgen/ltmgen.go @@ -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) } @@ -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) @@ -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) }