Skip to content

Commit

Permalink
fix: handle changes to canboat raymarine AP state pgn (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbender9 authored Aug 2, 2024
1 parent 8ad3484 commit dfe6d87
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions raymarine/65379.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,30 @@ 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 dfe6d87

Please sign in to comment.