Repository navigation
Sync next-10.1 into maintenance-11.x - #12267
Merged
Merged
Conversation
The encoders write one byte at a time, and every byte went to the device on its own: one afatfs_fputc() or flashfsWriteByte() call per byte. Collect them in a 128 byte block and hand it over with one afatfs_fwrite() or flashfsWrite() call. The block goes out when it is full, before anything else reaches the device (header prints, flushes, the end of a log, the header budget) and at the end of every blackboxUpdate(), so nothing waits longer than one loop and the bytes keep their order; while the terrain code holds the SD card it waits until the card is back. Serial ports still get one byte at a time, since serialWriteBuf() would wait for room. On a TBS Lucid H7 logging to SD the blackbox takes 2.3% of the CPU at 1 kHz and 4.4% at 2 kHz; this cuts that time by 10 to 13%.
The SPI of F7 has a 4-byte FIFO and that of F4 none, so there every data-ready read goes through two DMA streams. The SPI stays enabled, as for the main loop's transfers, and setting its DMA requests starts the read. The streams are taken like on H7, among the options the reference manual gives each request, at the end of initialisation. Nobody has tested this on an F4 or F7 board yet, so gyro_data_ready AUTO leaves it off there: ON turns it on.
Pins added where INAV and Betaflight's config for the same board agree on the gyro's CS pin and SPI bus. In a folder with several targets the pin goes only to those Betaflight confirms. Two targets had a pin that disagreed with Betaflight and is fixed: KAKUTEF4WING (PB12, now PB2) and AOCODARCF405AIO (PC5, now PC4, as on the rest of the Aocoda F405 family, where PC5 is a PINIO). INAV never read those pins, so the wrong values never showed.
… switch, counts every skipped iteration and lends the card to terrain
…d did not take wait for it
…et does not enable
AUTO now reads the ICM-42605 and ICM-42688-P on their data-ready interrupt on every family. Where no interrupt arrives the gyro is read from its registers as before.
…Betaflight comparison missed
…ume iteration is not counted On the bench, sd_info counted one iteration too many for every pause the card ended: the iteration that resumes is logged. When the switch takes over a pause for the card and comes back on while the card is still behind, the resume wrote its I frame into what is left below the threshold, 80 to 255 bytes: enough in 8 runs, not after a large iteration. Now it waits, and those iterations count as lost to the card.
…eads it Written once at setup, so cleaned once there: nothing at run time. A no-op today: DMA_RAM is Shareable in the H7 MPU setup and the Cortex-M7 does not cache it, and on F7, which runs the same setup, INAV leaves the D-cache off. It matches the invalidate on the reply and stays right should either change. (cherry picked from commit 4287429)
The new fields are appended with a zero default, so stored settings load as they are: pgLoad copies the stored bytes over the defaults. On H7 without USE_DUAL_GYRO gyro_data_ready takes the old record's tail padding, which the reset template leaves at zero.
# Conflicts: # src/main/drivers/bus_spi_hal_ll.c
gyro: data-ready reads on F4 and F7
blackbox: hand the device a block of bytes, not one byte per call
Author
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
Author
|
Test firmware build ready — commit Download firmware for PR #12267 252 targets built. Find your board's
|
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.
Automatic sync of
next-10.1intomaintenance-11.xcould not be completed (merge conflict or push refused). Mergenext-10.1intomaintenance-11.xlocally, resolve conflicts, and push. Use a merge commit, not squash or rebase. Do not use GitHub's "Resolve conflicts" button.