1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00
Commit graph

58 commits

Author SHA1 Message Date
Bruce Luckcuck
c06106e2d1 Split initialization from pid.c for flash savings
Move low performance requirements initialization code into pid_init.c and optimize that for size.

Saves 2688 bytes for target STM32F7X2.
2020-05-03 13:58:55 -04:00
Bruce Luckcuck
b0483d4669 Fix multi-range profile type adjustments
Fixes support for the multi-range method of configuring profile type adjustments that stopped working when "slots" were removed. Although this type of setup will now work again, the correct method is to have a single adjustment set to the full channel range.
2019-11-11 14:54:16 -05:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
mikeller
c6c4c3adf9 Fixed dispatch initialisation for persistent statistics. 2019-06-23 19:56:45 +12:00
mikeller
1920a61226 Some fixes for persistent stats. 2019-06-11 02:05:19 +12:00
mikeller
75b1c0d4ce Removed 'slots' from the adjustment range configuration. 2019-06-05 00:56:37 +12:00
mikeller
96386854eb Some cosmetic fixes to 'rc_adjustments.c'. 2019-05-04 22:22:08 +12:00
Krzysztof Matula
36c8f1e224 Flight statistics (odometer) added.
Supported counters:
- total flights count
- total flight time
- total flight distance (if GPS available)
2019-04-05 23:43:09 +02:00
Bruce Luckcuck
30672a37c5 Refactor OSD element display code
Remove the giant `select` block that contained all the code to generate the elements and transition them to individual functions called only when the element is active. Simplifies the code and results in a performance improvement as it's not necessary to fall through the large `select` statement for every element that will be drawn. The individual functions and the element to function mapping are moved to a new `osd_elements.c` file.

Moved the OSD related code files to a new `osd/` directory.

Also pre-analyze the active elements and only process those that are active. This also saves processing as it's not necessary to loop through all 50 or so elements when only a couple are active.

Various other cleanup and removal of stale or unnecessary code.

In the default configuration the element drawing phase of the OSD task is reduced from ~51us to ~35us - resulting in about a 30% decrease in processing time.
2019-02-21 14:03:25 -05:00
mikeller
18496fe745 Fixed unit tests using 'ledstrip.c'. 2019-01-21 01:01:05 +13:00
Pieter Kruger
4ec536a317 Add LED profile feature - 4278 2019-01-19 20:23:03 +10:00
mikeller
1771ea687f Fixed tests. 2018-12-16 11:28:04 +13:00
mikeller
53278c08f8 Fixed PID profile switching. 2018-12-15 22:53:12 +13:00
Pieter Kruger
8d981df1a9 Add OSD Profile feature - issue 4155 2018-12-01 17:51:38 +10:00
mikeller
bc09e929b5 Removed issue with sparse 'defaultAdjustmentConfigs' in adjustment ranges. 2018-11-13 01:29:02 +13:00
mikeller
570a0f7882 Changed RC rate minimum to be 0.01. 2018-11-05 23:27:42 +13:00
onelivesleft
de61371b17
Merge branch 'master' into patch-1 2018-09-25 22:53:21 +01:00
onelivesleft
d77e3d8a29 Increase MAX_ADJUSTMENT_RANGE_COUNT from 15 to 24
Since we are limited to only 4 aux channels, it would be good to increase this count in order to allow more multiplexing of data into fewer aux channels.  At 18 we can allow full PID editting for Roll+Pitch+Yaw using 1 aux channel.  24 leaves room above that... maybe 30 or 32 would be better?

Upped to 30 as per @etracer65's suggestion

increased PG_REGISTER_ARRAY version
2018-09-25 22:46:37 +01:00
Bruce Luckcuck
a38242bc2e More optimizations and changes from review
Split the "normal" and "absolute" adjustments into two separate lists to avoid iterating through entries twice.
2018-09-18 13:36:58 -04:00
Bruce Luckcuck
044648ca12 Optimize in-flight adjustments to only process configured ranges
Previously the logic would process all possible ranges defined by MAX_ADJUSTMENT_RANGE_COUNT even if some (or even all) ranges were not configured.  This change first builds a list of configured ranges and only processes thos entries.

Reduces CPU load by skipping unnecessary processing and minimizes the impact of increasing the number of available ranges.
2018-09-18 10:31:58 -04:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
Bruce Luckcuck
a1d3a0dba8 Add in-flight adjustments support for feedforward terms
Renamed/repurposed the "D Setpoint" adjustment to be "Pitch & Roll F Adjustment" and have it simultaneously adjust pitch and roll.

Renamed the "D Setpoint Transition" adjustment to be "Feedforward Transition" - no functionality changes.

Added adjustments for the individual Pitch, Roll and Yaw axes.
2018-07-21 10:26:25 -04:00
Bruce Luckcuck
17e76e48f6 PID controller feedforward
Restructures the PID controller to decouple feedforward from D.

Cleaned up the structure of the PID controller; moved some feature-based enhancements out of the main structure.

Feedforward becomes a separate component of the PID controller and there is now:
f_pitch
f_roll
f_yaw

The default values of 60 for pitch and roll matches the default setpoint weight used in BF3.4.  Yaw previously had no setpoint weight capability so the default here needs to be discussed.  Currently it's also set to 60 and flight testing seems positive.  Feedforward on yaw adds a lot of value so I don't think we want to default to 0.  Instead we need decide on the default.

All occurences of setpoint weight have been replaced by feedforward. "setpoint_relax_ratio" has been renamed to "feedforward_transition".

The pidSum now consists of P + I + D + F.

D has been added back for yaw (disabled by default with d_yaw = 0). We've found little need for D for normal quads but it may have value for other configurations - particularly tricopters.

Updated CMS menus to support adjusting the feedforward for each axis.

Changed the default for "rc_interp_ch" to be "RPYT".  Need yaw to be smoothed to support feedforward.

Open issues:

Needs BFC support
- Need to add support for the axis "F" gains.
- Remove "setpoint weight" slider.
- Rename "D Setpoint transition" to "Feedforward transition"

Needs BBE support
- Header "setpoint_relaxation_ratio" has been renamed "feedforward_transition"
- Header "dterm_setpoint_weight" has been replaced with an array named "feed_forward_weight".
  example: H feed_forward_weight:65,60,60    (R,P,Y)
- PID component "AXISF" has been added for all axes. Should be handled like P, I and D values.
- PidSum calculation needs to include F.

Needs LUA script support
- Support the renamed "setpoint_relax_ratio".
- Support for feedforward weight on all 3 axes.

Open code issues:
- rc_adjustments.c - support for adjusting feedforward weight for all axes. Currently only supporting roll - needs coordination with BFC.
2018-07-21 10:26:23 -04:00
Bruce Luckcuck
ef4a03507f Adjustments strings for OSD not kept in sync with enumeration causing invalid pointers
When the separate rc rates and rc expos for roll/pitch were added the descriptive names were never added to the OSD display strings array. Then later PID audio was added causing the array to be out of sync with the enumerated adjustment types.  This led to a corrupted pointer reference in the OSD display.

Also the adjustment display name used for the OSD display was never initialized so the pointer was pointing to random memory.

Removed the use of globals and changed to use "getter" functions.
2018-07-14 22:56:35 -04:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
supiiik
76e3e7aded dterm_setpoint_weight to uint16_t
dterm_setpoint_weight changet to uint16 with limit 0-2000
2018-05-23 08:39:45 +02:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
SteveCEvans
6f088d0fd2 Add PID adjustment from AUX transmitter channel (#5584)
* Scale PIDs using aux channels

* Add control via variables and documentation

* Use USE_TXPID

* Removed OWNER_TXPID

* Use PWM_RANGE_MIDDLE

* Fix typos

* Move Tx PID arrays into pidProfile_t

* Move macro to pidUpdateRate function

* Enable TXPID on REVONANO

* Add support for direct setting of adjustments from aux channel

* Change variable name from adjustmentScale to adjustmentScale to avoid confusion

* Update documentation

* Change variable name from adjustmentScale to adjustmentScale to avoid confusion

* Only adjust settings if adjustment channel has changed value

* Fix formatting

* Use pidAudioModes_e type in ADJUSTMENT_PID_AUDIO setting. Only allow absolute override of settings of ADJUSTMENT_MODE_STEP.

* Add example 6

* Fix checking of adjustment mode

* Fix USE_PID_AUDIO code. Broke SPRACINGF7DUAL.
2018-04-18 00:23:44 +12:00
Michael Keller
92d19e7be6
Merge pull request #3036 from cleanflight/spracingf7dual-pidaudio (#5586)
PID-Audio feature
2018-04-01 11:08:41 +12:00
Martin Budden
7acebf8b34 Increased number of rate profiles to 6 2018-01-31 09:21:53 +00:00
mikeller
ee65eba88d Added selectable RaceFlight rates. 2018-01-19 00:38:14 +13:00
mikeller
018c24fec2 Fixed range for setpoint_relax_ratio to avoid division by zero. 2018-01-14 12:12:54 +13:00
Martin Budden
671382234a Enabled switch fallthrough checking by compiler 2017-12-23 19:46:40 +00:00
Steffen Windoffer
cc3e0f7605 fix const adjustment lable 2017-12-21 23:18:26 +01:00
Steffen Windoffer
92f343909b remove some double const 2017-12-21 20:16:39 +01:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
f527455d34 Blackbox header tidy 2017-11-23 18:24:09 +00:00
Michael Keller
d2199b999a Removed now unused function 'isAnyAdjustmentFunctionBusy()'. 2017-11-13 10:52:06 +13:00
mikeller
fc28817448 Fixed up adjustment range OSD display and made it configurable. 2017-11-12 04:22:28 +13:00
mikeller
5f64bcfa09 Cleaned up some leftovers of the transition to 'USE_'. 2017-11-11 11:42:40 +13:00
Bjoern Schultze
03b1f5f54c show inflight adjustments in osd 2017-11-07 11:30:14 +01:00
mikeller
1ff9c27314 Fixed 'ifndef' cases for change to 'USE_<x>'. 2017-11-05 22:49:56 +13:00
Martin Budden
3d4f0bb137 Whitespace tidy 2017-07-05 06:36:22 +01:00
Dominic Clifton
db006b1585 Merge pull request #2856 from ledvinap/improvement-64bit-boxid
array based box masks
2017-06-19 13:31:08 +12:00
Martin Budden
23f158913e Moved time functions out of system.h into time.h 2017-05-26 14:03:28 +01:00
Martin Budden
71546410de Rearrange PID array to be array of PIDs 2017-05-06 11:06:47 +01:00
Martin Budden
9f07785e33 Tidy rc_adjustments 2017-03-29 15:56:37 +01:00
blckmn
c0d18280d5 Removed feature SDCARD and BLACKBOX
Now uses blackboxConfig()->device instead. Requires co-ordination with configurator.
2017-03-28 21:29:50 +11:00
toastedcornflakes
bf798d0b45 Declare in scope 2017-03-28 00:54:26 +02:00