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

86 commits

Author SHA1 Message Date
Dominic Clifton
db006b1585 Merge pull request #2856 from ledvinap/improvement-64bit-boxid
array based box masks
2017-06-19 13:31:08 +12:00
Martin Budden
2e71ac3b84 Got unit tests working by removing non-working tests 2016-10-16 10:12:41 +01:00
Stephen Willey
38dd09f9b5 Floating point inflight adjustments adjust by 0.01 instead of 0.1 2015-09-18 13:13:31 -07:00
Dominic Clifton
0070573420 Fix unit tests - the tests cannot use a common library of production
since when compiling some test code the idea is to stub out production
functionality rather than call production code.
2015-09-10 02:06:14 +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
DarkVegetableMatter
942c89237e Battery auto-detect and LPF for battery monitoring 2015-08-04 03:04:12 +01:00
Dominic Clifton
36c8b482d1 Re-order initialisers to be the same as the structure declation to avoid
GCC compilation error.

Error message is: "sorry, unimplemented: non-trivial designated
initializers not supported"
2015-05-29 19:49:01 +01:00
Dominic Clifton
704dcf46ba Fix all warnings when compiling unit tests.
Use C++11 for the C++ unit test code to make the tests easier to read.
Previously we were using a 17 year old standard (!) (g++98)

GoogleTest is compiled with some additional flags to avoid some specific
warnings.  Consider enabling the warnings when upgrading GoogleTest.

See https://code.google.com/p/googletest/issues/detail?id=433

Closes #941
2015-05-29 15:26:10 +01:00
Dominic Clifton
0df22f8049 Remove some test duplication in RcControls unit rest by using test
fixture classes.
2015-05-29 14:41:27 +01:00
Dominic Clifton
b63e074d0c Fix unit test compilation failure. 2015-04-25 11:00:32 +02:00
Dominic Clifton
519586a5ce Merge branch 'refactoredBeeperCode_181_1' of
git://github.com/ethomas997/cleanflight into
ethomas997-refactoredBeeperCode_181_1

Conflicts:
	src/main/flight/failsafe.c
	src/main/io/beeper.c
	src/main/mw.c
2015-04-23 01:21:27 +02:00
Dominic Clifton
4b4e64e204 Fix unresolved references in unit tests for new failsafe code. 2015-04-16 10:57:27 +01:00
E Thomas
f02d7403af Port of refactored beeper code 181_1
This the "Port of refactored beeper code #669" modification applied to
version 1.8.1 (4/4/2015) of the code.
2015-04-04 17:54:44 -04:00
Dominic Clifton
60a95f1d22 Removing noise from unit tests. 2015-03-09 23:19:21 +01:00
Dominic Clifton
9d0e464aaf Updating unit tests to match roll/pid/yaw rate decoupling. 2015-03-08 00:51:29 +00:00
Dominic Clifton
774abcfab8 Update unit tests. 2015-02-22 14:56:15 +00:00
Dominic Clifton
55cac2bdeb Finally rename flight.c/.h to pid.c/.h. Cleanup some dependencies.
Relocate more code.
2015-02-01 00:39:38 +01:00
Dominic Clifton
d21a009d40 Change scale for I and D for inflight adjustments to PIDs of FP based
PID.
2015-01-30 22:09:36 +01:00
Dominic Clifton
2ac7282314 Use different scale for inflight adjustments to PIDs of FP based PID
controllers.
2015-01-30 21:46:23 +01:00
Dominic Clifton
f77a762b48 Allow inflight adjustments for floating-point based PID controllers. 2015-01-30 20:54:34 +01:00
Dominic Clifton
8f196420ca Fix unit test compiler warnings on rc_controls_unittest 2014-11-01 10:50:30 +00:00
Dominic Clifton
28f9fa629c Add rate profiles and inflight switching between them. See Profiles and
Inflight Adjustment documentation for details.
2014-10-29 23:36:34 +00:00
Dominic Clifton
cac814923c Update RC Controls so that functions with different modes can be
applied.  The existing modes are 'step'.  A new mode is 'select'.

The other unit tests need fixing up so that appropriate code is compiled
as C and not C++ code.
2014-10-29 20:52:44 +00:00
Dominic Clifton
940552beb1 Fix incorrect CALL_COUNT_ITEM_COUNT value in rc_controls_unittest
preventing compilation via clang.
2014-10-28 15:45:03 +00:00
Dominic Clifton
e983c124c3 update rc_controls_unittest so it compiles and passes again. 2014-10-24 23:15:10 +01:00
Dominic Clifton
18abad5dd7 Extract range definition so it can be reused. 2014-10-24 18:57:06 +01:00
Dominic Clifton
b2db6b3b80 Beep when adjustments are made. (very short = adjust downwards, short =
adjust upwards).
2014-10-24 18:48:55 +01:00
Dominic Clifton
a2a9443045 Seperate adjustment configuration from adjustment state. Rename 'step'
parameter to 'delta' applying the adjustment.  Configure adjustment
states based on adjustment configuration for AUX3 and AUX4.
2014-10-24 15:46:07 +01:00
Dominic Clifton
45d9678a39 Use adjustment index rather than function to track state. 2014-10-24 15:10:28 +01:00
Dominic Clifton
02c93f1c1a Fix rc_controls_unittest to use midrc. 2014-10-24 14:57:46 +01:00
Dominic Clifton
6d7035819f First cut of allowing a 3POS switch on AUX3 to change rc rate.
rcRate is decreased when low, increased when HIGH and no change when the
switch is in the middle.

The rcRate ticks up/down at 0.01 every 500ms if the switch is left on.

If using a momentary switch and if you can toggle the switch between
middle and low or middle and high more frequently than 500ms then the
rate will be increased accordingly.  Similar to how a keyboard repeat
behaves.
2014-10-22 23:10:40 +01:00
Dominic Clifton
cfcd4792bb Determine with an aux range is used to arm. 2014-10-12 21:02:45 +01:00
Dominic Clifton
b43fa247de Handle channel boundaries better.
More efficient, less code, easier to understand.
2014-10-12 18:31:59 +01:00
Dominic Clifton
2369a63df0 First cut of code that passed the unit tests for mod activations,
however it uses / operations and doesn't handle the case where the
channel value is on the boundary between two ranges.
2014-10-12 18:15:44 +01:00
Dominic Clifton
5a36db26c9 Fix bug where aux configuration for channels 5-8 were ignored.
The bug was introduced by a recent refactor which was in error.

Fixed using TDD by first creating a failing unit test and then fixing
the code.
2014-09-06 00:28:48 +01:00
Dominic Clifton
ca72890964 Adding unit test for updateRcOptions 2014-09-05 23:44:06 +01:00