Commit Graph

232 Commits

Author SHA1 Message Date
Dominic Clifton 36a3ee4e59 Merge branch 'rcFilter' of https://github.com/borisbstyle/cleanflight into borisbstyle-rcFilter 2015-09-29 10:36:41 +01:00
borisbstyle 26f89b74bd Configurable Baro Type
We can disable/configure mag, acc, but why not baro?

ident
2015-09-10 02:22:50 +01:00
Dominic Clifton 9208b8701a Merge pull request #1255 from ProDrone/pr1233_rxfail_mode_changes_1
Changed behavior of PR #1233 - solves issue #1254
2015-09-05 23:01:11 +01:00
Dominic Clifton b6c504dc88 Merge pull request #1263 from ProDrone/prevent_arming_when_in_cli
Prevent arming when in CLI mode
2015-09-05 22:55:06 +01:00
Dominic Clifton 0caf8a65ba Merge pull request #852 from ProDrone/Failsafe_features_1
Failsafe - New failsafe functionality (Phase 1)
2015-09-05 22:50:34 +01:00
Dominic Clifton cb147ec85e Fix CJMCU build, broken by df92691410 2015-09-05 20:34:40 +01:00
Dominic Clifton 564c131db5 Merge pull request #1283 from sppnk/patch-4
Fixing servo command parsing of "rate" field
2015-09-05 18:53:33 +01:00
Dominic Clifton df92691410 update dump command to show per-profile servo reverse settings. See
#1140.
2015-09-05 18:01:36 +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
ProDrone a46832fd85 Changed behavior of PR #1233 and doc update
Stick channels only have AUTO and HOLD mode.
AUX channels only have SET and HOLD mode.
Added check to parameter in CLI.
Modified rx.md to reflect changes (and more).

+1 squashed commit:

- A cleaner approach for the same functionality

Basically addressing all comments from Hydra
2015-09-04 16:51:19 +02:00
ProDrone 3b9cd37a57 Prevent arming when in CLI mode 2015-09-04 16:46:03 +02:00
sppnk 45d31f2290 Fixing servo command bug
The limits for RATE were bad, so we had a "Parse error" when changing rate values other than 100.
2015-09-03 16:47:00 +02:00
borisbstyle b69bab33b2 Configurable RC Smoothing 2015-09-01 23:41:56 +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 a030d4dd9e Failsafe - Add rxfail `auto` mode. Allow rxfail to be used for all
channels, not just aux channel.
2015-08-20 01:37:29 +01:00
Dominic Clifton cb92878fd0 Merge pull request #1172 from digitalentity/magzero-cli
Add ability to get/set mag calibration data
2015-08-11 22:16:45 +01:00
Dominic Clifton 463437fb45 Ensure battery status strings are stored in the flash. 2015-08-04 03:10:34 +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 490268d2fc Failsafe - Allow AUX channels to HOLD their last value or be SET to a
specific value when RX loss is detected.

Tested with SBus, PWM & PPM.
2015-08-03 18:16:28 +01:00
Dominic Clifton 3436b08575 Failsafe - Remove magic number usage. Cleanup whitespace 2015-08-03 17:03:53 +01:00
Konstantin Sharlaimov (DigitalEntity) a30897c440 Add ability to get/set mag calibration data 2015-07-31 23:05:12 +10:00
ProDrone 08b376f2a5 RPY to mid-stick and T to lowest (or mid for 3D).
On bad (out-of-range) pulses; ROLL, PITCH, YAW will go to `mid_rc` and
THROTTLE will go to `rx_min_usec` (to `mid_rc` for 3D mode). So these
channels will no longer be set by the user directly.
Fallback values for the aux switches (0 .. max) can be set with this
version. Since these switches may trigger all kind of things, the user
needs control over them in case of a RX failsafe event.

A single flight control channel failure (first 4) when using parallel
PWM is interpreted as a failure for all flight control channels (first
4), since the craft may be uncontrollable when one channel is down. (+4
squashed commit)

Squashed commit:

[dbfea9e] Apply fallback values also when serial_rx init failed and/or
RX
disconnected and/or no signal received.

[b5a2ecd] Added get/set MSP commands for RXFAIL config

Bumped API minor version up.

[c0e31ce] minor change for coding standard

[322705f] Added programmable RX channel defaults on rx lost Update #2
2015-07-31 14:35:14 +02: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 676b2dd6c0 Use the define USE_FLASH_M25P16. Only USE_FLASHTOOLS for some
development targets.
2015-07-13 03:28:34 +01:00
Dominic Clifton cc06113c8f Rename `yaw_direction` to `yaw_motor_direction` to avoid confusion
between `yaw_control_direction` and yaw servo configuration.
2015-07-13 01:54:45 +01:00
Dominic Clifton d23dc246d0 Add some error checking to the servo command. 2015-07-13 00:57:44 +01:00
Dominic Clifton 4a3970c9ab Fix range argument processing. 2015-07-09 22:13:21 +01:00
Dominic Clifton 62d638b2d9 Update smix reverse to use 'r' or 'n' for reverse or normal to a) match
the table, b) be more user friendly.
2015-07-09 21:15:11 +01:00
Dominic Clifton c9f5ca3faf Deleted code specific to fixed wing that set motors to mincommand when
disarmed.

Ensure that servo mixes that use calculated throttle output (motor 0)
adhere to the armed/disarmed state, this is achieved by ensuring that
motor outputs, including the effects of MOTOR_STOP are calculated BEFORE
using motor 0 as an input source for the servo mixer.
2015-07-09 20:23:37 +01:00
Dominic Clifton 7b91524ba2 Replace gimbal_flags with FEATURE_CHANNEL_FORWARDING and gimbal_mode.
Gimbals are only one use of channel forwarding, PWM video switchers and
PWM buzzers are others.
2015-07-08 16:41:29 +01:00
Dominic Clifton 774a36a2d5 Avoid print smix table header multiple times. 2015-07-08 14:48:23 +01:00
Dominic Clifton 763c75873e Use 0 based index for motor and servo mix in CLI. Update
MSP_SERVO_MIX_RULES, MSP_SET_SERVO_MIX_RULE, MSP_SERVO_CONFIGURATIONS,
MSP_SET_SERVO_CONFIGURATION.  Delete MSP_CHANNEL_FORWARDING,
MSP_SET_CHANNEL_FORWARDING.
2015-07-08 12:54:09 +01:00
Dominic Clifton bb0f909e83 Merge branch 'master' into custom-servo-mixers 2015-07-08 12:11:49 +01:00
Dominic Clifton e48e50512e Merge pull request #1028 from borisbstyle/dterm_filter
Selective Software Filtering (Gyro, Dterm, Pterm)

Thanks for the code boris and thanks to everyone else for their testing and feedback
2015-06-29 16:00:49 +01:00
Dominic Clifton 45cd2671a5 Use tabs instead of spaces for servo mix table header. 2015-06-29 03:51:55 +01:00
Dominic Clifton 08afcaf536 Ensure dump uses correct command names.
Use shorter command names (mmix and smix) instead of longer ones
(motormix) and (mmix).

Decrease verbosity of dump command by only outputting commands to
reverse servos for servos that are reversed.
2015-06-29 03:51:05 +01:00
Petr Ledvina 68dd60b0e7 Use loop for CLI command search instead of bsearch library function, improve matching
Command end is now tested, `savefail` wont be recognized as command now (but `save+fail` is)
2015-06-29 03:31:16 +01:00
Dominic Clifton b5e18a90a2 Cleanup CLI
* optimize for code size.
* consolidate error message handling.
* replace similar error messages with identical ones.
* shorten all strings where possible.
* made less verbose.

This was required for the CC3D OPBL build.
2015-06-29 03:30:17 +01:00
Dominic Clifton 9389239207 Removing custom mixer sanity check, it gives bad result to good mixers.
See #864.
2015-06-29 00:05:13 +01:00
Dominic Clifton 7a1d071efb Add support for custom tricopter mixer.
See #606.
2015-06-28 23:11:47 +01:00
Dominic Clifton ea6a6ccb3d First cut of custom servo mixers.
Main rule logic and MSP commands ported from baseflight.

Gimbal mixer updated to use rules.  This allows us to remove more
conditional logic.  Operation of gimbal servos is now different.
2015-06-28 23:06:56 +01:00
Dominic Clifton c142e3dfe9 Rename minLimit/maxLimit to angleAtMin and angleAtMax. Remove unneeded
MSP_SET_SERVO_LIMIT.  Bump MSP API version.  Add basic sanity checks to
MSP_SET_SERVO_CONF, reset all servos and adhere to the msp packet's data
size.
2015-06-28 12:22:14 +01:00
Mauro Mombelli da6ee6ffb7 first extract from Tilting for Servo pull request 2015-06-28 12:06:33 +01:00
borisbstyle 10f2d35759 Soft Filtering (Gyro, Dterm, Pterm)
pterm_cut_hz added

Let's play with this as well to get more noise filtered

Code Cleanup

Make filter more flexible for reuse

rewrite correction pterm

Define static delta in filter

Fix array count

ident

return function for filter

Filter Function enhanced

Full software filtering (DTerm, PTerm, Gyro, Acc)

Normalize Variables

Revert Back gyro settings

Bugfix gyro/acc filter // (MPU60xx equalize lpf settings)

Moved filtering to mw.c

This has been done to prevent reusing old cycletime for filter function.

acc_cut_hz removed (not needed)

Harakiri zero fix
2015-06-27 14:13:10 +02:00
Michael Hope 3740779912 serial_cli: use the reentrant version of strtok().
Newlib's strtok() allocates memory and causes malloc() to be linked
in.  Use the reentrant version instead.

Saves 336 bytes.

Signed-off-by: Michael Hope <mlhx@google.com>
2015-06-10 11:06:33 +01:00
Dominic Clifton 98f7549aa4 Fix `serial` command handling of telemetry baud rates. Set min blackbox
bad rate to be 19200 to match the confiurator.
2015-05-31 12:36:10 +01:00
Dominic Clifton ca22fb0ee3 Replace CLI serial port configuration code with a new `serial` command.
This is done to make it clearer in configuration dumps which ports are
enabled and configured.

There is a nice code size reduction due to less strings being needed.

Serial documentation updated.

Closes #966.
2015-05-31 11:50:58 +01:00
Dominic Clifton 0c1a6c5c2f Merge branch 'lock_active_features' of https://github.com/ProDrone/cleanflight into ProDrone-lock_active_features
Conflicts:
	src/test/unit/rc_controls_unittest.cc
2015-05-29 20:05:25 +01:00