Skip to content

Commit

Permalink
Merge pull request #82 from bezineb5/fix-no-satellite-in-view
Browse files Browse the repository at this point in the history
Bugfix: when no satellite in view, GSV failed
  • Loading branch information
icholy committed Nov 28, 2021
2 parents e64b13d + 5e27bbf commit df350fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gsv.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newGSV(s BaseSentence) (GSV, error) {
NumberSVsInView: p.Int64(2, "number of SVs in view"),
}
for i := 0; i < 4; i++ {
if 5*i+4 > len(m.Fields) {
if 6+i*4 >= len(m.Fields) {
break
}
m.Info = append(m.Info, GSVInfo{
Expand Down
10 changes: 10 additions & 0 deletions gsv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ var gsvtests = []struct {
},
},
},
{
name: "sentence with no satellite in view",
raw: "$GBGSV,1,1,00,0*77",
msg: GSV{
TotalMessages: 1,
MessageNumber: 1,
NumberSVsInView: 0,
Info: nil,
},
},
{
name: "invalid number of svs",
raw: "$GLGSV,3,1,11.2,03,03,111,00,04,15,270,00,06,01,010,12,13,06,292,00*77",
Expand Down

0 comments on commit df350fd

Please sign in to comment.