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:
parent
509e349e69
commit
929bbc8c3f
|
@ -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 },
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -151,23 +151,23 @@ static void pwmOCConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t value)
|
|||
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
|
||||
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
|
||||
|
||||
switch (channel) {
|
||||
case TIM_Channel_1:
|
||||
TIM_OC1Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC1PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_2:
|
||||
TIM_OC2Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC2PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_3:
|
||||
TIM_OC3Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC3PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_4:
|
||||
TIM_OC4Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC4PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
switch (channel) {
|
||||
case TIM_Channel_1:
|
||||
TIM_OC1Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC1PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_2:
|
||||
TIM_OC2Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC2PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_3:
|
||||
TIM_OC3Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC3PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
case TIM_Channel_4:
|
||||
TIM_OC4Init(tim, &TIM_OCInitStructure);
|
||||
TIM_OC4PreloadConfig(tim, TIM_OCPreload_Enable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
src/mixer.c
11
src/mixer.c
|
@ -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:
|
||||
|
|
1
src/mw.h
1
src/mw.h
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue