Daxbot / node-canopen

CANopen implementation for NodeJS
MIT License
32 stars 11 forks source link

[2.5.3] PDO wrong COB_ID when different from default. #21

Closed arkaheb258 closed 3 years ago

arkaheb258 commented 3 years ago

When the COB_ID for PDO is different from the default value, the node address should not be added.

Partial solution (src/protocol/pdo.js):

@@ -221,7 +221,7 @@ class Pdo {
             throw TypeError("CAN extended frames are not supported.")

         cobId &= 0x7FF;
-        if((cobId & 0xF) == 0x0)
+        if((cobId & 0x7F) == 0x0)
             cobId |= this.device.id;
wilkinsw commented 3 years ago

Good catch! Looks like the base ids are every 0x80 starting at 0x180, so I used that modulo for the comparison

wilkinsw commented 3 years ago

Should be resolved in 2.5.4-beta