diff --git a/pgns/127250.js b/pgns/127250.js index 240fa5f..8950c0f 100644 --- a/pgns/127250.js +++ b/pgns/127250.js @@ -14,8 +14,10 @@ module.exports = [ node: 'navigation.headingTrue', filter: function (n2k) { return ( - n2k.fields['Reference'] === 'True' && - typeof n2k.fields['Heading'] !== 'undefined' + typeof n2k.fields['Heading'] !== 'undefined' && ( + n2k.fields['Reference'] === 'True' || + typeof n2k.fields['Reference'] === 'undefined' + ) ) } }, diff --git a/test/127250_heading.js b/test/127250_heading.js index 3d49a61..59e7c1f 100644 --- a/test/127250_heading.js +++ b/test/127250_heading.js @@ -52,4 +52,17 @@ describe('127250 Heading', function () { ) // tree.should.be.validSignalKVesselIgnoringIdentity }) + + it('Cetrek sentence converts', function () { + var tree = require('./testMapper').toNested( + JSON.parse( + '{"canId":233902663,"prio":3,"src":71,"dst":255,"pgn":127250,"timestamp":"2022-12-11T14:48:31.783Z","fields":{"Heading":6.2657},"description":"Vessel Heading"}' + ) + ) + tree.should.have.with.nested.property( + 'navigation.headingTrue.value', + 6.2657 + ) + tree.should.be.validSignalKVesselIgnoringIdentity + }) })