Daxbot / node-canopen

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

Fix SDO transfer exceptions and add new tests #9

Closed dawn-minion closed 4 years ago

dawn-minion commented 4 years ago

PR fixes a few exceptions/issues I encountered when trying out the new beta branch:

When reading or writing to a subindex >= 1, an exception would be thrown, as "subIndex" is not defined, and should instead be "transfer.subIndex". Commit also includes new tests that verify these now work correctly. Also changes the SDO timeout test to verify it is the right exception. I changed EDS' getSubEntry to call this.getEntry when looking up the index, as otherwise it is not possible to use a string as the index value like the JSDoc suggests

Lastly fixes EDS.load failing to create a raw for an object because DataType was not parsed as an int, causing typeToRaw to fail to return a correct value. A test has been added for this as well.

I've also added socketcan to devDependencies as the demos cannot be run without it.