From 0acf1a3f818699aa84fd5661fb5678b2bad50f2d Mon Sep 17 00:00:00 2001 From: MrScothh <167884257+MrScothh@users.noreply.github.com> Date: Mon, 21 Sep 2026 11:23:05 +0200 Subject: [PATCH] blackbox: read the second gyro only while frames are being written 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. --- src/main/blackbox/blackbox.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index 5d8ea57203b..659126fbf76 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -940,8 +940,11 @@ static void blackboxSetState(BlackboxState newState) blackboxState = newState; #ifdef USE_DUAL_GYRO - // The second gyro is read only for the log, so only while there is one - gyroSetSecondaryLogging(newState > BLACKBOX_STATE_STOPPED); + // The second gyro is read only for the log, so only while frames are being written. + // Every other state above STOPPED, the headers, a log paused from the switch, and + // the shutdown, writes no main frame, so a reading taken there goes nowhere and the + // transaction on the bus is spent for nothing + gyroSetSecondaryLogging(newState == BLACKBOX_STATE_RUNNING); #endif }