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

386 commits

Author SHA1 Message Date
rav-rav
5530eb3eb5
Merge branch 'master' into airmode_fix 2018-10-25 11:13:54 +02:00
rav
fe41edd188 fix incorrect throttle offset in airmode 2018-10-24 20:38:30 +02:00
Bruce Luckcuck
4636f10385 Prevent MOTOR_STOP auto-disarm for stick arming when GPS Rescue is active
The MOTOR_STOP logic is designed to stop the motors if:
1. MOTOR_STOP feature is enabled
2. Airmode is disabled
3. Throttle is at minimum

The problem is that this also applied during GPS Rescue and if the pilot had these conditions the motors would stop. Changed to disable MOTOR_STOP while GPS Rescue is active.

Also if stick-arming is used the MOTOR_STOP logic also will auto-disarm after 5 seconds (auto_disarm_delay). Disable this also when GPS Rescue is active.
2018-10-24 11:28:04 -04:00
mikeller
feaa082ac3 Fixes from review. 2018-10-24 02:02:59 +13:00
mikeller
817bb2ed86 Rename 'isAirmodeActive()' to 'airmodeIsEnabled()'. 2018-10-23 01:09:17 +13:00
Bruce Luckcuck
79abfb05fb Refactor mixer motor_stop handling - reduces flash usage
Rearranges the placement of the motor_stop handling logic in relationship to the motor output calculations.

Saves 4124 bytes of flash on F3.
2018-10-18 17:32:27 -04:00
jflyper
120b67647b More strict application of USE_SERVOS in mixer.c 2018-10-08 12:43:38 +09:00
Michael Keller
b057ce550d
Merge pull request #6798 from etracer65/3d_deadband_fix
Fix zero throttle deadband when using switched 3D modes
2018-09-20 20:58:00 +12:00
Bruce Luckcuck
325ba33a3f Fix zero throttle deadband when using switched 3D modes
When using switched 3D modes the throttle stick ranges from 0-100% controlling the motors in only one direction. The problem was that the 3D Throttle Deadband was being applied to the minimum throttle making a much larger throttle deadband from zero throttle.  So in the case of the default deadband of 50, the throttle stick movement would be equivalent to 100us of deadband (output is halved so requires double the input).  This would be like trying to fly with `min_check` set to 1100.

The fix uses `min_check` to set the deadband when in switched 3D modes. This produces the same throttle deadband as normal non-3D flight.
2018-09-18 20:39:04 -04:00
ctzsnooze
37da70c555 rebase and recheck 2018-09-15 12:19:53 +10:00
borisbstyle
00dbaf9fa7 Cleanup code // add unittestst for iterm windup 2018-09-10 23:38:39 +02:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
mikeller
6de1c32d9d Added shadow copies for CLI and MSP. 2018-08-21 00:36:47 +12:00
mikeller
c99629bbf1 Removed calls to (latching) 'feature()'. 2018-08-21 00:35:55 +12:00
jflyper
da05e4e7f7 Fix A-Tail mixer typo (again) 2018-07-28 01:59:27 +09:00
jflyper
b909fa2a3f Fix mixer for A-Tail 2018-07-22 20:15:53 +09:00
ctzsnooze
4c917efa50 Smooth anti gravity 2018-07-21 23:49:41 +12:00
Michael Keller
c6c3d0b5af
Merge pull request #6235 from etracer65/throttle_angle_correction
Fix throttle angle correction when smoothing throttle; reduce processing overhead
2018-06-30 18:46:51 +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
Bruce Luckcuck
9868557c11 Revise GPS Rescue throttle and yaw handling to not modify rcCommand
Injecting new values directly into rcCommand to override pilot inputs does not work correctly when rc interpolation or smoothing is enabled. This is because the smoothing functions maintain an internal state that is used to produce the final rcCommand values. So in effect it re-overrides the values set by GPS Rescue.

Additionally, modifying rcCommand directly is undesirable because:
- It happens before rates are applied. So the pilot's rates will effect the control commanded by GPS Rescue.
- rcCommand values are used for more than input in the flight control. They also are used for stick commands, etc.
- In the case of throttle, various modifications can be additionally applied like throttle boost and throttle limit that may negatively effect GPS Rescue.

These changes revise the logic to only modify the commanded values used in the PID controller (yaw) and mixer (throttle) rather than attempting to override rcCommand.
2018-06-27 10:37:52 -04:00
mikeller
a373204d7a Added validation checks for interpolation settings, made throttle boost conditional. 2018-06-05 18:38:57 +12:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
Andrey Mironov
3733640c08 Changed NOINLINE to be applied conditionally on ITCM presence 2018-05-23 16:34:01 +03:00
Andrey Mironov
d8dd6f29f8 Set FAST_RAM to go into .fastram_data by default. Added FAST_RAM_NOINIT 2018-05-23 14:40:33 +03:00
blckmn
88ed243d32 Made the timerioTagGetByUsage zero based, as it is not used by users. 2018-05-06 09:37:19 +10:00
blckmn
aad6efdf03 Timer clean up in preparation for configurable timers 2018-05-06 06:55:17 +10:00
Bruce Luckcuck
809c2a950b Update RPM data in smartport and frsky_hub telemetry
Both previously displayed eRPM.  frsky_hub RPM data is constrained to int16 so the value sent is RPM/10.

Updates per review and function renaming
2018-05-04 07:53:18 -04:00
Bruce Luckcuck
063f3829d4 Display ESC telemetry as real RPM in the OSD
The telemetry data provides eRPM/100.  Added a `motor_poles` parameter (defaulting to 14) that is used to calculate the physical RPM.

RPM = (telemetry_rpm * 100) / (motor_poles / 2)

Most motors we commonly use are 14 poles, but the user can adjust if needed for their setup.

Also calculate actual RPM for DEBUG_ESC_SENSOR_RPM, but to fit with in int16 the log value will be RPM/10.
2018-05-04 07:51:16 -04:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
Bruce Luckcuck
0a0add8c56 Yaw spin recovery optimize (#3)
* PID controller unittest

* Clean code for yaw spin recovery

* Yaw spin recovery optimizations

* Flash size optimizations, use 50% throttle when airmode is off, and override pidsum_limit_yaw

Also rebasing from betaflight/master
2018-04-24 14:02:36 +12:00
ctzsnooze
41fb37a264 Clean code for yaw spin recovery 2018-04-24 13:51:06 +12:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Andrey Mironov
bf984f39b1 F7 optimizations (#5674)
* Revert "Revert "Rewritten F7 dshot to LL (draft)" (#5430)"

This reverts commit aa42a69d2f.

* Reworked F7 linker scripts to maximize performance of both F74x and F72x

* Some comments and changes from original F7 HAL DSHOT

* Prohibit inlining of some functions to place them in ITCM-RAM

* Fixed usartTargetConfigure implicit declaration

* Moved back to SRAM1 as main RAM

* Added SRAM2 attribute

* Fixed LL DSHOT FOR SPRF7DUAL and probably other adv TIM users

* Fixed SPRF7DUAL rev. A motor order

* Enabled CCM for data on F40x

* Fixed F7 startup assembly symbols

* Fixed KISSFCV2F7 linker script

* Added a quick way of building F7 targets only

* Got rid of the useless F7 target script

* Added NOINLINE and got rid of useless __APPLE__ define

* Added some important functions to ITCM

* Added NOINLINE macro for tests

* Copy to ITCM before passing execution into it

* Minimized cache footprint of motor output code

* Evicted low-impact functions from ITCM

* Switched MATEKF722 and SPRACINGF7DUAL to burst DSHOT

* Switched CLRACINGF7 to burst DSHOT

* Moved UART RX&TX buffers to DTCM-RAM to avoid cache incoherency

* Marked taskMainPidLoop for ITCM-RAM, disallowed inlining per-function

* Revert "Added a quick way of building F7 targets only"

This reverts commit 2294518998.
2018-04-20 08:37:32 +12:00
Miroslav Drbal [ApoC]
045557561d Optimized the PID loop a little bit (#5661)
* * Put PID variables into the structure
* Precalculate DTerm gyro filter outside the axis loop
* Removed unused variables PIDweight[3], airmodeWasActivated
* If zero throttle or gyro overflow, we can just set values and exit, this saves checks and jumps in axis loop
* Compute PIDSUM after the axis loop, this saves branching inside the loop because of Yaw has no D term

* * Incorporated review changes from DieHertz and fujin

* * Incorporated another review requests from DieHertz
  - PidSum renamed to Sum
  - pidData[3] redone to pidData[XYZ_AXIS_COUNT]
2018-04-11 08:22:51 +12:00
Bryce Johnson
588addd6dd added crashflip_motor_percent. This will use the other motors while doing a turtle. (#5600) 2018-04-06 20:24:48 +12:00
borisbstyle
194248f804 Cleanup mixTable 2018-04-06 07:16:39 +02:00
Bruce Luckcuck
7bc600d651 Throttle limit feature (#5608)
Adds new throttle_limit_type and throttle_limit_percent parameters that allow the pilot to limit the maximum commanded throttle seen by the flight controller by either scaling or clipping the maximum throttle.  The default is 100 representing no limiting.  So as an example, if a pilot was to set throttle_limit_type = SCALE and throttle_limit_percent = 80 the throttle input would scale from 0 to 80% based on full stick deflection from the radio.

This capability replaces the method of limiting throttle in the radio which some pilots are using to manage throttle on tight courses or reduce overall battery consumption when the extra power isn't needed.

There is no effect on the maximum throttle seen by the motors so the mixer still has full authority.
2018-04-05 16:01:28 +12:00
Teracis
45e64edb0b Removed mixer halving in 3D mode. (#5582) 2018-03-31 13:43:16 +13:00
joelucid
efda704ee5 Throttle boost (#5508)
* throttle boost which temporarily boosts throttle in both directions to improve response

* fix comment and use pt1FilterGain

* incorporate review suggestions

* incorporate review suggestions

* use float constant to avoid double promotion

* formatting changes

* formatting change

* hopefully last style changes
2018-03-25 11:33:22 +13:00
Austin
4d3666b77b Fix for minthrottle when feature 3D and PWM enabled (#5102)
* Fix for minthrottle when feature 3d and pwm enabled

* add parameters for min and max 3d output

* bug fix

* remove new parameters from msp

* remove new parameters again

* fixed indentation
2018-03-09 06:44:17 +13:00
bkeinert
5d3c3b766b extend crash-flip mode (#5163)
* extend crash-flip mode

* size optimizations

* adjust cosine threshold

* adjust deadband to 15%
2018-03-04 11:37:01 +13:00
Michael Keller
3dddb17e35
Merge pull request #5179 from mikeller/unify_3d_switches
Unified `BOX3DDISABLE` and `BOX3DONASWITCH` switches.
2018-02-18 03:21:20 +13:00
mikeller
7192e9de19 Fixed parameter group violations in motorDevConfig_t, incremented EEPROM config version before 3.3.0 release. 2018-02-15 18:25:28 +13:00
mikeller
232fc4e8de Unified BOX3DDISABLE and BOX3DONASWITCH switches. 2018-02-13 20:02:02 +13:00
jflyper
9475988218 Make burst and non-burst runtime configurable 2018-02-11 23:24:07 +09:00
Bruce Luckcuck
fba0b2cea3 Optimze pidSum calculation by storing the value rather than recalculating in multiple places.
Saves 72 bytes. Will save at least that additionally when incorporated into Runaway Takeoff Prevention (which also calculates the pidSum in two places).

Additionally adds a slight performance improvement by not repeating the floating point additions to calculate the pidSum in multiple places.  Effectively replaces 2 calculations with 1 (4 with 1 with Runaway Takeoff Prevention).
2018-01-30 09:58:41 -05:00
Martin Budden
ccb49583e9 Add hooks for triflight 2018-01-20 13:59:45 +00:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
de5b0d53ff Enabled Instruction TCM 2017-12-17 13:41:51 +00:00
Martin Budden
a33a82725e Add fast RAM support, CCM or TCM depending on processor 2017-12-16 17:42:35 +00:00