Skip to content

Commit 5e27bbf

Browse files
author
Benjamin
committed
Bugfix: when no satellite in view, GSV failed
1 parent e64b13d commit 5e27bbf

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

gsv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func newGSV(s BaseSentence) (GSV, error) {
3434
NumberSVsInView: p.Int64(2, "number of SVs in view"),
3535
}
3636
for i := 0; i < 4; i++ {
37-
if 5*i+4 > len(m.Fields) {
37+
if 6+i*4 >= len(m.Fields) {
3838
break
3939
}
4040
m.Info = append(m.Info, GSVInfo{

gsv_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ var gsvtests = []struct {
4141
},
4242
},
4343
},
44+
{
45+
name: "sentence with no satellite in view",
46+
raw: "$GBGSV,1,1,00,0*77",
47+
msg: GSV{
48+
TotalMessages: 1,
49+
MessageNumber: 1,
50+
NumberSVsInView: 0,
51+
Info: nil,
52+
},
53+
},
4454
{
4555
name: "invalid number of svs",
4656
raw: "$GLGSV,3,1,11.2,03,03,111,00,04,15,270,00,06,01,010,12,13,06,292,00*77",

0 commit comments

Comments
 (0)