1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Merge pull request #9449 from etracer65/blackbox_32k_cleanup

Blackbox 32K code cleanup
This commit is contained in:
Michael Keller 2020-02-06 17:07:26 +13:00 committed by GitHub
commit 19fa0f7c23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 21 deletions

View file

@ -1824,13 +1824,8 @@ void blackboxInit(void)
// an I-frame is written every 32ms
// blackboxUpdate() is run in synchronisation with the PID loop
// targetPidLooptime is 1000 for 1kHz loop, 500 for 2kHz loop etc, targetPidLooptime is rounded for short looptimes
if (targetPidLooptime == 31) { // rounded from 31.25us
blackboxIInterval = 1024;
} else if (targetPidLooptime == 63) { // rounded from 62.5us
blackboxIInterval = 512;
} else {
blackboxIInterval = (uint16_t)(32 * 1000 / targetPidLooptime);
}
// by default p_ratio is 32 and a P-frame is written every 1ms
// if p_ratio is zero then no P-frames are logged
if (blackboxConfig()->p_ratio == 0) {

View file

@ -95,20 +95,6 @@ TEST(BlackboxTest, TestInitIntervals)
EXPECT_EQ(256, blackboxIInterval);
EXPECT_EQ(8, blackboxPInterval);
EXPECT_EQ(65536, blackboxSInterval);
// 16kHz PIDloop
targetPidLooptime = 63; // rounded from 62.5
blackboxInit();
EXPECT_EQ(512, blackboxIInterval); // note rounding
EXPECT_EQ(16, blackboxPInterval);
EXPECT_EQ(131072, blackboxSInterval);
// 32kHz PIDloop
targetPidLooptime = 31; // rounded from 31.25
blackboxInit();
EXPECT_EQ(1024, blackboxIInterval); // note rounding
EXPECT_EQ(32, blackboxPInterval);
EXPECT_EQ(262144, blackboxSInterval);
}
TEST(BlackboxTest, Test_500Hz)