Conversation
The condition enabled it for every state above STOPPED, which includes the header states, a log paused from the switch, and the shutdown. None of those write a main frame, so each reading taken there goes nowhere while still costing a transaction on the sensor bus every gyro cycle. Measured in SITL with a counter on the secondary read, armed throughout and the blackbox switch toggled: with the log paused the reads went on at 76 to 95 a second, and now they stop at zero and come back on resume. The zero calibration is untouched, since it is driven by its own condition and runs before arming.
Contributor
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
PR Summary by QodoStop Secondary Gyro Reads While Blackbox Logging Is Paused
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
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.
Follow-up to #11933, which you merged for RC1. Review raised this after the merge and it is right.
What happens
blackboxSetState()turns the secondary gyro on for every state aboveBLACKBOX_STATE_STOPPED:That covers more than logging. The header states,
BLACKBOX_STATE_PAUSED, which is where a log goes when the blackbox switch is turned off in flight, andBLACKBOX_STATE_SHUTTING_DOWNall write no main frame. A reading taken in any of them goes nowhere, and it costs a transaction on the sensor bus every gyro cycle while it lasts. A pilot who switches logging off mid-flight keeps paying for a sensor nobody reads.The change
One condition: the second gyro is read while frames are being written, and not otherwise.
Nothing else changes. The zero calibration does not depend on this flag:
gyroUpdateSecondary()also reads while!gyroCalibrationComplete[GYRO_SECONDARY], which is what measures the zero at startup, before arming. Stopping and restarting the reads does not re-initialise the sensor, does not restart a calibration and has no settling time, since the device is never reconfigured. The first frame after a resume can carry a reading one gyro cycle old, which is under a millisecond.Testing
SITL with a counter on the secondary read, armed throughout, toggling the blackbox switch between running and paused:
The first second of each phase carries the transition, so it sits between the two rates. Both runs produce a log and both resume cleanly. The zero calibration still runs before arming in both, which is the handful of reads visible there.