1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 22:05:17 +03:00
Commit graph

800 commits

Author SHA1 Message Date
Thorsten Laux
7e12e9da18 don't link debug.c to pid unit test 2018-05-28 16:40:09 +02:00
Thorsten Laux
e1ff2566c6 make unit tests happy 2018-05-28 16:37:41 +02:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09:00
Michael Keller
42726fd2ae
Merge pull request #5973 from mikeller/fix_unittest_stubbing
Fixed stubbing of 'debug.c' in unittests.
2018-05-27 00:05:59 +12:00
Michael Keller
ce7f112cfc
Merge pull request #5916 from jflyper/bfdev-spiPreInitCs-to-support-configurability
Convert spiPreInit for configurability
2018-05-26 23:53:25 +12:00
mikeller
bf0a9c5c4f Fixed stubbing of 'debug.c' in unittests. 2018-05-26 15:09:24 +12:00
jflyper
f9a43099db SPI CS preinit for configurability 2018-05-24 22:00:26 +09:00
mikeller
2feae20c32 Replaced instances of '#include <platform.h>' with '#include "platform.h"'. 2018-05-24 23:46:19 +12:00
Michael Keller
a07b4987aa
Merge pull request #5941 from DieHertz/noinline-and-fastcode-only
Apply NOINLINE conditionally on ITCM presence
2018-05-24 09:35:40 +12:00
s0up
24c8ae22c8 Merge branch 'master' of github.com:betaflight/betaflight into gps_rescue_beta 2018-05-23 08:14:51 -07: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
s0up
7ad65031e2 revert failsafe code, re-implement commented unit tests, add degrees suffix for min/max angle in rescue mode 2018-05-20 19:14:09 -07:00
s0up
ac6b8088c9 add gps rescue mode 2018-05-20 16:28:17 -07:00
Bruce Luckcuck
0916d117b8 Add OSD warning options as cli parameters
Previously only a single bitmapped parameter was available in the cli but this wasn't very useful as the users would have to understand the bit positions to enable/disable warning options. This change exposes each warning item as a separate parameter.
2018-05-11 20:06:34 -04: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
Michael Keller
7bc2b70043
Merge pull request #5846 from mikeller/cleanup_msp_port_releasing
Cleaned up implementation of MSP port releasing when shared.
2018-05-08 23:40:56 +12:00
mikeller
908beb2912 Fixed tests. 2018-05-08 22:58:33 +12:00
Bruce Luckcuck
905f14d86c Change enabled OSD stats storage to bitmap
Previously the flags controlling the enabled OSD stats were stored as an array of boolean. This change reduces config storage by storing the flags as bits inside a single uint32.
2018-05-07 12:07:25 -04:00
Michael Keller
2f2c95a556
Merge pull request #5686 from pulquero/antigrav_osd
Display anti-gravity activity in OSD.
2018-05-07 21:26:38 +12:00
Mark Hale
b2e43abf2d Display anti-gravity activity in OSD.
Signed-off-by: Mark Hale <mark.hale@physics.org>
2018-05-05 19:56:56 +01:00
Michael Keller
8f50aad585
Merge pull request #5809 from jirif/rx_rate_calculation
Fix rx rate calculation when using fport
2018-05-05 18:34:59 +12:00
Michael Keller
b0ee38d77b
Merge pull request #5807 from etracer65/gyro_both_validation
Only allow gyro_to_use = BOTH if both detected gyros are the same type
2018-05-05 18:34:42 +12:00
Michael Keller
d242de87bd
Merge pull request #5764 from dbasch/gps_rescue
[GPS RESCUE] added gps for altitude estimation
2018-05-05 12:48:29 +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
jirif
fa40fbe865 Fix RX rate calculation when using fport 2018-05-04 07:45:47 +02:00
Bruce Luckcuck
ff59c37fdb Only allow gyro_to_use = BOTH if both detected gyros are the same type
Since we currently don't have per gyro configuration, trying to use two different gyro types simultaneously may not provide good results or lead to other unforeseen situations like attempting to initialize with settings not applicable to both hardware types.

This logic looks at the detected gyro types and resets to use only the first one if the user selected "BOTH" and they're different hardware types.
2018-05-03 10:34:13 -04:00
Bruce Luckcuck
c10e5b8343 Fix testosd_unittest
The unit test was expecting a metric result during the imperial test.
2018-04-24 16:58:01 -04:00
borisbstyle
8fab0fee11 PID controller unittest 2018-04-22 16:10:17 +02: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
Michael Keller
c3a534f800
Fix for blackbox I interval to be 32 ms even if PID denom isn't 1. (#5688) 2018-04-16 22:40:38 +12:00
Míguel Ángel Mulero Martínez
802edf236b Fix Blackbox P interval (#5645) 2018-04-10 00:35:54 +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
SteveCEvans
5558174d33 Support programming of Arduino devices in serial passthrough mode (#5129)
* Support DTR in serial passthrough mode to enable programming of Arduino
based devices such as MinimOSD.

Use 'serialpassthrough 5 57600 rxtx 56' and then use Ardino to program MinimOSD
Use 'serialpassthrough 5 115200' and then use MWOSD configurator to setup

* Fix comment for CDC_SetCtrlLineStateCb routine

* Handle F7 CDC interface

* Use strToPin() to allow easy port/pin specification

* Fix use of CDC_SetCtrlLineStateCb for all processor types

* Only set baud when specified

* Fix unit tests for cli

* Only register callback if needed

* Fix white space

* Provide implementation of IOConfigGPIO in SITL

* Update serialpassthrough help text

* DTR handling through serial drivers

* Fix F3, F7 and SITL builds

* If serialpassthrough command specifies baud rate of 0, set baud rate over USB. MWOSD configurator can now access config and reflash MinimOSD without rebooting and changing baud rate.

* Fix F3 build

* Fix failing unit tests

* Use resources to declare DTR pin assignment

* Don't assert DTR during normal operation as MW_OSD doesn't like it

* MW_OSD must be built with MAX_SOFTRESET defined in order to support DTR resets

* Minimise changes after dropping DTR pin param from serialpassthrough cmd

* Remove DTR pin param from serialpassthrough cmd

* Treat ioDtrTag as boolean in conditional statements

* Tidy buffer check

* Check buffer size in CDC_Itf_Control

* Fix unit test

* Add documentation for DTR

* Add note on MAX_SOFTRESET to documentation

* Remove superfluous function definitions

* Fix tabs

* Fix tabs

* Removed superfluous entried from vtable

* Backout whitespace changes unrelated to this PR

* Pass true/false to IOWrite()

* Fix line coding packing

* Add LINE_CODING structure defintion

* Revise serial documentation

* Prevent tx buffer overflow in serialPassthrough()

* Revert change unrelated to PR

* Review feedback from ledvinap

* Fix unit test

* Use PINIO to drive DTR

* Fix unit test

* Remove change unrelated to PR

* Fix SITL build

* Use shifted bits for mask definition

* Fix serialpassthrough documentation

* Only compile PINIO functionality if USE_PINIO defined

* IOConfigGPIO not needed

* Move cbCtrlLine callback to cli.c

* serialPassthrough params changed

* Check packed structure size

* Fix unit test

* Tidy up baud rate handling
2018-03-21 23:17:31 +13:00
AJ Christensen
46291a8374 Dual-stage Gyro Filtering: PT1, Biquad, Butterworth, Denoise (FIR), FKF (fixed K), and Biquad RC+FIR2 (#5391)
* Dual-stage Gyro Filtering: PT1, FKF, and Biquad RC+FIR2

* Builds on the previous work of apocolipse.
* Fixes 'stage2'/'stage1' mis-naming to reflect where it is applied in the loop.
  That is, the older Biquad, PT1, Denoise (FIR) filters are 'stage2' - applied
  after dynamic and static notches (if enabled), and the controversial PT1,
  'fast Kalman' filter, and Biquad RC+FIR2 filters, are 'stage1'. e.g. before
  dynamic notch.
* FKF bruteforce Kalman gain removed. Calculate from half of PT1 RC constant,
  automatically taking loop-time into account.
* New union type definition for stage1 filtering.
* New gyro sensor members for stage1 filter application function and states for
  all three supported filter types
* New enum types for stage1 v. stage2. dterm lowpass type references 'stage2'.
* updates to CMS/MSP/FC to allow compilation (untested, probably breaks
  MSP, Lua, and ~comms with BFC~).
* Refactors FKF initialization, update and associated structures to be faster by
  not continuously calculating 'k'. Filter gain is calculated once during
  initialization from RC constant as per PT1 and Biquad RC+FIR2. It was
  discovered this converges to static value within 100 samples at 32kHz, so can
  be removed. Remove related interface (CLI) settings.
* update dterm_lowpass_type to use new 'TABLE_LOWPASS2_TYPE' (biquad/pt1/FIR)
* Stage 1 defaults to PT1, 763Hz (equivalent to Q400 / R88 from quasi-kalman
  filter) - suitable for 32kHz sampling modes. Can be switched to Biquad
  RC+FIR2, and FKF.
* Update `#if defined(USE_GYRO_SLEW_LIMITER) to `#ifdef`.
* Includes optional Lagged Moving Average 'smoothing' pipeline step, applied (in
  code) after the output of stage1.
* (diehertz): Removed redundant pointers from gyro filtering

* blackbox: fix indentation

* cms IMU menu: fix indentation

* filters: remove USE_GYRO_FIR_FILTER_DENOISE in filter type enum

* gyro sensors: go back to `if defined()` form. for slew limiter

* gyro sensors: increment parameter group version

* due to non-appending changes, the version must be bumped.
2018-03-21 15:52:59 +13:00
etracer65
0e051bebb2 Simplify CLI case-insensitive by using new strcasestr() (#5449)
Remove string lowercase function from cli.c and use the new strcasestr() added to string_light.c
2018-03-16 07:41:00 +13:00
jflyper
416495e17a Convert BEEPER to USE_ scheme (#5433) 2018-03-11 09:28:08 +13:00
SteveCEvans
0430fcb67d Add ledstrip_grb_rgb setting (GRB or RGB) to handle WS2811 or WS2812 … (#5255)
* Add ledstrip_grb_rgb setting (GRB or RGB) to handle WS2811 or WS2812 LED drivers

* Rename setting lookup table to lookupLedStripPackingOrder

* Fix call to ws2811UpdateStrip

* Fix unit test

* Use ledStripFormatRGB_e enumeration for RGB packing format

* Fix unit test

* Whoops. Make ledStripFormatRGB_e match lookupLedStripFormatRGB

* Applied review feedback

* Add documentation of ledstrip_grb_rgb
2018-03-06 09:39:14 +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
Michael Keller
b0ff928afd
Merge pull request #5296 from azolyoung/disable_runcam_camera_control_in_runaway_takeoff_status
disable runcam camera control in runaway takeoff status
2018-02-26 01:40:53 +13:00
azol
2d84608daa disable runcam camera control in runaway takeoff status 2018-02-25 13:26:36 +08:00
Bruce Luckcuck
2610344266 Disable stick command processing while ARMING_DISABLED_RUNAWAY_TAKEOFF is set
Addresses the rare possibility that if runway takeoff triggers and disarms while the pilot has the sticks in some valid stick command configuration. Prevents the stick command from processing until the craft is disarmed and the ARMING_DISABLED_RUNAWAY_TAKEOFF condition is cleared.

For example, if the pilot was mid throttle and went full yaw right and runway takeoff triggered, then camera control would have be entered.
2018-02-24 09:29:19 -05:00
mikeller
c89f87018b Fixed OSD warnings overlap to the right. 2018-02-23 19:36:22 +13:00
Bruce Luckcuck
4185756baf Change crash-flip OSD message to track actual state rather than switch
Previously the OSD crash-flip warning would only track the state of the activation switch.  So if the switch was disabled but still armed the message would go away, but the quad was still in active crash-flip mode until it was disarmed.  This change makes the OSD message follow the actual internal state for crash-flip.
2018-02-21 08:19:59 -05:00
mikeller
232fc4e8de Unified BOX3DDISABLE and BOX3DONASWITCH switches. 2018-02-13 20:02:02 +13:00
Curtis Bangert
3a7540e042 Corrected issue with telemetry init when battery cell estimatation is undefined 2018-02-08 22:31:50 -05:00