Daxbot / node-canopen

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

EDS issues, please take in the fix #46

Closed dmitry-tarnyagin closed 3 weeks ago

dmitry-tarnyagin commented 3 weeks ago
  1. A typo in extended frame detection code of _parseSdoParameter()

    The extended frame flag is encoded in bit 29, not 31. COB-IDs like 0x80000000 are actually allowed as "Invalid COB-ID" in cases like:

    ... [1280sub1] ParameterName=COB-ID client to server (tx) ObjectType=0x7 DataType=0x0007 AccessType=rw DefaultValue=0x80000000 PDOMapping=1

    [1280sub2] ParameterName=COB-ID server to client (rx) ObjectType=0x7 DataType=0x0007 AccessType=rw DefaultValue=0x80000000 PDOMapping=1 ...

, however eds._parseSdoParameter() throws an exception here.

2. Parsing an EDS with empty PDO slots leads to undefined entries in the getTransmitPdos() / getReceivePdos() return arrays, with a possible crash when attempting to use them as PDO objects.

3. Mapping of PDOs in the remote node's EDS file is broken when a PDO is referring to several subentries of an SDO, or to an already mapped SDO.

The issues are fixed in https://github.com/dmitry-tarnyagin/node-canopen/pull/1, please review and take in if it's fine.

wilkinsw commented 3 weeks ago

Published as 6.1.1, thanks for your help!

dmitry-tarnyagin commented 3 weeks ago

Hi,

A new one: https://github.com/dmitry-tarnyagin/node-canopen/pull/2 :)

It consists of two commits, The first one is trivial, but please take look to the second one. Is it how you supposed to remap TPDOs to RPDOs? The COB-ID-s from a file are template ones w/o node id.

Regards, Dmitry