fix(crsf): send modelID after module reset#5506
Merged
Merged
Conversation
Contributor
Author
|
This is an issue in 2.10 (and previous versions) too |
Member
|
Sounds good to me... I told Raphael a while back there were still some issues with RX_ID (I think he'd just fixed it to at least make it send when you changed the RX_ID, rather than just on module startup) but clearly it got lost amongst all the other things needing working on. Crossfire will benefit from this also, as clearly the RF module can "forget" the active RX_ID... |
pfeerick
approved these changes
Sep 6, 2024
Member
pfeerick
left a comment
There was a problem hiding this comment.
Seems to be working perfectly with TX16S and RM Ranger Micro - returns to correct RX_ID on exiting wifi mode, resetting after update, re-insertion of module, model switch, etc.
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.
Problem:
ExpressLRS modules store the RF parameters in a model specific way using the modelID as index. EdgeTX sends the modelID once at first initialization of the module. If after that the module resets for any reason the module starts up and assumes modelID 0 for a lack of better information. This is not only annoying but also dangerous because a receiver will potentially not re-connect after the module comes back to live after the reset as the module is now using the RF parameters stored for the model with the modelID 0.
The effect is demonstrated in the attached video. The module is removed during normal operation with a receiver connected using a model with modelID 7 (100Hz in my case) to simulate a reset. After putting the module back in it starts up but uses modelID 0 RF parameters (250 Hz in my case) which prevents the receiver to re-connect. If you want to try this you can use a less brutal method that also works for internal modules. Prepare two models and set one to modelID 0, the other to modelID e.g. 7. Use the LUA script to set both models to different packet rates. Select the model with modelID 7 and connect to a receiver. Start the LUA Script, put the module into WiFi mode and exit WiFi mode again. Best to observe the LCD screen on an external module.
Reasons for a module resetting might be:
Solution:
This PR adds some logic to detect a module coming back to live after a reset and in this case sends the current modelID again to ensure the correct RF parameters are used.
Implementation:
A live ExpressLRS module will send CRSF packets even if no receiver is connected. If no packets are received within 500ms the module is declared not alive. If the module boots up again it'll start sending CRSF frames with a period of far less than 500ms again. The transition from not alive to alive triggers the sending of the modelID. The module receives the modelID and selects the correct RF parameter which allow the receiver to re-connect.
vid.mp4