Repository navigation
Conversation
taskRunRealtimeCallbacks() calls afatfs_poll() from scheduler(), which is FAST_CODE, and LTO inlines the file system's state machine into it. On targets with an SD card that puts 800 to 980 bytes of afatfs code in ITCM, depending on the target, where KAKUTEF7 and KAKUTEF7HDV are at 99%. The poll does a little work at most once per scheduler loop, so it runs from flash like the rest of afatfs.
Adds a high-pass filtered copy of the throttle on top of it, so the motors follow quick throttle moves sooner: throttle_boost (0-100, the boost is the value / 10 times the high-passed throttle) and throttle_boost_cutoff (5-50 Hz, 15 by default), as in Betaflight. Off by default. Only the motors get the boost: mixerThrottleCommand, which OSD, telemetry and servos read, stays the throttle that was asked for. Multirotor only, and not while navigation controls the throttle, during a VTOL transition, with reversible motors or with the logic-condition throttle override. After the mixer skipped it for more than 100 ms (disarmed, motors stopped, navigation in control), the filter restarts from the current throttle. Both settings are appended to motorConfig_t without a version bump: the first one lands in the old record's tail padding, stored as zero, which is its default, and the cutoff starts past the end of any stored record, so it keeps its default of 15 Hz.
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoAdd optional multirotor throttle boost and preserve ITCM space
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
…change The low-pass restarted only after 100 ms without the mixer, so a shorter motor stop resumed against the throttle from before the stop, and a cutoff changed while mixing kept the old one. Restart from the current throttle whenever the gap is longer than any mixer period (20 ms; looptime is at most 9 ms) or the cutoff differs from the one in use.
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #12120 251 targets built. Find your board's
|
The throttle boost fields follow the SRXL2 ones, which existed only where USE_MOTOR_SRXL2 is defined. A target that turned it on or off would then read its stored boost cutoff as the SRXL2 reverse channel, or the other way round, and a cutoff of 0 blocks arming as an invalid setting. With the fields always there the layout is the same everywhere; on targets without SRXL2 they stay zero and unused.
As Betaflight writes them, so a log says whether the boost was on and how strong it was.
# Conflicts: # src/main/io/asyncfatfs/asyncfatfs.c
Builds on #12118 (afatfs_poll out of ITCM). This one alone would fit, but the thrust linearization PR stacked on it (#12121)
needs that room on KAKUTEF7.
Betaflight's throttle boost, for multirotors. It adds a high-pass filtered copy of the throttle to the throttle, so
the motors follow a quick throttle move sooner. It is off by default.
throttle_boost(0-100, default 0): the boost is this value / 10 times the throttle minus its low-pass filteredvalue. Betaflight uses 5 by default.
throttle_boost_cutoff(5-50 Hz, default 15): cutoff of that low-pass filter, as in Betaflight.It works as in Betaflight's
mixer.c, on the throttle afterthrottle_scaleand battery compensation, and theresult is kept within the throttle range. Only the motors get the boost: OSD, telemetry and servos keep showing the
throttle that was asked for. It is not applied:
The filter starts again from the current throttle after any skipped pass:
looptimeis at most 9 ms.It also restarts when the cutoff changes. So arming, leaving motor stop or taking the throttle back from navigation
does not kick the motors.
The math runs out of line, in flash, in one call before the motor loop:
mixTable()isFAST_CODE, and ITCM isalmost full on KAKUTEF7.
Settings storage
Both fields are appended to
motorConfig_twithout a version bump, so nobody's motor settings are reset.pgLoad()copies the stored bytes over the defaults. The four SRXL2 bytes are now in the struct on every target, so the layout
is the same everywhere and a target that turns
USE_MOTOR_SRXL2on or off keeps reading these fields in place. Ontargets without SRXL2 the four bytes stay zero and unused, for 4 B of flash on F7.
USE_MOTOR_SRXL2, whose last byte is tail padding stored as zero.throttle_boost(offset 13) lands in that byte on SRXL2 targets, and past the old record elsewhere; its default is 0.throttle_boost_cutoff(offset 14) starts past the end of any stored record, so it keeps its default of 15, and acutoff of 0 is skipped anyway.
I checked the offsets in the debug info of F7, F405 and H7 builds (16 bytes on all three), and the move between the
two layouts on a Flywoo F722, in the Qodo thread on
mixer.h.Bench
Flywoo F722 Pro V2 (FLYWOOF722PRO image), no battery, so the motors could not spin. I armed it over MSP RC with a
QUADX mixer and stepped the throttle 1200 -> 1600 -> 1200 -> 1800 -> 1200, logging the blackbox at 1 kHz:
throttle_boostThe boost is linear in the setting: 10 ms into the same step the motors are 69 over the throttle with 5 and 276
with 20. With 0 the motors get exactly the throttle, as before.
Size, over #12118
Flash +252 to +396 B, and 4 B more on F7 for the SRXL2 bytes now kept on every target (MATEKF722SE +280 B,
98.59 %), RAM +24 to +40 B. ITCM +16 B on F722 targets, +24 B on
MATEKH743, +64 to +72 B on KAKUTEF7/KAKUTEF7HDV (15 360 B, 93.75 %). All F405 targets build with both mixer PRs; the
fullest RAM is SYNERDUINOSTM_F405 at 84.24 %, and the two add 24 B of RAM and 8 B of CCM.
Testing
The unit tests pass. Not flown. Flight tests on a quad would be welcome, comparing 0 and 5 on punch-outs. The values to look at are
throttle_boostand, if needed,throttle_boost_cutoff.Log header
The blackbox header now carries
throttle_boostandthrottle_boost_cutoff, under the names Betaflight uses, so alog shows whether the boost was on and how strong it was (8f33325). MAMBAF722_2022B, a log from boot with the boost
at 50 and the cutoff at 20:
H throttle_boost:50,H throttle_boost_cutoff:20. +64 B of flash on MATEKF722SE(98.60 %).
blackbox_decodereads the log as before; the Blackbox Explorer's parser lists the new lineswith the other headers it does not use, such as
motor_pwm_rateandacc_notch_hz.