Skip to content

Log the standard deviation of gyro cycle time in SCHEDULER_DETERMINISM and TIMING_ACCURACY #13377

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

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

SteveCEvans
Copy link
Member

The SCHEDULER_DETERMINISM and TIMING_ACCURACY debug modes focus on task lateness. This PR adds a measure of the impact on the gyro loop timing by reporting the standard deviation in 100ths of a us in debug[7].

This log was taken from a ZEEZF7V3 and shows how, with USB connected at the start and end of the log, this figure was about 2us, however with USB disconnected (between 5 and 10 seconds in the log), the figure was about 30ns!

ZEEZF7V3_STDDEV.bbl.zip

@KarateBrot Please check the maths

Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13377 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

@ctzsnooze
Copy link
Member

Should these extra computations be encapsulated in an if (debugMode == ... check, so that they are only done when those particular debugs are required?

@SteveCEvans
Copy link
Member Author

Should these extra computations be encapsulated in an if (debugMode == ... check, so that they are only done when those particular debugs are required?

I thought about this and thought we should be logging real behaviour; ie enabling/disabling logging should have minimal impact on performance. Having thought about it some more the impact of logging here is worst case, so safe to exclude. I agree with your comment.

@SteveCEvans
Copy link
Member Author

Add feedback applied and pushed afresh

Copy link
Member

@KarateBrot KarateBrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good now. Found two double assignments to the float variable. I'm a pain in the rear, I know :)

haslinghuis and others added 2 commits February 26, 2024 22:24
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
Co-authored-by: Jan Post <Rm2k-Freak@web.de>
@haslinghuis haslinghuis merged commit 4f1b36f into betaflight:master Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

5 participants