Commit Graph

186 Commits

Author SHA1 Message Date
Martin Budden e9a46c6ebb Cleanup of acc device drivers extern usage CF PR#2117 2016-06-16 18:09:05 +01:00
Martin Budden f0f2941bb6 Moved scheduler into separate directory. Moved task declarations into header file. 2016-06-15 07:35:17 +01:00
borisbstyle 7386d88d0e Merge corrections 2016-03-01 14:55:04 +01:00
Martin Budden 01a19cdc04 Post rebase fixup. 2016-03-01 12:39:37 +01:00
Martin Budden 32c4348357 Some rework before rebase. 2016-03-01 12:39:26 +01:00
Martin Budden cd3b584879 Added test to check filling up and emptying queue. 2016-03-01 12:39:20 +01:00
Martin Budden 3fa0163713 More test code. Fixed bug in queueAdd. 2016-03-01 12:39:12 +01:00
Martin Budden 63db2d00f3 Stoppd using TASK_BEEPER in tests, since this is undefined. 2016-03-01 12:38:59 +01:00
Martin Budden 757fb54512 Optimised scheduler queue iterators. 2016-03-01 12:14:21 +01:00
Martin Budden b22610b9e5 Unittests 2016-03-01 12:13:30 +01:00
borisbstyle 83d8a8441c Remove lowpass.c // replace by pt1
unittests fix
2016-02-10 09:31:55 +01:00
Dominic Clifton e7620727ff Fix led strip unit test compilation warning. 2016-02-02 23:36:22 +01:00
borisbstyle cb7028b7f1 Merge remote-tracking branch 'prodrone/improved_rx_failsafe_detection' into betaflight
Conflicts:
	src/main/drivers/accgyro_mpu6500.c
	src/main/drivers/accgyro_spi_mpu6000.c
	src/main/drivers/system.c
	src/main/mw.c
	src/main/rx/rx.c
	src/main/sensors/initialisation.c
2015-10-21 09:21:33 +02:00
ProDrone a64e2c4f1a Improved RX failsafe detection & handling
modified debug output (currently disabled)

To solve problem as indicated here:
https://github.com/cleanflight/cleanflight/issues/1266#issuecomment-135640133

and here:
https://github.com/cleanflight/cleanflight/pull/1340

and here:
https://github.com/cleanflight/cleanflight/pull/1342

Tested on FrSKY X4RSB with latest CPPM firmware (non-EU version).
Firmware filename: X4R-X4RSB_cppm_non-EU_150630

In both SBUS and CPPM mode.

---
Added delay to rxfail detection

All channels are monitored for bad (out of valid range) pulses.
On bad pulses channel data will HOLD the last value for a period of
MAX_INVALID_PULS_TIME (300ms) before starting rxfail substitution.
This should prevent a too aggressive reaction to small dropouts.

---
Init ARM switch rc channel to OFF for safety

Initialize ARM switch to OFF position when arming via switch is defined.
To prevent arming during init when RX is disconnected and/or when RX is
connected but TX is still off.

---
Modified rx_rx_unittest.cc

Adapted because rxInit() parameters changed.
Added tests for ARM switch initialization.
No further tests added.

---
Move smoothing of rcData to rcCommand

Commit from @borisbstyle pr #1418
rc_smoothing function has changed to leave rcData unchanged in #1418
2015-10-21 01:50:59 +02:00
Dominic Clifton ddc5a5f15f Add IRQn_Type to tests to fix compilation errors. 2015-10-16 10:40:59 +02:00
Dominic Clifton 526f4777a2 Add IRQn_Type to tests to fix compilation errors. 2015-10-16 08:24:19 +01:00
borisbstyle 4b3ba927e9 Merge branch 'master' into betaflight
Conflicts:
	src/main/blackbox/blackbox_io.c
	src/main/drivers/serial_usb_vcp.c
	src/main/flight/imu.c
	src/main/mw.c
	src/main/target/CC3D/target.h
2015-10-12 23:53:43 +02:00
Dominic Clifton a319394f6b Merge branch 'blackbox-serial-budget' of https://github.com/sherlockflight/cleanflight-dev into sherlockflight-blackbox-serial-budget
Conflicts:
	src/main/blackbox/blackbox.c
2015-10-12 20:14:20 +01:00
Petr Ledvina 8f3d9fae9a unify `typedef struct name_s {} name_t;` naming convention 2015-10-12 19:58:12 +01:00
borisbstyle 12c9f65f43 Merge branch 'master' into betaflight
Conflicts:
	Makefile
	docs/Cli.md
	src/main/config/config.c
	src/main/drivers/accgyro_mpu3050.c
	src/main/drivers/accgyro_mpu6050.c
	src/main/drivers/accgyro_mpu6050.h
	src/main/drivers/accgyro_spi_mpu6000.c
	src/main/drivers/accgyro_spi_mpu6000.h
	src/main/drivers/accgyro_spi_mpu6500.c
	src/main/drivers/accgyro_spi_mpu6500.h
	src/main/drivers/barometer_bmp280.c
	src/main/drivers/sensor.h
	src/main/flight/pid.c
	src/main/mw.c
	src/main/rx/rx.c
	src/main/sensors/initialisation.c
	src/main/target/CC3D/target.h
2015-10-07 17:12:54 +02:00
Sean Vig 456396b25a Use fixed point calculation for BMP280 barometer
Substitute the floating point calculation for the comparably much faster
64-bit calculation recommended for a Cortex-M3 (floating point is
recommended only in PC applications with FPU) [1]. Even if we have an
FPU, we round the temperature to the nearest 1/100th of a degree and the
pressure to the nearest 1 Pa, both of which are within the limits of the
fixed-point algorithm's accuracy.

Conflicts:
	src/main/drivers/barometer_bmp280.c
2015-10-06 18:33:23 +01:00
Sean Vig e5f3f1794f Add tests for BMP280 barometer
Also get rid of the curved quotes for normal quotes (") and make
compensation computations static.
2015-10-06 18:25:59 +01:00
Nicholas Sherlock 6e504ca52a Ability to see how many Tx bytes are free in serial port buffer 2015-10-01 16:48:56 +13:00
borisbstyle 0ea5a99e2b Merge remote-tracking branch 'prodrone/betaflight' into alphaflight 2015-09-19 16:44:11 +02:00
Konstantin Sharlaimov (DigitalEntity) 45a4f11f92 Added #define for imu debug output (+16 squashed commit)
Squashed local commits:

from       : e4265d4a13f63f82d5cf55eea2c091622f96660b
up to (inc): 72416dc74745fa8bae1aded79aa4b9ed0e389076
2015-09-19 14:50:53 +02: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 6706abdb2e Merge branch 'issue_8_sensors_align' of
https://github.com/drtunes/cleanflight into
drtunes-issue_8_sensors_align

Conflicts:
	src/test/Makefile
2015-09-10 02:38:58 +01:00
Dominic Clifton c4680b3b3d More test code cleanup. 2015-09-10 02:06:15 +01: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
Dominic Clifton 4737f33b19 revert "tests: simplify the build config by building as a library" 2015-09-10 02:06:13 +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 718729504e Allow FC to reverse input channels by using rxrange.
Just reverse the min/max arguments.

Unit tested.

Fixes #1132.
2015-08-20 02:46:03 +01:00
Dominic Clifton 2c79b9777e Large code re-organization which separates some key tasks in the rx
code.

Tested with X8R in SBus and PWM, and Spek Sat, GR-24 PPM, PWM and SUMD,
Spek PPM
2015-08-20 01:46:29 +01:00
Phillip Jones f239eb3f35 This addresses issue #8 by adding unit tests for sensorsAlign().
The test file includes a simple independent implementation of
vector rotation. Each of the following sensor_align_e types are
tested:
 * CW0_DEG
 * CW90_DEG
 * CW180_DEG
 * CW270_DEG
 * CW0_DEG_FLIP
 * CW90_DEG_FLIP
 * CW180_DEG_FLIP
 * CW270_DEG_FLIP

For each test, three unit vectors and a random vector are tested.
 * {1, 0, 0}
 * {0, 1, 0}
 * {0, 0, 1}
 * {R, R, R} (where R is a random number)

The vector under test is rotated using the functions defined in the
test file. The output of the test function is compared to the
output of the sensorsAlign() function. The outputs match for all
test conditions.
2015-08-18 14:00:37 -06:00
Dominic Clifton 3878a7ea2c make the rollover pattern tests less verbose 2015-08-18 19:08:37 +01:00
EvilBadger 3879b6c566 Modified VBatt functionality to enable better precision. 2015-08-05 21:34:44 +01:00
Dominic Clifton 7202ad7524 Cleanup vbat time rollover. Cleanup whitespace. Code formatting.
Rename VBAT_DETECT to VBATT_PRESENT_THRESHOLD_MV.

Add two tests that show the two timing patterns that are in use in the
codebase.
2015-08-04 03:04:54 +01:00
DarkVegetableMatter 942c89237e Battery auto-detect and LPF for battery monitoring 2015-08-04 03:04:12 +01:00
Dominic Clifton 9d3276b222 Code and documentation cleanup of rc calibration.
Note: since it didn't actually calibrate anything it has been renamed to
rxrange.

Added ability to reset rxranges using `rxrange reset` - this follows the
same pattern as other cli commands.
2015-08-04 01:13:28 +01:00
Dominic Clifton 27f8223de7 Merge branch 'rc-calibration' of
https://github.com/digitalentity/cleanflight into
digitalentity-rc-calibration

Conflicts:
	docs/Rx.md
	src/main/io/serial_cli.c
	src/main/rx/rx.c
	src/main/rx/rx.h
2015-08-04 00:06:12 +01:00
Dominic Clifton 1ef2d8ea4d Cleanup PWM rx loss detection. 2015-08-03 20:17:47 +01:00
Dominic Clifton c5dbf16060 De-duplicate mixer integration test code. 2015-07-17 01:05:14 -07:00
Dominic Clifton cfe0d770ac De-duplicate mixer tri and quad integration test setup code. 2015-07-17 01:05:14 -07:00
Dominic Clifton 9f62349191 De-duplicte some Channel forwarding test-setup code 2015-07-17 01:05:14 -07:00
Dominic Clifton 5be2276b6b First cut of custom motor and servo mixer test.
Note: The test is rather heavyweight, more like an integration test than
a unit test, but will allow for the underlying code to be refactored.
2015-07-17 01:05:14 -07:00
digitalentity 2614111c39 Implemented RC calibration and unit-tests
Added rc calibration docs to Rx.md
2015-07-16 08:49:18 +10:00
Dominic Clifton 4c8f7db2c9 Updating the test suite names for some new MS5611 barometer tests. 2015-07-10 01:35:11 +01:00
Dominic Clifton 18699a1ba2 Merge branch 'baro_pressure_unit_test' of https://github.com/SteveAmor/cleanflight into SteveAmor-baro_pressure_unit_test 2015-07-10 01:32:40 +01:00
Dominic Clifton d3e359b9e0 Merge branch 'bmp085_unit_test' of
https://github.com/SteveAmor/cleanflight into SteveAmor-bmp085_unit_test

Conflicts:
	src/test/Makefile
2015-07-10 01:29:42 +01:00
Dominic Clifton 9f76ec3845 Merge branch 'incremental-test' of https://github.com/nzmichaelh/cleanflight into nzmichaelh-incremental-test 2015-07-10 01:18:55 +01:00