Skip to content

Commit

Permalink
fix: handle changes to canboat raymarine AP state pgn
Browse files Browse the repository at this point in the history
  • Loading branch information
sbender9 committed Jul 25, 2024
1 parent 8ad3484 commit 5604287
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions raymarine/65379.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@ module.exports = [
{
node: 'steering.autopilot.state',
value: function (n2k) {
var mode = Number(n2k.fields['Pilot Mode'])
var subMode = Number(n2k.fields['Sub Mode'])
if (mode == 0 && subMode == 0) return 'standby'
else if (mode == 0 && subMode == 1) return 'wind'
else if ((mode == 128 || mode == 129) && subMode == 1) return 'route'
else if (mode == 64 && subMode == 0) return 'auto'
else return 'standby'
var mode = n2k.fields['Pilot Mode']
if ( typeof mode === 'string' ) {
if ( mode === "Standby" )
{
return 'standby'
} else if ( mode === "Auto, compass commanded" ) {
return 'auto'
} else if ( mode === "Vane, Wind Mode" ) {
return 'wind'
} else if ( mode === "Track Mode" ) {
return 'route'
} else if ( mode === "No Drift, COG referenced (In track, course changes)" ) {
return 'route'
}
} else {
mode = Number(n2k.fields['Pilot Mode'])
var subMode = Number(n2k.fields['Sub Mode'])
if (mode == 0 && subMode == 0) return 'standby'
else if (mode == 0 && subMode == 1) return 'wind'
else if ((mode == 128 || mode == 129) && subMode == 1) return 'route'
else if (mode == 64 && subMode == 0) return 'auto'
else return 'standby'
}
}
}
]

0 comments on commit 5604287

Please sign in to comment.