1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

readded support for failsafe (thanks rimshotcopter for bugging me about it for a month)

new config ooptions for failsafe, so current settings are cleared
fixed mistake where yaw servo stuff for tri was still hardcoded even though it had configurable values in cli
reduced level default D to 20 from 100 (dunno what effect this has, shrug)
untested, enable feature FAILSAFE at your own risk.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@155 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop 2012-05-09 05:29:30 +00:00
parent 6da3320be8
commit 18db641282
13 changed files with 5303 additions and 5182 deletions

View file

@ -1,14 +1,14 @@
#include "board.h"
#define PULSE_1MS (1000) // 1ms pulse width
// #define PULSE_PERIOD (2500) // pulse period (400Hz)
// #define PULSE_PERIOD_SERVO_DIGITAL (5000) // pulse period for digital servo (200Hz)
// #define PULSE_PERIOD_SERVO_ANALOG (20000) // pulse period for analog servo (50Hz)
// Forward declaration
static void pwmIRQHandler(TIM_TypeDef *tim);
static void ppmIRQHandler(TIM_TypeDef *tim);
// external vars (ugh)
extern int16_t failsafeCnt;
// local vars
static struct TIM_Channel {
TIM_TypeDef *tim;
@ -92,6 +92,7 @@ static void ppmIRQHandler(TIM_TypeDef *tim)
Inputs[chan].capture = diff;
}
chan++;
failsafeCnt = 0;
}
}
@ -145,6 +146,8 @@ static void pwmIRQHandler(TIM_TypeDef *tim)
// switch state
state->state = 0;
// reset failsafe
failsafeCnt = 0;
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
TIM_ICInitStructure.TIM_Channel = channel.channel;