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.
The
BaseNode402.setup_402_state_machine()
method does some unnecessary things that should rather be handled in the application code. Switching the NMT state and DS402 power state was already questioned in a code comment, and I agree that it should not happen here unconditionally.In the same spirit, reading all of the node's PDO configuration is detrimental to the application in case it has previously called
pdo.save()
, causing lots of needless SDO traffic. So that part is made optional through a function argument.Overall this should make the library's convenience methods more useful in context of a more complex application. The downside of course is that a simple script to get some DS402 controller working would need a little more state switching outside of the library code.