Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle changes to canboat raymarine AP state pgn #274

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
}
}
}
]
Loading