Skip to content

Commit

Permalink
fix: toPgn sends 00 for null values instead of ff (#222)
Browse files Browse the repository at this point in the history
* fix: toActisenseSerialFormat to handle prio

* fix: toPgn to handle null values to send FF rather than 00
  • Loading branch information
nmbath authored May 26, 2023
1 parent ed28e9e commit 78d0a0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/stringMsg.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports.encodeActisense = ({
byteString(data)
].join(','))

exports.toActisenseSerialFormat = (pgn, data, dst=255, src=0) => exports.encodeActisense({
exports.toActisenseSerialFormat = (pgn, data, dst=255, src=0, prio=2) => exports.encodeActisense({
pgn, data, dst, src, prio
})

Expand Down
4 changes: 2 additions & 2 deletions lib/toPgn.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function writeField(bs, pgn_number, field, data, value, bitLength) {
}

// console.log(`${field.Name}:${value}(${bitLength}-${field.Resolution})`)
if ( _.isUndefined(value) ) {
if ( _.isUndefined(value) || value === null) {
if ( field.Type && fieldTypeWriters[field.Type] ) {
fieldTypeWriters[field.Type](pgn_number, field, value, bs)
} else if ( bitLength % 8 == 0 ) {
Expand Down Expand Up @@ -223,7 +223,7 @@ function writeField(bs, pgn_number, field, data, value, bitLength) {
if (field.Signed) {
bs.writeInt32(value)
} else {
bs.writeUint32(value)
bs.writeUint32(value)
}
} else if (bitLength === 48 || bitLength == 24) {
var count = bitLength/8;
Expand Down

0 comments on commit 78d0a0e

Please sign in to comment.