Skip to content

Commit

Permalink
feature: add 126720 for Raymarine Display Group Brightness (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-git authored Jan 1, 2025
1 parent 57c2e80 commit d4380ff
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions conversions/raymarineBrightness.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const _ = require('lodash')

module.exports = (app, plugin) => {
return {
title: 'Raymarine (Seatalk) Display Brightness (126720)',
optionKey: 'RAYMARINE',
context: 'vessels.self',
properties: {
groups: {
title: 'Group Mapping',
type: 'array',
items: {
type: 'object',
properties: {
signalkId: {
title: 'Signal K Group id',
type: 'string',
},
instanceId: {
title: 'NMEA2000 Group Instance Id',
type: 'string',
}
}
}
}
},

testOptions: {
RAYMARINE: {
groups: [{
signalkId: 'helm2',
instanceId: 'Helm 2'
}]
}
},

conversions: (options) => {
if (!_.get(options, 'RAYMARINE.groups')) {
return null
}
return options.RAYMARINE.groups.map(group => {
return {
keys: [`electrical.displays.raymarine.${group.signalkId}.brightness`],
callback: (brightness) => {
return [{
pgn: 126720,
"dst": 255,
"Manufacturer Code": "Raymarine",
"Industry Code": "Marine Industry",
"Proprietary ID": "0x0c8c",
"Group": group.instanceId,
"Unknown 1": 1,
"Command": "Brightness",
"Brightness": brightness * 100,
"Unknown 2": 0
}]
},
tests: [{
input: [0.85],
expected: [{
"prio": 2,
"pgn": 126720,
"dst": 255,
"fields": {
"Manufacturer Code": "Raymarine",
"Industry Code": "Marine Industry",
"Proprietary ID": "0x0c8c",
"Group": "Helm 2",
"Unknown 1": 1,
"Command": "Brightness",
"Brightness": 85,
"Unknown 2": 0
}
}]
}]
}
})
}
}
}

0 comments on commit d4380ff

Please sign in to comment.