Skip to content

Commit

Permalink
feature: add engine parameters rapid update 127488 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbender9 authored May 2, 2019
1 parent 90a11d5 commit 971c556
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions conversions/engineParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ module.exports = (app, plugin) => {
'engineTorque'
]

const engRapidKeys = [
'revolutions',
'boostPressure',
'drive.trimState'
]

return [{
title: 'Temperature, exhaust (130312)',
optionKey: 'EXHAUST_TEMPERATURE',
Expand Down Expand Up @@ -66,8 +72,7 @@ module.exports = (app, plugin) => {
}
},
{
//pgn: 127489,
title: 'Engine Parameters, Dynamic (127489)',
title: 'Engine Parameters (127489,127488)',
optionKey: 'ENGINE_PARAMETERS',
context: 'vessels.self',
properties: {
Expand All @@ -94,7 +99,7 @@ module.exports = (app, plugin) => {
if ( !_.get(options, 'ENGINE_PARAMETERS.engines') ) {
return null
}
return options.ENGINE_PARAMETERS.engines.map(engine => {
const dyn = options.ENGINE_PARAMETERS.engines.map(engine => {
return {
keys: engParKeys.map(key => `propulsion.${engine.signalkId}.${key}`),
timeouts: engParKeys.map(key => DEFAULT_TIMEOUT),
Expand All @@ -119,6 +124,25 @@ module.exports = (app, plugin) => {
}
}
})

const rapid = options.ENGINE_PARAMETERS.engines.map(engine => {
return {
keys: engRapidKeys.map(key => `propulsion.${engine.signalkId}.${key}`),
timeouts: engRapidKeys.map(key => DEFAULT_TIMEOUT),
callback: (revolutions, boostPressure, trimState) => {
return [{
pgn: 127488,
"Engine Instance": engine.instanceId,
"Instance": engine.instanceId,
"Speed": revolutions === null ? undefined : revolutions * 60,
"Boost Presure": boostPressure === null ? undefined : boostPressure / 100,
"Tilt/Trim": trimState === null ? undefined : trimState * 100
}]
}
}
})

return dyn.concat(rapid)
}
}]
}

0 comments on commit 971c556

Please sign in to comment.