Browse Source

added separate yaw deadband from issue #6 after fixing some stuff. config version bumped again.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@132 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
master
timecop 13 years ago
parent
commit
791d67b4ee
  1. 1
      src/cli.c
  2. 3
      src/config.c
  3. 26
      src/mw.c
  4. 3
      src/mw.h

1
src/cli.c

@ -83,6 +83,7 @@ typedef struct {
const clivalue_t valueTable[] = {
{ "deadband", VAR_UINT8, &cfg.deadband, 0, 32 },
{ "yawdeadband", VAR_UINT8, &cfg.yawdeadband, 0, 100 },
{ "midrc", VAR_UINT16, &cfg.midrc, 1200, 1700 },
{ "minthrottle", VAR_UINT16, &cfg.minthrottle, 0, 2000 },
{ "maxthrottle", VAR_UINT16, &cfg.maxthrottle, 0, 2000 },

3
src/config.c

@ -9,7 +9,7 @@ config_t cfg;
const char rcChannelLetters[] = "AERT1234";
static uint32_t enabledSensors = 0;
static uint8_t checkNewConf = 7;
static uint8_t checkNewConf = 8;
void parseRcChannels(const char *input)
{
@ -123,6 +123,7 @@ void checkFirstTime(bool reset)
// Radio/ESC
parseRcChannels("AETR1234");
cfg.deadband = 0;
cfg.yawdeadband = 0;
cfg.spektrum_hires = 0;
cfg.midrc = 1500;
cfg.mincheck = 1100;

26
src/mw.c

@ -120,19 +120,27 @@ void annexCode(void)
for (axis = 0; axis < 3; axis++) {
uint16_t tmp = min(abs(rcData[axis] - cfg.midrc), 500);
if (cfg.deadband > 0) {
if (tmp > cfg.deadband) {
tmp -= cfg.deadband;
} else {
tmp = 0;
if (axis != 2) { // ROLL & PITCH
uint16_t tmp2;
if (cfg.deadband) {
if (tmp > cfg.deadband) {
tmp -= cfg.deadband;
} else {
tmp = 0;
}
}
}
if (axis != 2) { //ROLL & PITCH
uint16_t tmp2 = tmp / 100;
tmp2 = tmp / 100;
rcCommand[axis] = lookupRX[tmp2] + (tmp - tmp2 * 100) * (lookupRX[tmp2 + 1] - lookupRX[tmp2]) / 100;
prop1 = 100 - (uint16_t) cfg.rollPitchRate * tmp / 500;
prop1 = (uint16_t)prop1 * prop2 / 100;
} else { //YAW
} else { // YAW
if (cfg.yawdeadband) {
if (tmp > cfg.yawdeadband) {
tmp -= cfg.yawdeadband;
} else {
tmp = 0;
}
}
rcCommand[axis] = tmp;
prop1 = 100 - (uint16_t)cfg.yawRate * tmp / 500;
}

3
src/mw.h

@ -157,7 +157,8 @@ typedef struct config_t {
// Radio/ESC-related configuration
uint8_t rcmap[8]; // mapping of radio channels to internal RPYTA+ order
uint8_t deadband; // introduce a deadband around the stick center. Must be greater than zero
uint8_t deadband; // introduce a deadband around the stick center for pitch and roll axis. Must be greater than zero.
uint8_t yawdeadband; // introduce a deadband around the stick center for yaw axis. Must be greater than zero.
uint8_t spektrum_hires; // spektrum high-resolution y/n (1024/2048bit)
uint16_t midrc; // Some radios have not a neutral point centered on 1500. can be changed here
uint16_t mincheck; // minimum rc end

Loading…
Cancel
Save