Conversation
|
ⓘ 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)
|
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.
bc582c5 to
0acf1a3
Compare
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #11995 250 targets built. Find your board's
|
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.