Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DS402: Simplify setup procedure. (#259)
* p402: Do not switch any states during setup_402_state_machine(). Reading the PDO configuration is possible in OPERATIONAL or PRE-OPERATIONAL states, so switching that is unnecessary. The application should be responsible to handle such transitions, and the library function should be usable without disturbing the application logic. Changing the DS402 state machine to SWITCH ON DISABLED is also not necessary. The drive may be in whatever state from a previous usage, and then the change to SWITCH ON DISABLED may even trigger an exception because there is no way to reach it directly. So this transition should also be the application's responsibility. * p402: Check NMT state before reading PDO configuration. SDOs are allowed in all but the STOPPED state. That would lead to a timeout and an SdoCommunicationError exception. Checking the NMT state here raises an exception without a timeout involved. * p402: Make reading the PDO configuration optional during setup. If the application already configured the PDOs and called .save() on the pdo.Maps object, there is no sense in reading everything back again in the setup_pdos() method. Provide an optional argument to disable that behavior. A call to subscribe to the PDOs from the network is added because that side-effect of pdo.read() is necessary for the TPDO callback to work. * p402: Allow skipping PDO upload from setup_402_state_machine(). Add an optional argument which is simply passed down to setup_pdos() to choose whether reading the PDO configuration is necessary. * Fix DS402 documentation to match the implementation. Besides the changes regarding setup_402_state_machine(), there were numerous errors where the documentation talks about nonexistent or differently named attributes. Also fix the description regaring what the method actually does. It won't configure the TPDO1 to contain the Statusword, but only check the PDO configuration for Statusword and Controlword presence. Co-authored-by: André Filipe Silva <[email protected]>
- Loading branch information