feat: add Ground Station UART baseline

This commit is contained in:
2026-09-29 11:25:59 +02:00
commit 515c3bae69
7 changed files with 279 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package protocol
import "testing"
func TestRCFrameRoundTrip(t *testing.T) {
input := RCFrame{Sequence: 42, Timestamp: 123456}
for i := range input.Channels {
input.Channels[i] = int16(i*100 - 750)
}
got, err := DecodeRC(EncodeRC(input))
if err != nil {
t.Fatal(err)
}
if got != input {
t.Fatalf("round trip mismatch: got %#v want %#v", got, input)
}
}
func TestRCFrameRejectsBadCRC(t *testing.T) {
packet := EncodeRC(RCFrame{})
packet[Header] ^= 1
if _, err := DecodeRC(packet); err == nil {
t.Fatal("expected CRC error")
}
}