getCanIdFromPGN returns negative ID that is mathematically correct but doesn't seem to work
Closed this issue · 2 comments
fabdrol commented
When running getCanIdFromPGN
utility with the following data I'm getting an ID of -1729167606
. This ID gives the correct results when running it through getPGNFromCanId
, but a socketcan frame generated with that ID won't parse (using canboatjs) and doesn't seem to send correctly either.
getCanIdFromPGN({
pgn: 60928,
src: 9,
dst: 255,
prio: 6
}) // => -1729167606
getPGNFromCanId(-1729167606) // => { pgn: 60928, src: 9, dst: 255, prio: 6 }
/* socketcan frame that won't parse in canboatjs
{
"id": -1729167606,
"ext": true,
"data": {
"type": "Buffer",
"data": [
30,
24,
224,
124,
0,
130,
51,
64
]
}
}
*/
Thoughts?
fabdrol commented
To clarify, I have set my can interface to loop back.
fabdrol commented
Actually nevermind. It turned out that it did work, but the loopback of the interface didn't work (even though querying socket options returned 1 for that). When I connected another CAN interface, everything was fine.