Skip to content

Commit 122fa16

Browse files
authored
Support Cetrek 2900 wind data (without defined Reference) (#255)
feature: treat undefined 130306 Reference as Apparent Seen on a boat with a Digital Yacht WND100 feeding NMEA0183 into a Cetrek 2900 which transmits NMEA2000. The WND100 declares its measurements as Relative, but the Cetrek outputs 0xFF for the byte contains the Reference.
1 parent 4c21c98 commit 122fa16

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

pgns/130306.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = [
33
source: 'Wind Speed',
44
node: 'environment.wind.speedApparent',
55
filter: function (n2k) {
6-
return n2k.fields['Reference'] === 'Apparent'
6+
return n2k.fields['Reference'] === 'Apparent' || n2k.fields['Reference'] === undefined
77
}
88
},
99
{
@@ -23,7 +23,7 @@ module.exports = [
2323
{
2424
node: 'environment.wind.angleApparent',
2525
filter: function (n2k) {
26-
return n2k.fields['Reference'] === 'Apparent'
26+
return n2k.fields['Reference'] === 'Apparent' || n2k.fields['Reference'] === undefined
2727
},
2828
value: function (n2k) {
2929
var angle = Number(n2k.fields['Wind Angle'])

test/130306_wind_data.js

+17
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,21 @@ describe('130306 Wind Data', function () {
9898
)
9999
tree.should.be.validSignalKVesselIgnoringIdentity
100100
})
101+
102+
it('Cetrek sentence converts', function () {
103+
var tree = require('./testMapper').toNested(
104+
JSON.parse(
105+
'{"prio":5,"src":75,"dst":255,"pgn":130306,"timestamp":"2022-12-10T15:58:34.529Z","fields":{"Wind Speed":1.54,"Wind Angle":2.3545},"description":"Wind Data"}'
106+
)
107+
)
108+
tree.should.have.nested.property(
109+
'environment.wind.speedApparent.value',
110+
1.54
111+
)
112+
tree.should.have.nested.property(
113+
'environment.wind.angleApparent.value',
114+
2.3545
115+
)
116+
tree.should.be.validSignalKVesselIgnoringIdentity
117+
})
101118
})

0 commit comments

Comments
 (0)