added (untested) flag to disable tricopter servo updates when unarmed.

tri_unarmed_servo to 1 (default) always updates tri servo whether armed or not.
tri_unarmed_servo to 0 will only send servo signal to tail servo when armed.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@392 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2013-09-06 00:03:32 +00:00
parent 509e349e69
commit 929bbc8c3f
5 changed files with 31 additions and 19 deletions

View File

@ -153,6 +153,7 @@ const clivalue_t valueTable[] = {
{ "failsafe_throttle", VAR_UINT16, &cfg.failsafe_throttle, 1000, 2000 },
{ "failsafe_detect_threshold", VAR_UINT16, &cfg.failsafe_detect_threshold, 100, 2000 },
{ "yaw_direction", VAR_INT8, &cfg.yaw_direction, -1, 1 },
{ "tri_unarmed_servo", VAR_INT8, &cfg.tri_unarmed_servo, 0, 1 },
{ "tri_yaw_middle", VAR_UINT16, &cfg.tri_yaw_middle, 0, 2000 },
{ "tri_yaw_min", VAR_UINT16, &cfg.tri_yaw_min, 0, 2000 },
{ "tri_yaw_max", VAR_UINT16, &cfg.tri_yaw_max, 0, 2000 },

View File

@ -13,7 +13,7 @@ master_t mcfg; // master config struct with data independent from profiles
config_t cfg; // profile config struct
const char rcChannelLetters[] = "AERT1234";
static const uint8_t EEPROM_CONF_VERSION = 49;
static const uint8_t EEPROM_CONF_VERSION = 50;
static uint32_t enabledSensors = 0;
static void resetConf(void);
@ -274,6 +274,7 @@ static void resetConf(void)
// servos
cfg.yaw_direction = 1;
cfg.tri_unarmed_servo = 1;
cfg.tri_yaw_middle = 1500;
cfg.tri_yaw_min = 1020;
cfg.tri_yaw_max = 2000;

View File

@ -206,7 +206,16 @@ void writeServos(void)
break;
case MULTITYPE_TRI:
pwmWriteServo(0, servo[5]);
if (cfg.tri_unarmed_servo) {
// if unarmed flag set, we always move servo
pwmWriteServo(0, servo[5]);
} else {
// otherwise, only move servo when copter is armed
if (f.ARMED)
pwmWriteServo(0, servo[5]);
else
pwmWriteServo(0, 0); // kill servo signal completely.
}
break;
case MULTITYPE_AIRPLANE:

View File

@ -189,6 +189,7 @@ typedef struct config_t {
// mixer-related configuration
int8_t yaw_direction;
uint8_t tri_unarmed_servo; // send tail servo correction pulses even when unarmed
uint16_t tri_yaw_middle; // tail servo center pos. - use this for initial trim
uint16_t tri_yaw_min; // tail servo min
uint16_t tri_yaw_max; // tail servo max