mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
initial take at configurable FEATURE_3D
completely untested and may attempt to kill you when enabled. no binary. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@360 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
e010e3a354
commit
3afeb3d1c8
6 changed files with 53 additions and 11 deletions
13
src/mw.c
13
src/mw.c
|
@ -433,6 +433,7 @@ void loop(void)
|
|||
static uint32_t loopTime;
|
||||
uint16_t auxState = 0;
|
||||
static uint8_t GPSNavReset = 1;
|
||||
bool isThrottleLow = false;
|
||||
|
||||
// this will return false if spektrum is disabled. shrug.
|
||||
if (spektrumFrameComplete())
|
||||
|
@ -444,6 +445,12 @@ void loop(void)
|
|||
if (!feature(FEATURE_SPEKTRUM))
|
||||
computeRC();
|
||||
|
||||
// in 3D mode, we need to be able to disarm by switch at any time
|
||||
if (feature(FEATURE_3D)) {
|
||||
if (!rcOptions[BOXARM])
|
||||
mwDisarm();
|
||||
}
|
||||
|
||||
// Failsafe routine
|
||||
if (feature(FEATURE_FAILSAFE)) {
|
||||
if (failsafeCnt > (5 * cfg.failsafe_delay) && f.ARMED) { // Stabilize, and set Throttle to specified level
|
||||
|
@ -481,7 +488,11 @@ void loop(void)
|
|||
rcSticks = stTmp;
|
||||
|
||||
// perform actions
|
||||
if (rcData[THROTTLE] < mcfg.mincheck) {
|
||||
if (feature(FEATURE_3D) && (rcData[THROTTLE] > (mcfg.midrc - mcfg.deadband3d_throttle) && rcData[THROTTLE] < (mcfg.midrc + mcfg.deadband3d_throttle)))
|
||||
isThrottleLow = true;
|
||||
else if (!feature(FEATURE_3D) && (rcData[THROTTLE] < mcfg.mincheck))
|
||||
isThrottleLow = true;
|
||||
if (isThrottleLow) {
|
||||
errorGyroI[ROLL] = 0;
|
||||
errorGyroI[PITCH] = 0;
|
||||
errorGyroI[YAW] = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue