mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)
* SPI - Mark the SPI IRQ handler as FAST_IRQ_HANDLER. Since it's used by both the gyro code, at 8k (or 2x8k on dual gyro boards) having it in RAM removes a significant amount of potential flash latency. It is also used by the ELRS SPI code. The ELRS code runs at 500hz, but each cycle uses multiple SPI transfers, for clear irq, read, start-recieving, change-frequency, etc. I.e. invokd at least 1000hz in addition to gyro reads. * ELRS - Move some frequently used functions to RAM and mark some irq handlers as FAST. * SPI/LL - Move some frequently called code to FAST_CODE. Also remove some invalid characters that Eclipse with encoding as UTF-8 complained about. * SPI - Mark the spiRx and spiTx dma handlers as FAST_IRQ_HANDLER. * Filter - move nullFilterApply out of FAST_CODE. Since it doesn't do anything, it doesn't need to be fast. Instead we keep more `fast` RAM for other code that really benefits from being in fast RAM. There is a slight penalty to jump into slower RAM. * Gyro - Move `performGyroCalibration`out of 'fast' ram. On F7X2 it was being inlined, saved 478 bytes of ITCM. * Prevent handling of crash recovery handling, not detection of crash recovery, from being inlined to save ITCM for code that runs more frequently.
This commit is contained in:
parent
4494805202
commit
738ed32cff
6 changed files with 22 additions and 22 deletions
|
@ -460,7 +460,7 @@ STATIC_UNIT_TESTED FAST_CODE_NOINLINE float pidLevel(int axis, const pidProfile_
|
|||
return currentPidSetpoint;
|
||||
}
|
||||
|
||||
static void handleCrashRecovery(
|
||||
static FAST_CODE_NOINLINE void handleCrashRecovery(
|
||||
const pidCrashRecovery_e crash_recovery, const rollAndPitchTrims_t *angleTrim,
|
||||
const int axis, const timeUs_t currentTimeUs, const float gyroRate, float *currentPidSetpoint, float *errorRate)
|
||||
{
|
||||
|
@ -502,7 +502,7 @@ static void handleCrashRecovery(
|
|||
}
|
||||
}
|
||||
|
||||
static void detectAndSetCrashRecovery(
|
||||
static FAST_CODE_NOINLINE void detectAndSetCrashRecovery(
|
||||
const pidCrashRecovery_e crash_recovery, const int axis,
|
||||
const timeUs_t currentTimeUs, const float delta, const float errorRate)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue