DS402: Allow handling the operation mode via PDO. #257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is based on #256 to avoid conflicts, thus should be merged after it. If needed I can rebase after merging #256.EDIT: Rebased on top of master with #256 merged.
Switching operation modes for several drives simultaneously must be done via PDO. The current mechanism used for the
BaseNode402.op_modeproperty supports only SDO. Now the PDO method is tried first, but falls back to the SDO method if the relevant objects (0x6060 / 0x6061) are not mapped to PDOs. In order to make sure an up-to-date value is returned for the property, the getter blocks until the TPDO has been received once, with a default timeout of 0.2 seconds leading to aRuntimeError.On a side track,
pdo.Mapgains a new propertyis_periodicwhich reflects whether theperiodmember has been set (usually fromstart()), or if a synchronous transmission type is configured. The above mentioned blocking behavior of theop_modegetter is skipped if the TPDO is not deemed periodic, to prevent the timeout from firing. Similarly, transmitting the RPDO immediately in theop_modesetter is skipped when deemed periodic. Same goes for thecontrolwordsetter, assuming that the application is responsible to set up the periodic transmission.