Fix/kisswrapper singleflight sethardware#71
Draft
agessaman wants to merge 7 commits into
Draft
Conversation
- Introduced a set of allowed responses for SetHardware commands to handle legitimate OK responses. - Implemented single-flight command execution to prevent race conditions during concurrent requests. - Updated methods to accept an optional timeout parameter for better control over response waiting. - Enhanced response queue management to handle late or out-of-order responses effectively. - Added tests to ensure correct behavior of command responses and timeout handling.
- Added a serial write lock to ensure atomic writes across threads, preventing interleaving of frame bytes during concurrent operations. - Updated the _write_frame method to utilize the new lock, enhancing reliability in multi-threaded environments. - Introduced tests to verify that UART writes from different callers do not overlap, ensuring data integrity during transmission.
- Changed the version from "1.0.10" to "1.0.10-agdev" in both pyproject.toml and __init__.py to reflect the current development status of the project.
- Added mechanisms for managing degraded connection states, including flags for degraded status and reasons. - Implemented a reconnect worker to handle automatic reconnection attempts after connection failures. - Updated the connect and disconnect methods to properly manage connection states and thread handling. - Enhanced error handling during serial communication to ensure robust operation in multi-threaded environments. - Introduced tests to validate the new reconnect behavior and degraded state management.
…d safety - Updated connection handling to set `is_connected` based on the success of the handshake process. - Enhanced thread conditions in the RX and TX workers to check for the serial connection's readiness. - Modified the `configure_radio` method to validate the serial connection state before proceeding. - Added tests to ensure correct behavior of connection states during connect and reconnect operations.
- Changed the version from "1.0.10-agdev" to "1.0.10.dev1" in both pyproject.toml and __init__.py to indicate a new development iteration.
- Introduced new parameters for post-connect settling and configuration retries to improve connection robustness. - Implemented retry logic for the `configure_radio` method, allowing for transient failures during configuration attempts. - Added tests to validate the new retry behavior and ensure correct connection state management during configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 has two categories of fixes raised by wo0f's G2 issues. The first is the intermixing of signals. This implements single flight command execution to prevent race conditions that we were seeing.
It also handles modem disconnect and re-enumeration by marking the modem as degraded and attempting a reconnect. It allows a brief warm-up period in case the modem lost power and needs to reinitialize the KISS modem firmware.
This is a work in progress, and I'm still working with wo0f to ensure that this is resilient against the issues he is experiencing.
Before merging it will at least need the test firmware ids pulled out.