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

169 commits

Author SHA1 Message Date
mikeller
ce4a95f33d Merge branch 'gps_rescue_update_fix' of https://github.com/codecae/betaflight 2018-06-17 02:04:24 +12:00
Steffen Windoffer
b5a34603fe remove double transponder update call 2018-06-16 00:23:21 +02:00
Curtis Bangert
8950eb1f68 Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy. 2018-06-14 02:21:12 -04:00
Michael Keller
4ead807edd
Revert "Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy." 2018-06-14 13:25:52 +12:00
Curtis Bangert
953e2ad0e9 Moved updateGPSRescueState to imuUpdateAttitude. gps_rescue.c tidy. 2018-06-13 11:36:49 -04:00
Bruce Luckcuck
1e6e9e719f Add guard time between dshot beacon and arming/disarming
Tries to prevent DSHOT beacon commands from interfering with commands to set the motor direction.

Adds a 2 second delay after disarming before DSHOT beacon commands will be sent. This attempts to prevent the beacon commands from interfering with the motor direction reset that happens after using crash flip mode.

During arming if a DSHOT beacon command has been sent within 2 seconds the arming will be delayed until the 2 seconds have passed. This attempts to prevent interference with the motor direction commands sent at arming.
2018-06-09 18:59:59 -04:00
Thorsten Laux
fefedbd686 attempts to improve relax
attempts to improve relax fix

attempts to improve relax fix

bug fixes

spaces

changed settings and added isAirmodeActive()

fix rebase error
2018-06-08 21:01:46 +12:00
Bryce Johnson
0045b36320 Added blocked dshot commands, Added post command delay
Moved the dshotcommand to happen in pwm_output_dshot.
Simplified the timing and repeats to happen on a group basis instead works better for dshotburst
2018-06-01 21:56:11 +12:00
Bruce Luckcuck
9b43839052 Acro trainer
Adds a new angle limiting mode for pilots who are learning to fly in acro mode. Primarily targeted at new LOS acro pilots, but can be used with FPV as well.

The feature is activated with a new mode named "ACRO TRAINER". When the feature is active, the craft will fly in normal acro mode but will limit roll/pitch axes so that they don't exceed the configured angle limit. New pilots can start with a small angle limit and progressively increase as their skills improve.

The accelerometer must be enabled for the feature to be configured and function.

Also the feature will only be active while in acro flight and will disable if ANGLE or HORIZON modes are selected.

For most users all they need to do is simply configure the new mode to be active as desired on the "Modes" tab in the configurator and configure the desired angle limit in the cli.

Configuration parameters:

acro_trainer_angle_limit: (range 10-80) Angle limit in degrees.

acro_trainer_lookahead_ms: (range 10-200) Time in milliseconds that the logic will "look ahead" to help minimize overshoot and bounce-back if the limit is approached at high gyro rates. The default value of 50 should be good for most users. For low powered or unresponsive craft (micros or brushed) it may be helpful to increase this setting if you're seeing substantial overshoot.

acro_trainer_debug_axis: (ROLL, PITCH) The axis that will log information if debugging is active.

To enable debugging:
set debug_mode = ACRO_TRAINER

debug(0) - Current angle
debug(1) - The internal logic state
debug(2) - Modified setpoint
debug(3) - Projected angle based gyro rate and lookahead period
2018-05-29 21:08:16 -04:00
Bruce Luckcuck
fc67a40127 Changed subTaskRcCommand() to be FAST_CODE_NOINLINE
Previously the code in subTaskRcCommand() was part of subTaskMainSubprocesses() which is set to FAST_CODE_NOINLINE.  When it was split out into a separate function it inherited FAST_CODE from taskMainPidLoop() which made it get inlined and caused ITCM_RAM overflow.
2018-05-27 10:40:39 -04:00
Bruce Luckcuck
89a1aa7cc6 Fix yaw reset and throttle angle correction to be before rc interpolation
In #5905 the ordering of rc interpolation processing was moved out of subTaskMainSubprocesses() and into a separate subTaskRcCommand() process that ran earlier in the PID loop. Previously the logic to handle stick arming yaw reset was immediately before the rc interpolation logic and after the previous change it ran later in the process and after rc interpolation.

This fix moves the related throttle/yaw processing into the subTaskRcCommand() before rc interpolation to match the ordering that existed previously.  The fixes introduced by #5905 (throttle spikes) are still retained.
2018-05-27 08:16:13 -04:00
Michael Keller
0af4789d6d
Merge pull request #5983 from mikeller/add_pid_audio_check
Added check to establish that PID audio is configured.
2018-05-27 21:39:07 +12:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
mikeller
7db73942dd Added check to establish that PID audio is configured. 2018-05-27 10:42:32 +12:00
Michael Keller
7b879679c0
Merge pull request #5974 from mikeller/fix_gps_rescue_config
Renamed 'gpsRescue' to 'gpsRescueConfig' and moved it into the appropriate location.
2018-05-27 00:06:15 +12:00
Andrey Mironov
375bfe3929 Marked crucial functions inlined into ITCM-RAM explicitly 2018-05-26 11:04:02 +03:00
mikeller
d535fd6180 Renamed 'gpsRescue' to 'gpsRescueConfig' and moved it into the appropriate location. 2018-05-26 15:28:08 +12:00
Andrey Mironov
3733640c08 Changed NOINLINE to be applied conditionally on ITCM presence 2018-05-23 16:34:01 +03:00
Michael Keller
041362614b
Merge pull request #5899 from dbasch/gps_rescue_beta
[GPS RESCUE] - Add GPS rescue as a flight mode and failsafe mode
2018-05-21 14:13:50 +12:00
s0up
ac6b8088c9 add gps rescue mode 2018-05-20 16:28:17 -07:00
Bruce Luckcuck
fdee2e5228 Break out rc interpolation as a separate task and run before pid controller and motor update
Fixes an issue with motor "spikes" when rc interpolation was enabled for throttle. The problem was that the smoothing was happening too late in the sequence and the earlier process subTaskMotorUpdate() would use the unsmoothed throttle value in the mixer if new rx data had come in between the last and current PID loop.  Also because the setPointRate was calculated at the end of the smoothing, the PID controller would always be using the value from the previous loop iteration.
2018-05-16 10:21:29 -04:00
jflyper
58ea3a8180
Merge pull request #5860 from mikeller/eliminate_inefficient_serial_runtime_calls
Eliminated inefficient serial function calls at runtime.
2018-05-12 09:56:24 +09:00
Michael Keller
ea8432b941
Merge pull request #5851 from robertlacroix/graveyard
Add Paralyze mode support
2018-05-12 12:02:18 +12:00
Robert Lacroix
092baf5805 Add Paralyze mode support
During team relay races it's unsafe to retrieve crashed quads because the course is continuously hot. In order to safely fly a backup quad with the primary quad crashed in the field (but powered up) it's necessary to:

* Disable arming, so that the crashed quad doesn't unintentionally arm as well. This is specifically a problem when a transmitter can send signals to all powered up receivers (like FrSky and others).
* Change VTX to an unused channel with low power output
* Turn off telemetry

This change introduces a new mode called paralyze which disables arming and prevents mode changes (except beeper). It can only be invoked while the quad isn't armed. Once it's invoked, the FC has to be power cycled. In order to invoke it, the mode needs to be in a disengaged state at least once, so that forgetting to flip the switch back after crashing doesn't immediately invoke graveyard on the backup quad.

_Legal disclaimer: I am making my contributions/submissions to this project solely in my personal capacity and am not conveying any rights to any intellectual property of any third parties._
2018-05-10 07:40:31 -07:00
s0up
de5fa47c4c navigation feature / reference removal 2018-05-09 10:28:36 -07:00
mikeller
9bf762e9e8 Eliminated more unnecessary calls. 2018-05-10 02:11:41 +12:00
Michael Keller
fa6c993f04
Merge pull request #5847 from mikeller/remove_telemetry_switch
Removed 'tlm_switch', replaced with 'isModeActivationConditionPresent(BOXTELEMETRY)'.
2018-05-08 23:41:16 +12:00
mikeller
19a360b867 Removed 'tlm_switch', replaced with 'isModeActivationConditionPresent(BOXTELEMETRY)'. 2018-05-08 01:14:18 +12:00
mikeller
0cd8c62568 Cleaned up implementation of MSP port releasing when shared. 2018-05-07 23:33:23 +12:00
Diego Basch
c46be03047 added gps for altitude estimation, remove most unused code, rename altitude.c to position.c, add hdop to nmea 2018-05-04 08:45:26 -07: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
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
Michael Keller
b2c247d34a
Added USB VCP detect and debugging. (#5689) 2018-04-18 01:22:46 +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
f50ed9f763 Change crashflip to normal on disarm (#5594) 2018-04-02 14:36:27 +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
etracer65
a7eccffa38 Clear crash flip mode flag on disarming (#5566)
Previously the flag was only set during arming so after crash flip mode was used the flag would stay active until the next arming. This caused the "CRASH FLIP" warning message to erroneously display on the OSD when disarmed.
2018-03-30 18:09:35 +13:00
Andrey Mironov
36c3fdb576 Simplified PID rate counter code (#5350) 2018-03-04 11:48:22 +13:00
Charles K Stevenson
33ee5efa17 Don't close blackbox log on disarm if mode is ALWAYS_ON (#5341) 2018-03-04 11:48:09 +13:00
Andrey Mironov
685dd05479 FC Core: Remove conditional pidUpdateCountDown 2018-03-02 10:06:43 +13:00
Bruce Luckcuck
449f5f2f5c Runaway Takeoff remove unneeded parameters and enhance deactivate logic
Removed parameters runaway_takeoff_threshold (hardcode to 60) and runaway_takeoff_activate_delay (hardcode to 75).  The previous default values worked well and required no tuning.

Enhance the deactivate logic to remove the R/P/Y stick activity condition once throttle reaches 2X runaway_takeoff_deactivate_throttle_percent.  Additionally reduce the runaway_takeoff_deactivate_delay by 50% when throttle exceeds 75%.
2018-02-27 19:22:33 -05:00
Michael Keller
dbdeb7b445
Merge pull request #5239 from etracer65/reorder_arming_disabled_flags
Reordered arming disabled flags to give runaway takeoff a higher priority
2018-02-22 01:27:48 +13:00
Bruce Luckcuck
4270c658a3 Reordered arming disabled flags to give runaway takeoff a higher priority
Previously the ARMING_DISABLED_RUNAWAY_TAKEOFF reason would be overridden by ARMING_DISABLED_THROTTLE which prevented the indication that the disarming was casued by a runaway event.

Also fixed a problem where the disarm beep pattern would override the arming disabled beep codes when runaway takeoff triggered an auto-disarm.
2018-02-20 06:54:02 -05:00
Bruce Luckcuck
9ea965c549 Add gyro rate checking to runaway takeoff activation to improve bench testing
Changed the triggering phase so that in addition to the pidSum needing to exceed runaway_takeoff_threshold, the gyro rate on any axis must exceed a threshold value to indicate the quad is actually moving. The threshold for the yaw axis is much higher since the torque of the motors can still yaw the craft without props.
2018-02-19 17:22:04 -05: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
Michael Keller
7cd97b8fc0
Merge pull request #5205 from etracer65/runaway_takeoff_reset_after_crashflip
Reactivate Runaway Takeoff Prevention after using crash-flip
2018-02-18 03:17:44 +13:00
Bruce Luckcuck
1b5e52d87b Reactivate Runaway Takeoff Prevention after using crash-flip
Reset Runaway Takeoff Prevention so that on the next arming after crash-flip is used it will once again be active.  The use-case is that the pilot may have broken props or other damage that could cause a runaway event.  After successful takeoff the feature will deactivate for the remainder of the battery as before.
2018-02-15 15:53:07 -05:00
Bruce Luckcuck
17aeaa3ee0 Runaway Takeoff Prevention - temporarily disable during configurator bench testing
Temporarily disables Runaway Takeoff Prevention when the `ARMING_DISABLED_MSP` flag is cleared in the configurator by switching the safety switch on the motors tab.  Allows bench testing the motors and flight controller response without triggering a runaway takeoff auto-disarm.

Requires coordination with the configurator to pass an extra runaway takeoff temporary disable flag with the MSP_ARMING_DISABLE msp command.
2018-02-14 09:09:30 -05:00
mikeller
232fc4e8de Unified BOX3DDISABLE and BOX3DONASWITCH switches. 2018-02-13 20:02:02 +13:00