Daxbot / node-canopen

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

[2.5.3] RPDO mapping array sub-index #23

Closed arkaheb258 closed 3 years ago

arkaheb258 commented 3 years ago

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

@@ -178,7 +178,10 @@ class Pdo {

             for(const dataObject of pdo.dataObjects) {
                 const index = dataObject.index;
-                const entry = this.device.dataObjects[index];
+                let entry = this.device.dataObjects[index];
+                if(entry.subNumber > 0) {
+                    entry = entry[dataObject.subIndex];
+                }
                 const size = entry.raw.length;
wilkinsw commented 3 years ago

Should be resolved in 2.5.4-beta