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

58 commits

Author SHA1 Message Date
anthonycake
81150286c6 Keep reviewers happy 2020-12-15 09:02:01 +01:00
anthonycake
8627af832c Add debug support to GHST protocol driver
Add ability for pilots to log CRC errors, unknown frames, LQ, and RSSI. 
Added macro to debug.h to simplify incrementing debug values without the need for local statics in client code.
2020-12-05 12:17:38 +01:00
Bruce Luckcuck
ebc8928d0d Improve CMS support of long lookup table names
Optimizes the display to use available space by calculating the label length vs. the screen size instead of a fixed 12 character limit.

For lookup table strings that are still too long the value is displayed as a scrolling ticker so the user can see the entire name.
2020-10-13 15:05:47 -04:00
haslinghuis
b5e3164d4a Fix debug names not unique with only 12 chars 2020-08-27 01:19:22 +02:00
Phil Greenland
367cc3a513 Fix issue entering pitmode.
Make as many variables as possible private.
Re-work settings application into state machine.
Remove legacy interfaces.
Update OSD interface following implementation rework.
Review updates.
2020-07-20 21:57:03 +01:00
SteveCEvans
d8c0159378 Add DEBUG_D_LPF 2020-07-05 14:37:48 +12:00
mikeller
dc5671f34c Added protocol level RX frame rate measurement for FrSky FPort. 2020-03-06 09:35:00 +13:00
Bruce Luckcuck
f584780944 Gyro native rate sampling, filtering, and scheduler restructuring 2020-02-04 18:19:35 -05:00
jflyper
09bbd4000a Add debug code for blackbox output bandwidth measurement 2019-10-19 23:38:28 +09:00
Bruce Luckcuck
86f9960987 Gyro filtering restructure
Refactor the gyro filtering to move the filters from the individual gyro sensor and make them part of the logical gyro object. For dual-gyro mode the sensors are averaged BEFORE and then filtering is applied. This differs from the current structure where filtering is applied individually to each sensor and the results were averaged at the end.

Significantly reduces filtering processing load and enables RPM Filtering for dual-gyro mode.
2019-08-31 19:13:41 -04:00
Thorsten Laux
91ad2498ff ff from interpolated setpoint 2019-08-08 09:50:18 +02:00
Thorsten Laux
bca9f8a587 better idle defaults and don't set idle_throttle if not enabled 2019-08-02 13:51:44 +02:00
Nicola De Pasquale
bb5f59a94d new gps rescue pid controller based on vertical velocity [ci skip] 2019-06-27 18:17:03 +02:00
Dominic Clifton
eea9242d7b Baro fixes, cleanups and improvements.
* Add BARO debug mode.
* BMP085 - Fix EOC and XCLR initialisation.
* BMP085 - update previously dead code.
* BMP280 - Move t_fine out of the calibration data, since their usage is mixed.
* BMP280 - Move static_assert closer to definition.
2019-05-20 19:13:11 +02:00
laz2wiringpi
653618d0f6 USE_CRSF_LINK_STATISTICS Split from pr 8042 2019-05-04 22:08:14 -04:00
Bruce Luckcuck
644d5713df Add DSHOT telemetry motor level packet stats
Captures packet quality statistics per motor to provide a platform for troubleshooting and in-flight alarms or warnings.

Continuously monitors and captures packet stats over the past second to be used to determine DSHOT telemetry link quality.

Update the CLI to move the DSHOT telemetry data/stats out of the `status` command and into a dedicated `dshot_telemetry_info` command. Reformatted the motor data to include the invalid packet percentages. Will aid in debugging by identifying ESC's that may be misconfigured (not supplying data), or those with problems generating high invalid packet percentages.

Data can later be used to generate OSD and beeper-based warnings if invalid packet percentages exceed thresholds.

Included a blackbox logging debug mode (`set debug_mode = DSHOT_RPM_ERRORS`) to record the per-motor invalid packet percentages in hundredths of a percent (so 123 is 1.23%).
2019-04-16 08:47:50 -04:00
Bruce Luckcuck
acf0af7790 Add DUAL_GYRO_SCALED debug mode to capture raw scaled roll/pitch from each gyro
Data is before the filters but scaled to 0-2000dps.

debug(0) = gyro 1 roll
debug(1) = gyro 1 pitch
debug(2) = gyro 2 roll
debug(3) = gyro 2 roll
2019-04-08 10:26:11 -04:00
Thorsten Laux
fb6558a142 add abs control debug modes 2019-03-28 11:58:18 +01:00
mikeller
fad7ee3464 Fix missing 'platform.h' includes in compilation units, and make them stay away. 2019-02-23 17:49:25 +13:00
ctzsnooze
b70d34f9db Update D_CUT to D_MIN, add setpoint
Directly and easily set the minimum value for D on pitch and roll.
- Boost back to the primary D setting is generated from gyro or setpoint inputs.
- Setpoint input is stick derived, faster by 10ms approx, and does not respond to propwash.
- Gyro input is motor derived and slower, but responds to propwash
- timing value sets balance between gyro (100) and setpoint (0) boost factors
- gain value sets overall sensitivity
- default D mins are 20 roll 22 pitch
- default D is 35, 38; if undefined then normal 30, 32 values
TUNING
- D value to flip overshoot control
- D_min to noise, lower values mean cooler motors but perhaps more propwash.
- Advance, higher values bring the boost in earlier, and stronger overall, useful for very high flip rates, but dampen stick responsiveness slightly.
- Gain value adjust against logs, checking maximal boost with flips and some rise with propwash, should be edging to get up from the min value in normal flight.
2019-02-10 01:44:55 +11:00
mikeller
118e92c8b2 Aligned debug mode names with debug enum value names for more fun when debugging. 2019-01-27 12:04:38 +13:00
ctzsnooze
7e3e5649e1 DTERM_CUT
This code cuts D by a specified percentage durning normal flight.

It lets D smoothly rise up to normal during rapid gyro moves like flips and rolls, and increase during prop wash events.

D should now be tuned to values the 'normal' 30-45 range.

If D is 40, a dterm_cut_percentage of 65 will cut D to 14 in normal flight, but the quad will still get full 40 of D to control bounce-back after flips and about 25 of D during strong prop wash.

The dterm_cut_percentage can be adjusted via the OSD, from the D filtering page.
Adding d_cut results in cooler motors, lower amounts of noise in motor traces and faster reactions to quick stick inputs.

Too high a dterm_cut_percentage may bring out P oscillation from lack of D.  Values of 70% are generally OK.

Input is gyro differential (delta).  Frequencies above 40hz (above propwash) are attenuated with a configurable (dterm_cut_range_hz) biquad filter.  Lower values for range can be used if the quad is very noisy or gets low frequency D resonant oscillation.  Up to 50 or 60hz may suit clean quads where prop wash control is the main priority.  Too high a range value results in D being boosted from noise in normal flight.

The boost signal is 'integrated, smoothed and delayed' with a 7hz PT1 'dterm_cut_lowpass_hz' filter.  The default of 7Hz gives about the right amount of smoothing and delay.  Higher numbers cause the boost to come on faster, with less delay. Lower values delay the boost effect and cause it to last longer.

The dterm_cut_gain amount controls the strength of the boost effect by amplifying the input to the boosting effect.  If the quad is flow gently, a higher gain value may be needed to gain full boost.

Logging with set debug_mode = D_CUT allows recording of realtime D values on roll and pitch into debug 2 and 3.  The reatime D value should reach its set maximum during rapid turns, ideally at about the time D itself peaks.  If it fails to reach the maximum, gain should be increased.

The D_Cut feature is not enabled on LUXV2RACE, OMNIBUS, SPRACINGF3NEO because there isn't enough flash space.
2019-01-12 21:09:03 -07:00
Thorsten Laux
8d4ed72e13 rpm telemetry based notch filter 2019-01-07 13:36:01 +01:00
Thorsten Laux
816da6cbf5 Dshot erpm telemetry on the signal line 2019-01-03 14:42:52 +01:00
phobos-
6651baa7d8 Implemented SPI SPEKTRUM protocol 2018-12-16 11:15:35 +01:00
Kenneth Mitchell
011eae93c6
Cascaded notch filters. 2018-12-02 09:52:02 -05:00
jflyper
a672861184 Keep coreTemperature's position for bblog backward compatibility 2018-11-12 04:51:06 +09:00
jflyper
635f8fc18a Add debug mode for adc internal sensor calibration 2018-11-11 03:33:41 +09:00
chibaron
cb5fc4fd63 Add SFHSS-SPI-RX 2018-10-01 23:27:40 +09:00
ctzsnooze
4c917efa50 Smooth anti gravity 2018-07-21 23:49:41 +12:00
Bruce Luckcuck
1982c94780 RC smoothing retraining update - adds full support for CRSF
Adds in flight monitoring of the rx frame rate and adapts the filters if the frame rate changes. Primarily to add support for Crossfire with its ability to switch from 150hz to 50hz (and back) under some circumstances. Will work with any protocol - not CRSF specific.   So if future receivers add the ability to switch frame rates dynamically the logic should support them.

If the current rx frame rate is more than +-20% from the previously detected rate, then the process will retrain for the next 50 samples as long as the rate continues to be outside the 20% tolerance. Once 50 samples are collected the new frame rate is updated and the filter cutoffs are adjusted. Only filters set with their cutoffs = 0 (auto) will be adjusted. There is a 2 second guard time after a successful update before retraining can start again to prevent rapid switching back and forth.

The logic is optimized to not perform any training if the filters are set to manual cutoffs. So there is an opportunity for advanced users to choose specific cutoffs and reduce the PID loop load slightly. However this is not recommended for Crossfire or other protocols that might change their rx frame rate.

Updated the output of the `rc_smoothing_info` cli command to match the revised logic.
2018-06-22 20:10:06 -04:00
mikeller
2f0c8d26ff Fix from review. 2018-06-10 03:21:27 +12:00
Bryce Johnson
a86e0bc41c frsky-spi-D16 was counting every telemetry state as a good packet. If it was garbage packet it would go straight into the rcData
Add some debugging
2018-06-10 01:37:31 +12:00
AJ Christensen
f8ebdf06f1 debug: update debugModeNames
* TBC
2018-06-09 14:12:32 +12:00
Bruce Luckcuck
826609e703 Experimental filter-based rc channel smoothing
Adds an additional rc channel smoothing algorithm that can be used in place of the default rc interpolation. Utilizing a filter-based approach the smoothing has lower latency and is immune to loop time jitter that can introduce artifacts.  Additionally a smoothing filter is added to the setpoint derivative used to produce D-term setpoint weight resulting in a smoother effect on D.

The default setting is to use the previous interpolation logic and there are no changes unless the optional method is selected.

Configuration:

rc_smoothing_type: (INTERPOLATION | FILTER) - defaults to INTERPOLATION

rc_smoothing_input_hz: (0-255) - sets the rc channel input filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_derivative_hz: (0-255) - sets the setpoint weight derivative filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_debug_axis: (ROLL | PITCH | YAW | THROTTLE) - determines which axis is logged in the debug fields

Debug logging:

set debug_mode = RC_SMOOTHING

debug(0) = raw un-smoothed rc channel data
debug(1) = raw un-smoothed setpoint derivative
debug(2) = filtered setpoint derivative before applied to setpoint weight
debug(3) = auto-calculated filter cutoff frequency base after sampling the rx frame rate

Notes:

Currently only enabled for F4/F7 due to flash size limitations

Uses the rc_inter_ch parameter to determine which channels are smoothed (same as default interpolation logic)

The auto filter cutoff calculation will set a cutoff frequency of 30Hz for typical SBUS frames (9ms).  11ms Spektrum will calculate to approximately 25Hz. The user can manually enter the filter cutoffs to be used instead of the auto calculation.  The current default calculation was chosen as a good starting point but may be adjusted in the future.

Setting a lower cutoff frequency will result in more smoothing, but also more delay.

There currently isn't any support for receivers that change their rx frame rate dynamically.  So for CRSF users wishing to use this alternate smoothing method should change their settings to lock the rx frame rate for now. Support for auto-adjusting to new frame rates in flight will likely be added.
2018-06-03 21:52:01 -04: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
Thorsten Laux
791c584d81 add debug option DEBUG_ITERM_RELAX 2018-05-28 16:37:41 +02:00
Diego Basch
c3412225f5 Fix GPS Rescue (needs yaw smoothing but works). 2018-05-22 15:42:14 -07:00
mikeller
a48da6c1ee Cleaned up SmartAudio debugging. 2018-05-13 02:08:27 +12: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
Michael Keller
b2c247d34a
Added USB VCP detect and debugging. (#5689) 2018-04-18 01:22:46 +12:00
conkerkh
c182748dbb SDIO rewrite in baremetal, fixes for WORMFC. (#5441)
* SDIO rewrite in baremetal, fixes for WORMFC.

* Fix identation, move LED TIM

* Fix identation
2018-03-21 00:08:34 +13:00
conkerkh
742cb5f93b Add current sensor debug option. (#5260)
Allows for easy calculation of required scale and offset.

0 - miliVolts
1 - centiAmps
2 - amperageLatest
3 - mahDrawn
2018-03-04 11:42:41 +13:00
Dominic Clifton
cde9a9517b SPRacingF7DUAL - Dual SIMULTANEOUS gyro support. (#5264)
* CF/BF - Set STM32F7 SPI FAST clock to 13.5Mhz - Gyros not stable at
27mhz.

* CF/BF - Initial SPRacingF7DUAL commit.

Support two simultaneous gyro support (code by Dominic Clifton and Martin Budden)
There are new debug modes so you can see the difference between each gyro.

Notes:
* spi bus instance caching broke spi mpu detection because the detection
tries I2C first which overwrites the selected bus instance when using
dual gyro.
* ALL other dual-gyro boards have one sensor per bus.  SPRacingF7DUAL is has two per bus and thus commit has a lot of changes to fix SPI/BUS/GYRO initialisation issues.

* CF/BF - Add SPRacingF4EVODG target.

This target adds a second gyro to the board using the SPI pads on the back of the board.

* CF/BF - Temporarily disable Gyro EXTI pin to allow NEO target to build.
2018-03-04 11:29:31 +13:00
Bruce Luckcuck
a32b05c284 Initial implementation of Runaway Takeoff Prevention (anti-taz)
Detects runaway pidSum values on takeoff and auto-disarms to prevent the "Tasmanian Devil" caused by incorrect props, wrong motor order/direction, incorrect flight controller orientation, etc.  After a successful takeoff and normal flight is detected the feature is disabled for the remainder of the battery.
2018-01-31 07:36:16 -05:00
Michael Keller
4258651b3a
Merge pull request #4881 from jflyper/bfdev-adc-internal-full-task-version
VREFINT and core temperature support, full task polling version
2018-01-10 16:12:05 +13:00
jflyper
a03b85025c Internal ADC support, full task polling version 2018-01-10 11:49:56 +09:00
Steffen Windoffer
e0b95fb0fb remove unused debug modes 2018-01-07 21:38:18 +01:00
jflyper
a510091bf1 Add Benewake TFmini/TF02 support 2017-12-21 02:21:36 +09:00