mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 23:05:19 +03:00
Refactor Feedforward Angle and RC Smoothing - mashup of 12578 and 12594 (#12605)
* Refactor Feedforward Angle and RC Smoothing * update rc_smoothing at regular intervals * add Earth Ref to OSD, update pid and rate PG * Initialise filters correctly * refactoring to improve performance * Save 24 cycles in Horizon calculations, other optimisations At a cost of 40 bytes * save 25 cycles and 330 bytes in rc_smoothing * feedforward max rate improvements * typo fix * Karatebrot's review suggestions part one * Karatebrot's excellent suggestions part 2 * more efficient if we calculate inverse at init time Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de> * Horizon delay, to ease it in when returning sticks to centre * fix unit tests after horizon changes Co-Authored-By: 4712 <4712@users.noreply.github.com> * horizon_delay_ms, default 500 * fix unit test for feedforward from setpointDelta * Final optimisations - thanks @Karatebrot for your advice * increase horizon level strength default to 75 now we have the delay * restore Makefile value which allowed local make test on mac --------- Co-authored-by: Jan Post <post@stud.tu-darmstadt.de> Co-authored-by: 4712 <4712@users.noreply.github.com>
This commit is contained in:
parent
445758f3ec
commit
34057bfbc2
19 changed files with 558 additions and 856 deletions
|
@ -435,9 +435,6 @@ static const OSD_Entry cmsx_menuRateProfileEntries[] =
|
|||
{ "THR LIM TYPE",OME_TAB, NULL, &(OSD_TAB_t) { &rateProfile.throttle_limit_type, THROTTLE_LIMIT_TYPE_COUNT - 1, osdTableThrottleLimitType} },
|
||||
{ "THR LIM %", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.throttle_limit_percent, 25, 100, 1} },
|
||||
|
||||
{ "ROLL LVL EXPO", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.levelExpo[FD_ROLL], 0, 100, 1, 10 } },
|
||||
{ "PITCH LVL EXPO", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.levelExpo[FD_PITCH], 0, 100, 1, 10 } },
|
||||
|
||||
{ "BACK", OME_Back, NULL, NULL },
|
||||
{ NULL, OME_END, NULL, NULL}
|
||||
};
|
||||
|
@ -519,6 +516,7 @@ static CMS_Menu cmsx_menuLaunchControl = {
|
|||
static uint8_t cmsx_angleP;
|
||||
static uint8_t cmsx_angleFF;
|
||||
static uint8_t cmsx_angleLimit;
|
||||
static uint8_t cmsx_angleEarthRef;
|
||||
|
||||
static uint8_t cmsx_horizonStrength;
|
||||
static uint8_t cmsx_horizonLimitSticks;
|
||||
|
@ -567,6 +565,7 @@ static const void *cmsx_profileOtherOnEnter(displayPort_t *pDisp)
|
|||
cmsx_angleP = pidProfile->pid[PID_LEVEL].P;
|
||||
cmsx_angleFF = pidProfile->pid[PID_LEVEL].F;
|
||||
cmsx_angleLimit = pidProfile->angle_limit;
|
||||
cmsx_angleEarthRef = pidProfile->angle_earth_ref;
|
||||
|
||||
cmsx_horizonStrength = pidProfile->pid[PID_LEVEL].I;
|
||||
cmsx_horizonLimitSticks = pidProfile->pid[PID_LEVEL].D;
|
||||
|
@ -621,6 +620,7 @@ static const void *cmsx_profileOtherOnExit(displayPort_t *pDisp, const OSD_Entry
|
|||
pidProfile->pid[PID_LEVEL].P = cmsx_angleP;
|
||||
pidProfile->pid[PID_LEVEL].F = cmsx_angleFF;
|
||||
pidProfile->angle_limit = cmsx_angleLimit;
|
||||
pidProfile->angle_earth_ref = cmsx_angleEarthRef;
|
||||
|
||||
pidProfile->pid[PID_LEVEL].I = cmsx_horizonStrength;
|
||||
pidProfile->pid[PID_LEVEL].D = cmsx_horizonLimitSticks;
|
||||
|
@ -678,6 +678,7 @@ static const OSD_Entry cmsx_menuProfileOtherEntries[] = {
|
|||
{ "ANGLE P", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_angleP, 0, 200, 1 } },
|
||||
{ "ANGLE FF", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_angleFF, 0, 200, 1 } },
|
||||
{ "ANGLE LIMIT", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_angleLimit, 10, 90, 1 } },
|
||||
{ "ANGLE E_REF", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_angleEarthRef, 0, 100, 1 } },
|
||||
|
||||
{ "HORZN STR", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_horizonStrength, 0, 100, 1 } },
|
||||
{ "HORZN LIM_STK", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_horizonLimitSticks, 10, 200, 1 } },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue