Skip to content

Commit

Permalink
Fix BWC no position handling. Send delta with nextPoint.position valu…
Browse files Browse the repository at this point in the history
…e = null
  • Loading branch information
panaaj committed Nov 14, 2024
1 parent 1ea0c73 commit 818c8b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hooks/BWC.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ module.exports = function BWCHook(input) {
latitude,
},
})
} else {
values.push({
path: 'navigation.courseGreatCircle.nextPoint.position',
value: null,
})
}

if (parts[9] !== '' && parts[10] !== '') {
Expand Down
12 changes: 11 additions & 1 deletion test/BWC.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ describe('BWC', () => {

delta.should.be.an('object')
delta.updates[0].values.should.deep.equal([
{
path: 'navigation.courseGreatCircle.nextPoint.position',
value: null,
},
{
path: 'navigation.courseGreatCircle.nextPoint.distance',
value: 40929.20003454424,
Expand All @@ -80,6 +84,12 @@ describe('BWC', () => {

it("Doesn't choke on an empty sentence", () => {
const delta = new Parser().parse('$GPBWC,,,,,,,,,,,,*41')
should.equal(delta, undefined)

delta.updates[0].values.should.deep.equal([
{
path: 'navigation.courseGreatCircle.nextPoint.position',
value: null,
},
])
})
})

0 comments on commit 818c8b2

Please sign in to comment.