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

feature: Add support for ShipModul Miniplex Latest Firmware #234

Merged
merged 9 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
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
22 changes: 13 additions & 9 deletions hooks/proprietary/PSMDST.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@
'use strict'

/*
0 1 2 3
| | | |
$PSMDST,xx,yy,nn*CS
0 1 2 3 4 5
| | | | | |
$PSMDST,Z,xx,yy,nn*CS
where:
PSMDST Raymarine Seatalk1 datagram sentence
0 00-9C Datagram type
1 hex First datagram content
2 hex Last datagram content
3 hex Checksum
0 PSMDST Raymarine Seatalk1 datagram sentence
1 C/R R for Received messages, C for sent messages *Note: This field only exists in later firmware versions of the ShipModul Miniplex
2 00-9C Datagram type
3 hex First datagram content
4 hex Last datagram content
5 hex Checksum
*/

const seatalkHooks = require('../seatalk')

module.exports = function (input, session) {
const { id, sentence, parts, tags } = input
const key = '0x' + parts[0].toUpperCase()
if (parts[0].toUpperCase() === 'R') {
tkurki marked this conversation as resolved.
Show resolved Hide resolved
input.parts = parts.slice(1, input.parts.length);
}
const key = '0x' + input.parts[0].toUpperCase();
if (typeof seatalkHooks[key] === 'function') {
return seatalkHooks[key](input, session)
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/seatalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const should = chai.Should()
chai.use(require('chai-things'))

describe('seatalk', () => {
;['$PSMDST,', '$STALK,'].forEach((prefix) => {
;['$PSMDST,', '$PSMDST,R,', '$STALK,'].forEach((prefix) => {
it(`${prefix} 0x00 depth converted`, () => {
const fullSentence = utils.appendChecksum(`${prefix}${depthData}`)
const delta = new Parser().parse(fullSentence)
Expand Down