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

323 commits

Author SHA1 Message Date
mikeller
53278c08f8 Fixed PID profile switching. 2018-12-15 22:53:12 +13:00
jflyper
569f0bae62 Implement configurable system clock generation
PLL-HSE working

PLL-HSI working

Move SystemCoreClockUpdate in SystemInit to end

Switching from HSI-PLL to HSE-PLL (and back) is working

It works during various levels of overclocking.

Renamed CLI variable hse_mhz to system_hse_mhz

Restored the original position of the spectrum bind code

The internal logic of the spectrum bind code will prevent binding
process to fire if executed after soft reset.

Remove stale call to delay

Add a comment about call to spektrumBind placement

Declared SystemXXXSource functions, handled sign-ness warning.

Cleaned up commented out sections

USB clock generation for F446

Default HSE value for backward compatibility

Cleaned up more unused stuff

Handle non-F4 targets

Added comment about PLL_M selection

Removed fake gyro/acc from test target
2018-11-23 15:36:10 +13:00
mikeller
2ecfb1d183 Completely drop suspension for serial RX - there is no point since we do not use preemptive multitasking. 2018-09-04 01:09:57 +12:00
Alex Wolf
7115ab4047 GPS over MSP related fixes 2018-08-31 22:31:56 -04:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
mikeller
6a77c5f576 Removed OSD_SLAVE defines. 2018-08-23 23:03:22 +12:00
Michael Keller
c12981f732
Merge pull request #6617 from etracer65/gyro_lpf_updates
Disable DLPF EXPERIMENTAL mode for MPU60x0; remove experimental support from F3
2018-08-23 22:25:48 +12:00
Bruce Luckcuck
0e8e5b3c16 Disable DLPF EXPERIMENTAL mode for MPU60x0; remove experimental support from F3
Officially Invensense lists the experimentl mode as "unsupported" on the MPU60x0 series. Previously it was added to allow testing.  It's been determined that it's not a viable gyro filtering operational mode.

Also change "experimental" DLPF support available for F4 or higher. Few F3 boards have gyros that can use this mode anyway.  Saves 200 bytes.
2018-08-22 09:50:10 -04:00
mikeller
8a72362a67 Fixed tests. 2018-08-21 00:36:47 +12:00
mikeller
6de1c32d9d Added shadow copies for CLI and MSP. 2018-08-21 00:36:47 +12:00
Bruce Luckcuck
382ad2ad8f More changes from review & rebase
Simplified disable logic to only use the feature() check in the gyro loop.

Changed 2000hz loop time constant to a define.
2018-08-01 12:20:32 -04:00
Bruce Luckcuck
25c6b038d9 Changes from review
Used HZ_TO_INTERVAL_US() instead of hardcoded 500us.

Moved tests into a dedicated function.
2018-07-31 10:37:01 -04:00
Bruce Luckcuck
f411b82eb6 Disable DYNAMIC_FILTER feature if gyro loop is less than 2KHz
The dynamic filter is not usefull with gyro loop times less than 2KHz so disable the feature and prevent the code from running in this circumstance.

In `isDynamicFilterActive()` we can't just rely on the feature because the feature will be disabled after the gyro has initialized and is running - possibly running into the underflow/wedging problem. And unfortunately we can't disable the feature earlier because we need to know the `targetLooptime` which is determined during gyro init.
2018-07-31 10:37:01 -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
mikeller
3f082b569b Fixed broken targets. 2018-07-01 21:37:40 +12:00
mikeller
93ab648183 Added disabling of GPS_RESCUE when 3D is enabled. 2018-07-01 21:33:32 +12:00
mikeller
b308eef6e9 Made it more positive. 2018-07-01 19:14:31 +12:00
mikeller
fb83ea4b52 Fixed conditions for RC smoothing validation. 2018-07-01 16:35:05 +12:00
Bruce Luckcuck
5cd886017d Fix throttle angle correction when smoothing throttle; reduce processing overhead
Change the logic to not modify rcCommand directly and instead apply the additional throttle directly in the mixer.

Also move the logic to the attitude task instead of having it calculate in the PID loop. The logic relies on an angle that's only updated in the attitude task so there was no point in running the calculation every PID loop.
2018-06-28 15:56:01 -04:00
jflyper
8f65a79789 Remove RX_PARALLEL_PWM originated feature validation based on pins 2018-06-20 11:04:02 +09:00
mikeller
391d6a4185 Fixed SPRACINGF3OSD. 2018-06-05 21:43:17 +12:00
mikeller
f9cfa86378 Fixes from review. 2018-06-05 18:47:41 +12:00
mikeller
a373204d7a Added validation checks for interpolation settings, made throttle boost conditional. 2018-06-05 18:38:57 +12:00
mikeller
532e8afe61 Fixed dumping of profile values in CLI. 2018-06-02 21:01:22 +12:00
mikeller
7e8f261436 Implemented 'beacon' command in CLI. 2018-05-31 01:48:27 +12:00
mikeller
2c3bf6ad2d Removed 'PREFERRED' beeper settings. 2018-05-30 00:50:55 +12:00
mikeller
464da66ee1 Reset the entire config when parameter groups have changed. 2018-05-27 19:51:26 +12:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
Michael Keller
81d265b481
Merge pull request #5862 from s0up/nav-removal
[GPS RESCUE] - Remove navigation.c and all references to USE_NAV
2018-05-12 11:51:21 +12:00
Steffen Windoffer
06178454c2 remove unused swap serial define 2018-05-11 21:04:38 +02:00
s0up
de5fa47c4c navigation feature / reference removal 2018-05-09 10:28:36 -07:00
blckmn
aad6efdf03 Timer clean up in preparation for configurable timers 2018-05-06 06:55:17 +10:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
jflyper
22a7788fa3 Reset beeper_frequency if valid timer is not found 2018-04-24 08:02:51 +09:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Michael Keller
0fd6d5d74e
Fixed priority of RSSI validation: ADC / RX channel / frame errors. (#5703) 2018-04-19 21:06:21 +12:00
Michael Keller
e0dcea4d48
Added checks for ESC_SENSOR feature being enabled when reading ESC sensor data. (#5663) 2018-04-11 23:31:14 +12:00
Michael Keller
6cfec6fc53
Added config checks for the RSSI config. (#5644) 2018-04-11 19:31:57 +12:00
etracer65
062ef77276 Rework gyro sample rate and DLPF configuration and expose additional filter cutoffs (#5483)
The old gyro_lpf setting was based on the DLPF_CFG values for the MPU6050 gyro and the enumeration was inaccurate and misleading.  For example, the default "OFF" setting did not disable the DLPF, but actually set it to around 250hz.  The actual cutoff frequency for each setting varies by gyro hardware so the literal frequencies in the enumeration were also incorrect.

Removed gyro_lpf and replaced it with gyro_hardware_lpf (8KHz) and gyro_32khz_hardware_lpf (32KHz).  The parameters were renamed to indicate that they are hardware filtering options to differentiate from the many software lowpass filtering options.

gyro_hardware_lpf - This parameter sets the filtering and sample rate options for 8KHz gyros (or 32KHz capable gyros running in 8KHz mode).

- NORMAL - default setting that is equivalent to the previous "OFF" setting.  Configures 8KHz sampling with ~250Hz filter cutoff.
- EXPERIMENTAL - 8KHz sampling with a higher frequency filter cutoff (around 3000hz).  Considerably more noisy and requires additional software filtering.  Note that for the MPU6000 Invensense doesn't officially document the filter cutoff frequency for this selection and simply lists it as "reserved".  In testing it's clear that a higher frequency filter cutoff is being selected due to the increased noise, but the actual cutoff frequency is unknown.
- 1KHZ_SAMPLING - 1KHz sample rate with and approximate 188Hz filter cutoff.

Note that the following additional 1KHz sample rate options with lower filter cutoffs have been eliminated - "98HZ", "42HZ", "20HZ", "10HZ", "5HZ".  It seems unlikely that these are still needed are probably no longer viable and flight performance would be very poor.

gyro_32khz_hardware_lpf - This parameter sets the filtering options while running in 32KHz mode on capable gyros.  It also exposes a new high frequency filter cutoff mode.

- NORMAL - The default and matches the current settings used for 32KHz mode.  Provides a filter cutoff around 3000Hz.
- EXPERIMENTAL - Selects a filter cutoff around 8000Hz.  This is a very noisy setting and will require substantial software filtering.

The default values for both 8KHz and 32KHz sample rates were chosen to match the previous defaults and users should not experience any performance differences.

Normalized the gyro initialization.  Previously there was little consistency on how the initialization was performed and the settings interpreted.  For example, MPU9250 used a completely different logic tree when configuring the registers.

Disconnected the literal parameter value from the gyro initialization.  The gyro_lpf parameter contained a number from 0-7 that was literally applied to the configuration register during the gyro initialization.  This caused some older gyro initializations to be incorrect as they used a different register layout (MPU3050 and L3G4200D).  By transitioning to a logical selection the actual value applied to the hardware register is abstracted.  This will better future-proof the design as new gyros may have a different register structure that may be incompatible with the old method.

Added a gyroregisters command to the CLI that is used to read the current register settings from the gyro and dump them to the CLI.  This is used to verify the configuration in comparison to the datasheets for the various gyros.  Testing empirically by looking at the relative noise from the gyros can give a rough estimate whether the different options are selecting correctly, but it's not very precise.  The code for the gyroregisters CLI command is wrapped inside #ifdef USE_GYRO_REGISTER_DUMP blocks to allow easy disabling.  It's currently enabled for all targets but we may decide to disable before release or only limit to targets with more available space (>=F4).
2018-03-22 14:02:30 +13:00
jflyper
416495e17a Convert BEEPER to USE_ scheme (#5433) 2018-03-11 09:28:08 +13:00
Michael Keller
9bcc6aca8e
Revert "BEEPER Conversion to use USE_ scheme" (#5368) 2018-03-04 09:40:17 +13:00
jflyper
ea0db878bf Convert to USE_ scheme 2018-03-02 22:29:40 +09:00
Andrey Mironov
ac26c975dd Adjustable OC for F405 and F411 2018-02-17 14:12:16 +03:00
mikeller
ee65eba88d Added selectable RaceFlight rates. 2018-01-19 00:38:14 +13:00
Martin Budden
740234c909 Fix F1 builds 2018-01-11 09:35:08 +00:00
mikeller
09d396c05c Cleaned up parameter group handling.
Fixed missing include.
2017-12-31 10:51:01 +13:00
mikeller
f6bdfd91e2 Moved beeper parameter groups to pg/. 2017-12-24 17:56:37 +13:00
Michael Keller
351294d19a
Merge pull request #4835 from mikeller/move_vcd_to_pg
Moved vcd parameter group to `pg/`.
2017-12-24 16:13:59 +13:00
mikeller
2d930b28ce Moved vcd parameter group to pg/. 2017-12-24 15:13:48 +13:00
mikeller
b928950598 Moved rx drivers into drivers/rx/. 2017-12-24 13:55:18 +13:00