1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 20:10:18 +03:00
Commit graph

38 commits

Author SHA1 Message Date
ctzsnooze
7156dc84a3
Update turtle / crashflip mode (#13905)
* stop motors after 90 degrees of rotation and with max rate

* handle no accelerometer data

* improve check for acc, although seems to be OK without it

* disable all attenuation if rate is set to zero

* refactoring thanks Karate

* use sensors.h

* remove unnecessary arming check

* exit crashFlip immediately switch is reverted if throttle is zero

* add Crashflip Rate to OSD

* Revert unnecessary changes in crashflip core.c code

and clarify comments about crashflip switch

* update / minimise comments, thanks Karate

* ensure all names say `crashflip` consistently

* Undo quick re-arm because motrors were not reversed

* fix issue with reversed motors, we must disarm

* ignore yaw rotation and set gyro limit to 1900 deg/s

* default attenuation to off (crashflip_rate = 0)

* refactoring, increase rate limit to allow stronger inhibition

* enable in race_pro mode

* don't attenuate on attitude until a significant change occurs

* no attenuation for small changes

* Updates from review by PL

* remove whitespace

* refactor motorOutput, update comments, renaming variables

thanks PL

* changes from review PL

* only permit fast re-arm if crashflip rate set and crashflip was successful

* properly exit turtle mode

* add crashFlipSuccessful to unit test extern c

* small updates from review

* improved crashflip switch handling

* remove unnecessary motors normal check
2024-10-05 07:58:33 +10:00
ctzsnooze
776e8c7b3c
Refactor Rx code and better support 25Hz links (#13435)
* RX task update rate to 22Hz, to improve 25Hz link stability

* modified Rx code

* add LQ to debug

* use max of frameAge or FrameDelta

* Require a dropouit of 200ms, not 100ms, before RXLOSS

* remove FrameAge, use 150ms timeout 50ms checks

* fix tests and tidy up the comments

* Handle NULL input as before, log frame time

* possible solutions to review comment about names

* Remove rxFrameTimeUs

- prepare for direct use of lastRcFrameTimeUs
- refactor rx_spi callback

* remove global currentRxRateHz

* simplify updateRcRefreshRate

* re-name to recheck interval, return frame time debug

* Calculate RxRate only once

* use rxReceivingSignal for consistency

* use signalReceived not rxDataReceived for consistency

* suggestions from review PL

* move defines, thanks K

* fixes from review, thanks MH

* review changes, undo task interval change

rename bool rxIsReceivingSignal to isRxReceivingSignal
thanks Steve for resolving that tasks changes are not needed
thanks PL for your feedback also

---------

Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
2024-10-01 09:23:24 +10:00
Petr Ledvina
4ae1a672b4
Fix clang unitests (#13551) 2024-04-21 16:51:23 +10:00
Jan Post
cb41b55c40
Gps Rescue: Fix "velocityD" filtering (#12042)
* GPS Rescue: Refactor parameter group

* GPS Rescue: Fix "velocityD" filtering
2022-12-10 13:41:35 +01:00
ctzsnooze
341d65becf remove gps_required and gps_minimum sats and revert to gps_rescue_min_sats 2022-10-20 21:44:01 +11:00
ctzsnooze
09ee27cd97 Refactor sat count checks and GPS trust code
single minimum GPS satellite setting
single required GPS satellite setting
CLI Baro vs GPS trust user interface
GPS trust refactoring
allow arming with GPS_FIX even if not enough sats
required sats must be present to arm
set required sat count to 8
add blackbox headers
2022-09-07 09:55:35 +10:00
ctzsnooze
b2241b32c3 Refactor Baro to floats, filter at position rate
convert pressure to altitude early
remove median filter
PT2 filtering upsampled to altitude function in position.c - thanks KarateBrot
baro task synced to position task - thanks Steve
PT2 implementation - thanks KarateBrot
ground altitude from filtered altitude
baro cali by average of calibration samples over cal period
adjust vario and smoothing defaults
don't say haveBaroAlt until cal is complete
reduce PIDs since Baro is faster
add baro smoothing values to blackbox header

Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de>
Co-Authored-By: Steve Evans <SteveCEvans@users.noreply.github.com>
2022-09-02 14:38:40 +10:00
Štěpán Dalecký
f85ebba6a4 Refactoring of IMU and ACC 2022-06-28 18:26:10 +02:00
ctzsnooze
f7c645bfcd update GPS code 2022-06-13 09:43:52 +10:00
Steve Evans
29d221502e Use peak tracking as default for task duration estimation rather than a moving average 2021-12-17 22:09:52 +00:00
Hans Christian Olaussen
3177cb3ec0 Update unit tests 2021-04-26 15:14:59 +02:00
Michael Keller
fe3f0aee3e Fixed unit tests. 2021-01-10 22:29:23 +13:00
mikeller
b6689edc26 Removed VBat PID compensation. 2020-06-22 01:12:47 +12:00
Bruce Luckcuck
f688227db6 Only enable PINIOBOX task when needed
Previously the task was always enabled and there's no reason for it to be running if there are no boxID associations.

Saves a few cycles by not running. But has a bigger effect on the scheduler by minimizing the number of active tasks when possible.
2020-04-12 20:31:32 -04:00
mikeller
d1ac12eccd Added 'disabled' motor protocol and made it the default. 2020-04-01 20:33:29 +13:00
mikeller
db4bd1f186 Cleaned up the scheduler. 2020-03-16 08:35:58 +13:00
mikeller
d13e83b91b Cleaned up the RX handler some. 2020-03-10 00:55:52 +13: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
Dominic Clifton
2fead0aedf Log disarm reason. 2020-01-16 20:16:11 +01:00
mikeller
cedcf2d7e2 Added calibration menu to CMS. 2019-11-19 13:59:52 +13:00
mikeller
a045a9c672 Improved compass calibration. 2019-11-19 01:08:44 +13:00
mikeller
cc8b8d3bf6 Improved detection of upright / 'SMALL_ANGLE' state. 2019-11-18 14:09:06 +13:00
Michael Keller
6694d4ebc8
Improved fixed wing detection. (#9186)
Improved fixed wing detection.
2019-11-18 13:26:17 +13:00
mikeller
ef556c0f59 Introduced 'baroStartCalibration()' / 'baroSetGroundLevel()' to make barometer code more self contained. 2019-11-17 23:34:10 +13:00
mikeller
e0a6f1ab14 Improved fixed wing detection. 2019-11-17 14:05:07 +13:00
mikeller
a21d0f5d31 Fixed potentially incorrect calculation in ACC calibration if non-default cycle number is used. 2019-11-17 10:58:28 +13:00
mikeller
4a7904695e Moved 'config.[ch]' into the 'config/' directory. 2019-10-28 11:17:25 +13:00
mikeller
0a0d3631a7 Renamed 'rxRuntimeConfig' to 'rxRuntimeState'. 2019-10-22 00:12:51 +13:00
mikeller
b5908f5bab Applied 'USE_ACC' consistently. 2019-02-08 09:51:48 +13:00
Bruce Luckcuck
42af168854 Optimize rc modes activation conditions processing
Analyze the rc modes activation conditions and only process configured entries. Previously the entire possible list was processed even though typically only a handful are configured.

Reduces the RX task processing time by about 25% (~44us to ~33us) with an average setup of 3 modes configured (F405, SBUS). Processing time savings will diminish as the user configures more modes. But typically far fewer than the maximum of 20 will be configured.
2019-02-05 16:05:16 -05:00
Bruce Luckcuck
d867aeced3 Move anti-windup iterm reset from rx loop to pid loop
Having the iterm resetting happening in the rx loop causes a sawtooth PID/motor effect while idling since the PID loop is running at a much higher rate and iterm is allowed to grow during this, and then only reset at a much lower rate in the rx loop. This can potentially lead to some oscillation and/or resonance while idling before takeoff as the sawtooth signal can make it through to the motor outputs.
2019-01-19 11:18:24 -05:00
Bruce Luckcuck
98641cde75 Suppress OSD stats if disarming from crash-flip or untriggered launch control
The OSD stats provide no meaningful information and are just an annoyance when exiting these special states.

For Launch Control the stats will be displayed if the launch is triggered and normal flight occurrred.
2018-11-04 09:57:02 -05:00
ctzsnooze
9cc96bfa67 Grr missed two ITerm's in unit test clode 2018-09-16 12:04:57 +10:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
mikeller
00a7d20227 Fixed tests. 2018-08-21 00:37:20 +12:00
mikeller
4439852984 Fixed test. 2018-07-22 00:24:48 +12:00
Robert Lacroix
18765e3593 Add basic VTX unit test
The vtx code doesn't have a lot of test coverage, so this adds a basic unit test that asserts vtx pit mode behavior

_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-07-16 14:10:46 +02:00