Skip to content

Commit df350fd

Browse files
authored
Merge pull request #82 from bezineb5/fix-no-satellite-in-view
Bugfix: when no satellite in view, GSV failed
2 parents e64b13d + 5e27bbf commit df350fd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

gsv.go

+1-1
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

+10
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)