1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00
Commit graph

730 commits

Author SHA1 Message Date
ctzsnooze
68dd061c51
Minor pid.c refactoring (#12722)
* Minor pid.c refactoring

* Only calculate unfiltered gyro delta for that debug

Remove unnecessary comment
Change multiplier to factor of 10

* remove some archaic comments

* clarify name of D_LPF_PRE_TPA_SCALE, use inverse in define

* Remove some blank lines

* undo conversion to division thanks -ffast-math
2023-05-11 17:06:36 +02:00
Jan Post
460e4d00fe
Lead-Lag Compensator (#12730)
* Implement Lead-Lag-Compensator

* Refactoring / Clean up

* Remove trailing whitespaces
2023-05-03 10:01:36 +02:00
ctzsnooze
34057bfbc2
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>
2023-04-23 22:03:18 +02:00
Mark Haslinghuis
567d3dd2e5
Fix Mercury G4 and fix TODO for PID_PROCESS_DENOM for all targets (#12611)
* Fix Mercury G4

* Changes after #12632

* Fix TODO for PID_PROCESS_DENOM
2023-04-11 04:52:00 +10:00
ctzsnooze
b54ae921fc
update pid.c PG to 7 (#12619) 2023-04-08 05:32:26 +10:00
ctzsnooze
241e9a9b94
Angle and Horizon Mode improvements (#12231)
* Angle and Horizon Update for 4.5

* BugFix FF noise Angle Mode on yaw and in level _race mode

* use time constant in ms for angle feedforward smoothing

* refactor to remove unnecessary definition

---------

Co-authored-by: ChrisRosser <chrisrosser91@gmail.com>
2023-03-15 09:46:24 +11:00
tbolin
0c7061016f
Make dyn idle startup increase configurable (#12432)
* Make dyn idle startup increase configurable

Replace fixed 5 percent max increase from dynamic idle
when airmode is active with a configurable value.

-Default value is still 5.0 percent (50 in cli)
-Add dyn_idle_start_increase cli setting
-Add dyn_idle_start_increase BB header field

* Increse PG reset to ver 6 for pidProfile

* Indentation

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-03-09 23:21:14 +01:00
Dominic Clifton
738ed32cff
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.
2023-01-11 06:33:06 +11:00
haslinghuis
139210e403
Fix TPA (#11969) 2022-11-09 21:18:14 +11:00
haslinghuis
7e441b5f4f
Merge pull request #11887 from KarateBrot/styledef
Remove old style definitions
2022-10-16 00:22:02 +02:00
haslinghuis
b84b8c1ca5
Merge pull request #11097 from mathiasvr/stdlib-abs
Use std abs() instead of ABS() macro
2022-10-14 00:37:29 +02:00
haslinghuis
cbbc80ee90
Merge pull request #11779 from haslinghuis/update-pidprofile
Move TPA to PID profile
2022-10-13 21:09:49 +02:00
KarateBrot
ddf1d46549 Remove old style definitions 2022-10-13 03:33:54 +02:00
Tobias Bolin
c61efe1e2e Make Anti-windup affect anti gravity coefficient 2022-10-12 21:58:43 +02:00
Mathias Rasmussen
61ded491cd Use std abs() instead of ABS() macro
Changes uses of ABS() macro to <stdlib.h> abs() and <math.h> fabsf()
2022-10-12 19:49:03 +02:00
Mathias Rasmussen
9957ceb275 Fix function brace style 2022-10-12 16:31:55 +02:00
ctzsnooze
db528ccc8f Restore iTerm Windup to all axes, active by default 2022-08-22 10:03:55 +10:00
Mark Haslinghuis
f7547192b1 Move TPA to PID profile 2022-08-08 00:07:21 +02:00
ctzsnooze
6aaaf727ff update antigravity for 4.4, no boost on yaw
Update to anti-gravity, including removal of the old Step mode, ability to adjust the P contribution (thanks @Limon), PT2 smoothed derivative model, inherent limiting of P boost during extremely fast stick travels to minimise P oscillations, less I during the middle of a throttle up, no I boost on yaw, add hz to cutoff labels

No antigravity on yaw, fix longstanding typo

h
2022-07-25 11:37:07 +10:00
KarateBrot
0186a7b88d Fix debug mode D_LPF 2022-07-09 03:59:16 +02:00
Štěpán Dalecký
f85ebba6a4 Refactoring of IMU and ACC 2022-06-28 18:26:10 +02:00
J Blackman
00cd0e52e6
Merge pull request #11126 from mathiasvr/pr-int-exp
Use macros for power with integer exponents
2022-06-28 15:28:35 +10:00
Steve Evans
701b0ae55c Remove F1 and F3 support 2022-06-14 19:10:13 +01:00
ctzsnooze
2262dfc60e use Throttle Setpoint, not rcDATA(throttle), for TPA 2022-01-25 18:37:01 +11:00
Mathias Rasmussen
87c259a26e Fix use of floating point math functions 2021-12-21 04:18:59 +01:00
Ivan Efimov
d5c31accdf FW sliders: separate MSP commands for requesting calculations but not applying them into the FW 2021-12-19 04:00:50 -06:00
Mathias Rasmussen
1b95e3c20f Use macros for power with integer exponents 2021-12-14 11:53:09 +01:00
DusKing1
2f52855a91 fix cpu over flow on g4 when pid rate set to higher than 4k 2021-12-02 08:49:03 +08:00
ctzsnooze
e702443730 include lpf1 and make Dterm Static behaviour consistent with gyro static
white to force re-check
2021-10-25 09:21:15 +11:00
ctzsnooze
7da04d6bea set feedforward max rate limit to 90 2021-10-08 17:49:28 +11:00
ctzsnooze
898fe30924 set default iterm_windup to 85 for yaw 2021-09-28 10:33:01 +10:00
ctzsnooze
99a7479b8c consistent gyro and dterm filter names 2021-09-27 09:12:00 +10:00
ctzsnooze
90a2057179 pid slider support with changed defaults 2021-09-26 15:05:05 +10:00
Michael Keller
7a8b40a670
Merge pull request #10777 from ctzsnooze/move-feedforward-transtion-calculation 2021-09-04 16:56:37 +12:00
ctzsnooze
ff19f3fecb D_min smoothing changed to PT2 and re-tuned 2021-08-31 11:37:33 +10:00
ctzsnooze
5863015354 ifdef condition consistently applied, field names consistent, pg ID updated 2021-08-30 09:33:12 +10:00
ctzsnooze
28d9d778a6 feedforward transition moved to feedforward.c 2021-08-30 02:07:36 +10:00
Michael Keller
86aa5cc84e
Merge pull request #10778 from ctzsnooze/Allow-feedforward-in-Level-and-Horizon 2021-08-30 01:20:03 +12:00
Michael Keller
6aa40c1272
Merge pull request #10805 from ctzsnooze/feedforward-fix-at-centre-and-renaming 2021-08-04 12:59:41 +12:00
Michael Keller
b613cc2a7d
Merge pull request #10781 from ctzsnooze/fix-error-horizon-code 2021-08-04 01:37:28 +12:00
ctzsnooze
45ff9ea1e5 fixes for feedforward for 4.3 2021-08-03 23:32:34 +10:00
ctzsnooze
15a60b9e1f allow feedforward in level modes 2021-07-26 15:29:25 +10:00
ctzsnooze
8b73c5242b Default yaw lowpass to 100hz 2021-07-17 21:02:33 +10:00
ctzsnooze
bfb8954a43 small bug in horizon code 2021-07-01 14:13:11 +10:00
ctzsnooze
3b62b2e5d4 add PT2 and PT3 lowpass filter options 2021-05-18 09:59:27 +10:00
ctzsnooze
636d563abe major rc changes ctzsnooze 2021 2021-05-07 14:40:43 +10:00
Michael Keller
a53f2a60a5
Merge pull request #10711 from mikeller/remove_powerf
Remove unneeded library function 'powerf()'.
2021-04-28 01:28:43 +12:00
ctzsnooze
d4f0ec2d0a feed forward jitter improvements 2021-04-27 12:47:06 +10:00
mikeller
6b87b3685c Remove unneeded library function 'powerf()'. 2021-04-26 16:50:54 +12:00
ctzsnooze
a096c99664 PT2 and PT3 filter maths PT3 for RC smoothing 2021-04-26 14:12:54 +12:00