-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix LTM Scheduler not being set if port is shared. #3030
Fix LTM Scheduler not being set if port is shared. #3030
Conversation
Doesn't this break the speed sanity check, allowing a configured value to override a speed limitation? |
When LTM is shared with a Serial RX protocol the baud rate will be high enough. Like 100000b/s for SBUS and 115200b/s for IBUS for istance. Am I wrong? |
5e78a1e
to
e4f4c8b
Compare
It may be shared with a MSP at 1200 baud. Does your change cover that case? |
Currently the code handles two cases:
In both cases, the LTM rate 'does the right thing', in the latter case avoiding data overrun / corruption. It would be helpful if this behaviour could be preserved for all use cases. |
MSP and LTM on the same port is not really a "shared" port. Since LTM isn't working at the same time as MSP. LTM will be emitted only when armed. So everything should work as it was working before in my opinion. |
I don''t think so, in the latter case, the scheduler is set unconditionally from config in |
Fact is that port setup is not done when the port is shared with another protocol since the port has being already initialized by the other protocol. |
That is not the point, consider the case where the user forgets that the default for
Everything works, 300 bytes/sec LTM is supported by 9600 baud.
The current code will automatically switch the ltm_scheduler to With this PR, this case is broken, the ltm_schduler is always selected from config and not sanitised by the baud rate. This is an (unintended) regression. The 1200 baud pipe cannot support 300 bytes/sec. Telemetry is corrupted. It is also easily fixed by changing:
to
then the previous, intended behaviour is maintained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as configureLtmScheduler() is only used by ltm.c, it can be declared before use as static and does not need to be forward declared in ltm.h
Please change the order of
configureLtmTelemetryPort();
configureLtmScheduler();
to
configureLtmScheduler();
configureLtmTelemetryPort();
in order to maintain the current baud rate sanitisation of ltm_schedule
e4f4c8b
to
8b30841
Compare
@stronnag Followed your advices. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to merge to me
Thanks @fiam to pointing this out during tests to try to share SBUS port with LTM.
Seems like there are only a few useful usages related to sharing LTM with SBUS due to the nature of SBUS protocol.