1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00
Commit graph

55 commits

Author SHA1 Message Date
Dominic Clifton
acabbf41db Previously, at minimum throttle, the quad would do absolutely no self-leveling
and simply run the motors at constant minthrottle.  This allowed the chance
for the quad to lose control during flight if the throttle was set to minimum,
say, to drop from a high altitude to a lower one.

With this edit, the quad will still self-level at minimum throttle when armed,
allowing for safe decents from altitude.  To prevent motors spinning when
arming/disarming, the yaw input is ignored if the throttle is at minimum and
we're using the sticks to arm/disarm.

Conflicts:
	src/main/flight/mixer.c
2015-03-09 23:44:53 +01:00
Dominic Clifton
5e3734946e # This is a combination of 2 commits.
# The first commit's message is:

Previously, at minimum throttle, the quad would do absolutely no self-leveling
and simply run the motors at constant minthrottle.  This allowed the chance
for the quad to lose control during flight if the throttle was set to minimum,
say, to drop from a high altitude to a lower one.

With this edit, the quad will still self-level at minimum throttle when armed,
allowing for safe decents from altitude.  To prevent motors spinning when
arming/disarming, the yaw input is ignored if the throttle is at minimum and
we're using the sticks to arm/disarm.

Conflicts:
	src/main/flight/mixer.c

# This is the 2nd commit message:

added cli command disable_pid_at_min_throttle
2015-03-09 23:36:54 +01:00
Dominic Clifton
e4a6886266 Allow independent in-flight adjustment of roll and pitch. 2015-03-07 15:14:52 +00:00
Dominic Clifton
b595b49ca8 Decouple roll and pitch rates. MSP clients take note of updated
MSP_RC_TUNING/MSP_SET_RC_TUNING commands.
2015-03-07 15:11:20 +00:00
Dominic Clifton
55d9994ff8 Reset adjustment states when switching profiles.
Fixes #544.
2015-02-26 13:58:03 +00:00
Dominic Clifton
f88bbf4676 Avoid usage of methods for targets that don't use the display. 2015-02-22 15:22:17 +00:00
Dominic Clifton
4a1b27443f Enable/Disable LCD page cycling using stick combos. 2015-02-22 14:01:38 +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
53406a7ac7 Relocate some structures and code to the right places.
This cleans up the include file order somewhat and fixes a couple of
dependencies.

The goal of this is to rename flight.c/flight.h to pid.c/pid.h.
2015-01-31 23:47:51 +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
ea386e6da2 Remove magic number usage. Fix limits for FP based pid controller PID
adjustments to match those in serial_cli.c.
2015-01-30 21:27:09 +01:00
Dominic Clifton
f77a762b48 Allow inflight adjustments for floating-point based PID controllers. 2015-01-30 20:54:34 +01:00
Pierre Hugo
be03ed95fa Renamed min, max and abs macros to MIN MAX and ABS. 2015-01-23 22:40:00 -08:00
Dominic Clifton
b64c71264c Renaming getRcStickPosition to getRcStickDeflection and moving to
rc_controls.c.
2015-01-16 01:00:40 +00:00
Dominic Clifton
347b156727 Avoid calling mwDisarm() when due to having auto_disarm_delay when using
switch to arm().
2014-12-26 20:22:13 +00:00
Dominic Clifton
c0dbde0318 Fix unable to arm using after setting mode range for arm and being able
to arm using sticks after removing all mode ranges for arm.
2014-12-26 20:04:17 +00:00
Dominic Clifton
183c5f8e16 Add MPU9150 mag support and mag autodetection. Add AK8975 mag driver.
Note: not working on the sparky, MPU9150 needs passthough enabling but
when enabled the mag and gyro won't ack on the default addresses.  Needs
further investigation.
2014-12-21 23:40:48 +00:00
Dominic Clifton
705e64d91e Fix continuous beeping when rate profile selection is used. 2014-12-20 09:58:41 +00:00
Dominic Clifton
367eb79bd0 Add battery warning beeper. Update MSP_MISC/MSP_SET_MISC.
Note the old beeper was essentially 'battery critical'.
2014-12-19 22:16:47 +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
2df976409d Allow inflight adjustment of pitch/roll (linked) and yaw PID settings. 2014-10-24 23:10:17 +01:00
Dominic Clifton
7548154d25 Allow saving of config when disarmed by using THR_LO + YAW_LO + PIT_LO +
ROL_HI.
2014-10-24 22:39:40 +01:00
Dominic Clifton
4a90599e3a Allow inflight adjustment of throttle expo. 2014-10-24 22:16:49 +01:00
Dominic Clifton
f166ca3516 Allow inflight adjustment of yaw rate. 2014-10-24 22:01:31 +01:00
Dominic Clifton
9ddbb4ed9d Allow inflight adjustment of rc_expo. 2014-10-24 21:58:30 +01:00
Dominic Clifton
81e3425326 Allow inflight adjustment of pitch/roll rate. 2014-10-24 21:52:12 +01:00
Dominic Clifton
066c814a8a Update adjrange command to take an 'adjustment index/slot'. Apply
adjustment ranges to adjustment slots when channel is within range.

example:

```
adjrange 0 0 0 900 1700 0 2
adjrange 1 0 0 1700 2100 1 2
```

explained:

* configure adjrange 0 to use adjustment slot 1 (0) so that when aux1
(0) in the range 900-1700 then do nothing when aux 3 (2) is in any
position.
* configure adjrange 1 to use adjustment slot 1 (0) so that when aux1
(0) in the range 1700-2100 then do use adjustment 1 (rc rate) when aux 3
(2) is in the appropriate position.

Without the entire range of aux1 being defined there is nothing that
would stop aux 3 adjusting the rc rate once aux 1 wasn't in the higher
range. 

There are 4 adjustment slots and 12 adjustment ranges.

Adjustment slots and adjustment ranges can use the same aux channel.

e.g.

`adjrange 2 1 0 900 2100 1 3`

* configure adjrange 2 to use adjustment slot 2 (1) so that when aux4
(3) in the range 900-2100 then use adjustment 1 (rc rate) when aux 4 (3)
is in the appropriate position.
2014-10-24 20:49:00 +01:00
Dominic Clifton
bd39445be8 Add cli command to configure adjustment ranges.
e.g. `adjrange 0 0 1700 2100 1 2`

set adjustment range 0, which applies to aux channel 0 (aux1) when range
is between 1700 and 2100 then apply function 1 (rc rate) to aux channel
2 (aux3)
2014-10-24 19:51:40 +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
e21f0667c5 Update adjustmentConfig to include the adjustment timeout. 2014-10-24 14:58:41 +01:00
Dominic Clifton
b0b83b31db Make the adjustment controls more sensitive by using a smaller 3POS
switch deadzone.
2014-10-22 23:20:59 +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
ca9f183b83 Cleanup some aux range defines and comments. 2014-10-12 21:05:34 +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
c0fd0c1f33 Replace profile.activate and rcOptions with
profile.modeActivationCondition and rcModeActivationMask.

Implementation of using and setting modeActivationConditions is missing.
2014-10-12 10:40:38 +01:00
Dominic Clifton
d60183d91d Normalize all the line endings 2014-09-15 23:40:17 +01:00
Andreas Tacke
275089eca1 Make disarming via AUX switch independent of throttle value configurable
Conflicts:
	src/cli.c
	src/config.c
	src/mw.c
	src/mw.h
2014-09-08 11:02:02 +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
1c6ea1d397 Fix ANGLE mode and HORIZON mode resetting the errorAngle when they are
both attempted to be enabled at the same time.  Angle mode now takes
precedence over horizon mode.

Fix using aux settings that are not applicable to in-use aux channels -
prior to this it was possible to configure aux4 and then switch to
RX_SERIAL using a 7 channel system (3 aux channels) and aux4 would still
have been processed.
2014-08-26 21:28:23 +01:00
Dominic Clifton
9b4ccdc73a Only set OK-to-arm flag when arm switches are disabled.
This prevents arming after connecting a battery when the throttle is in
low; when using a switch to arm and when the switch is left in the ON
position.

The previous solution was flawed because of the way rc input is handled.

This also removes an extra test of rcOptions by re-arranging the logic
that handles arming/disarming via a switch.
2014-08-24 22:59:59 +01:00
Dominic Clifton
3f0754d295 Replace global flags with stateFlags, flightModeFlags and armingFlags.
Each flag was previously a whole byte, now all of the flags only take up
4 bytes as they are represented by bit masks.

This is cleaner because the different kind of flags are now separated.

Additionally this changes the behaviour of arming slightly.  When using
a switch to arm the aircraft will not arm unless the switch has been in
the off state once.  This prevents arming if you power the aircraft with
a low throttle and the switch in the on position.
2014-08-24 12:11:30 +01:00
treymarc
9cf90fa230 smallAngle configurable, user can arm/disarm with swith in any
orientation
Conflicts:

	src/cli.c
	src/config.c
	src/imu.c
	src/mw.c
	src/mw.h
2014-07-31 00:25:24 +01:00
Dominic Clifton
3b629d58a0 GPS can now be conditionally compiled in. 2014-07-30 23:35:33 +01:00