Skip to content

Commit aab929d

Browse files
committed
Tread Heading events with undefined Reference as True
Source is a yacht with a Cetrek 340 Chartnav, a 730 Pilot, and a 930580 Magnetic compass, feeding into Cetrek 2900 instruments.
1 parent e8e2239 commit aab929d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

pgns/127250.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ module.exports = [
1414
node: 'navigation.headingTrue',
1515
filter: function (n2k) {
1616
return (
17-
n2k.fields['Reference'] === 'True' &&
18-
typeof n2k.fields['Heading'] !== 'undefined'
17+
typeof n2k.fields['Heading'] !== 'undefined' && (
18+
n2k.fields['Reference'] === 'True' ||
19+
typeof n2k.fields['Reference'] === 'undefined'
20+
)
1921
)
2022
}
2123
},

test/127250_heading.js

+13
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,17 @@ describe('127250 Heading', function () {
5252
)
5353
// tree.should.be.validSignalKVesselIgnoringIdentity
5454
})
55+
56+
it('Cetrek sentence converts', function () {
57+
var tree = require('./testMapper').toNested(
58+
JSON.parse(
59+
'{"canId":233902663,"prio":3,"src":71,"dst":255,"pgn":127250,"timestamp":"2022-12-11T14:48:31.783Z","fields":{"Heading":6.2657},"description":"Vessel Heading"}'
60+
)
61+
)
62+
tree.should.have.with.nested.property(
63+
'navigation.headingTrue.value',
64+
6.2657
65+
)
66+
tree.should.be.validSignalKVesselIgnoringIdentity
67+
})
5568
})

0 commit comments

Comments
 (0)