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

39 commits

Author SHA1 Message Date
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
ctzsnooze
254da8f460
Altitude hold for 4.6 (#13816) 2024-09-04 20:29:03 +10:00
ctzsnooze
a35a5af16c
Only allow arming when valid Rx signals are received (#13033)
* Only allow arming when failsafe criteria are cleared

* 500ms RXLOSS period with 100ms minimum
2023-09-01 15:58:26 +02:00
Mathias Rasmussen
9957ceb275 Fix function brace style 2022-10-12 16:31:55 +02:00
Steve Evans
cf3615938b Remove superfluous double ; 2022-07-24 14:49:35 +01:00
ctzsnooze
f7c645bfcd update GPS code 2022-06-13 09:43:52 +10:00
Mark Haslinghuis
e74dbcfd45 Remove duplicate line in unittest 2022-04-13 23:25:13 +02:00
ctzsnooze
ee024aff0c refactor failsafeActivate, all recovery times the same
Simpler GPS Rescue fix
100ms interval for signalReceived failure
Faster failsafe stick response
Update and confirm unit tests work correctly
Restore invalid flight channel ability to trigger failsafe with individual timers
Set default failsafe stage 1 delay to 1.5 seconds, approximately match previous delay of 1.6s when the user selected 1.0 seconds.
Update failsafe documentation for 4.3
Arming blocked soon after Rx initialisation
Unit test fix for previous commit
Editorial changes and typo fixes
2022-04-13 11:52:56 +10:00
ctzsnooze
d8aeb89710 commit for failsafe PR #11459 2022-04-01 07:01:04 +11:00
Steve Evans
07f6bea174 Fix failsafe timings and behaviour to match Failsafe.md 2022-03-30 18:29:21 +01:00
Hans Christian Olaussen
3177cb3ec0 Update unit tests 2021-04-26 15:14:59 +02: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
Dominic Clifton
2fead0aedf Log disarm reason. 2020-01-16 20:16:11 +01:00
mikeller
5808bfd6f3 Improved tests. 2019-11-21 19:51:53 +13:00
Tony Cabello
d829563179 GPS Rescue procedure can be aborted by moving sticks, with a configurable delay after recovering rx 2019-04-14 14:15:17 +02:00
mikeller
6de1c32d9d Added shadow copies for CLI and MSP. 2018-08-21 00:36:47 +12:00
mikeller
8abf138e2a Fixed tests, SPRACINGF3OSD. 2018-08-21 00:36:31 +12:00
Robert Lacroix
cb792f30d2 Delay allowing sticky modes
On bootup aux channels start out at default and allow sticky modes right away,
although they should only be allowed once they are actually not active.

_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 13:50:55 +02:00
Cleric-K
e17abc4063 Failsafe switch choosable behavior #5994
The `failsafe_kill_switch` parameter has been renamed to
`failsafe_switch_mode` and it determines what happens
when the Failsafe mode is activated with an AUX switch.
It takes one of three values:
  0 - simulates RC signal loss - thus activates Stage1 failsafe
      (former behavior when kill switch option was OFF)
  1 - disarms immediately
      (former behavior when kill switch option was ON)
  2 - activates the failsafe procedure (Stage2) immediately (new)
2018-05-29 23:28:09 +03:00
jflyper
041bfb22c6 Create a pg for rxConfig 2018-05-27 09:13:04 +09: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
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Blaine
9556ea6bf5 Squash and rebase 2017-10-18 00:38:13 -07:00
Dan Nixon
312a7d73b9 Disable arming as soon as an RX link is lost 2017-07-30 15:56:23 +01:00
mikeller
31df82db2d Reworked arming conditions. 2017-06-30 08:43:46 +12:00
jflyper
8e2ebcf026 Rebased on to master 2017-06-19 19:43:18 +09:00
Hydra
0227b7fb28 CF/BF - Update re-instated unit tests due to rc_modes changes. 2017-06-19 13:31:08 +12:00
mikeller
a10e1d05ed Fixed tests. 2017-06-19 13:31:08 +12:00
jflyper
c7f62e47a6 Automatic spektrum bind pin determination 2017-06-17 04:12:50 +09:00
Dan Nixon
45a436129b Reenable failsafe unit test 2017-06-10 17:14:32 +01:00
Martin Budden
2e71ac3b84 Got unit tests working by removing non-working tests 2016-10-16 10:12:41 +01:00
ProDrone
f0681de53d Updates and feature additions to failsafe system.
- Added failsafe flightmode and rc control box.

To make failsafe procedure a separate flight mode and make it possible
to trigger failsafe with an AUX switch.

- Failsafe mode is activated when failsafe is active.

RC link lost is simulated with the failsafe AUX switch.
When NOT armed: failsafe switch to failsafe mode is shown in GUI (mode
tab).

- Activate failsafe mode with AUX switch.

- Prevent arming when failsafe via AUX switch is active (safety issue).

- Make failsafe disarm if motors armed and throttle was LOW (2D & 3D)
for `failsafe_throttle_low_delay` time (__JustDisarmEvent__).

Applied code changes to effectively add pull request: Make failsafe
disarm if motors armed and throttle low #717.

- Use failsafeIsMonitoring() to actually start monitoring.

- Added `failsafe_kill_switch` to code.

When set to 1 (0 is default), the failsafe switch will instantly disarm
(__KillswitchEvent__) instead of executing the landings procedure.
Arming is NOT locked after
this, so the craft could be re-armed if needed.
This is intended for racing quads where damage and danger must be
minimized in case of a pilot error.

- Added `failsafe_throttle_low_delay`, adapted documentation.

Used to adjust the time throttle level must have been LOW
to _only disarm_ instead of _full failsafe procedure_
(__JustDisarmEvent__).

- Updated the failsafe documentation.

- Re-enable arming at end of failsafe procedure.

At the end of a handled failsafe event, that means: auto-landing,
__JustDisarmEvent__ or __KillswitchEvent__, the RX link is monitored for
valid data.
Monitoring is a part of the failsafe handling, which means the craft is
still in failsafe mode while this is done.
Arming is re-enabled (allowed) when there is a valid RX link for more
then XX seconds, where XX depends on the handled event like this:
1. XX = 30 seconds after auto landing.
2. XX = 3 seconds after __JustDisarmEvent__.
3. XX = 0 seconds after __KillswitchEvent__.

NOTE: When armed via an AUX switch, you will have to switch to the
disarmed position at the very end to be able to re-arm.
The failsafe mode will not end until you do.

- __KillswitchEvent__ has now priority over __JustDisarmEvent__

- Apply rxfail values instantly when failsafe switch is ON

- Added missing cases to display.c

Show M when failsafe is monitoring for RX recovery (AND disarming when
armed with a switch).

===

Reworked the code from counter-based to time-based.

- AUX failsafe switch now has identical behavior to RX loss.

- Added RX failure and RX recovery timing.

- __KillswitchEvent__ skips RX failure detection delay (direct disarm).

===

[UNIT TESTS]

Adapted failsafe related unittests from counter-based to time-based

- Added failsafeOnValidDataFailed() to some tests

- Removed duplicate test setup from rc_controls_unittest.cc

- Removed magic numbers from rx_ranges_unittest.cc and rx_rx_unittest.cc

- Reworked all test-cases for flight_failsafe_unittest.cc
2015-09-04 16:55:40 +02:00
Dominic Clifton
bad0b1b04d Fix random RX loss beep when using Serial RX receivers. 2015-04-23 16:36:56 +02:00
Dominic Clifton
7266d42466 Cleanup failsafe beeper code and update failsafe unit tests. 2015-04-23 15:55:04 +02:00
Dominic Clifton
20a421c4be Add test to ensure that failsafe is not activated when disarmed and RX
signal loss is occurs.
2015-04-19 06:29:54 +01:00
Dominic Clifton
d4eb558254 Ensure failsafe does not repeatedly call disarm when landed. 2015-04-18 19:00:20 +01:00
Dominic Clifton
a34e8f0bdb Update the failsafe so that an extra cycle is not required between some
phase changes.
2015-04-17 00:10:35 +01:00
Dominic Clifton
eb74735ee8 First cut of unit tests for reworked failsafe.
In writing these tests a bug was discovered with RX_SERIAL and RX_MSP
failsafe delay timing - the configured delays are not honoured.
2015-04-16 23:35:56 +01:00