Daxbot / node-canopen

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

[2.5.1] Pdo.write: keep track of lastValue in the dataObject instead of the Pdo #19

Closed bdcdekimo closed 3 years ago

bdcdekimo commented 3 years ago

Based on the code in Pdo._parsePDO() it looks the intention was to keep track of lastValue per dataObject in pdo.dataObjects, but lines 153-156 store lastValue in the Pdo itself:

            if(pdo.lastValue != newValue) {
                pdo.lastValue = newValue;
                dataUpdated = true;
            }

I think these lines should be replaced by

            if(dataObject.lastValue != newValue) {
                dataObject.lastValue = newValue;
                dataUpdated = true;
            }

I don't use Pdo._onMessage() because we don't have Rx PDO's in our application, but it looks like that function has the same problem.

wilkinsw commented 3 years ago

Sorry for the delay, should be fixed in 2.5.2

bdcdekimo commented 3 years ago

Thanks, both issues are fixed!