Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1633 → Rev 1634

/branches/dongfang_FC_rewrite/rc.c
56,6 → 56,10
#include "controlMixer.h"
#include "configuration.h"
 
// for DebugOut only.
#include "uart0.h"
 
 
// The channel array is 1-based. The 0th entry is not used.
volatile int16_t PPM_in[MAX_CHANNELS];
volatile int16_t PPM_diff[MAX_CHANNELS];
127,7 → 131,7
____ ______ _____ ________ ______ sync gap ____
| | | | | | | | | | |
| | | | | | | | | | |
___| |_| |_| |_| |_.............| |________________|
___| |_| |_| |_| |_.............| |________________|
<-----><-------><------><--------> <------> <---
t0 t1 t2 t4 tn t0
 
212,8 → 216,12
if(RC_Quality) {
RC_Quality--;
if (NewPpmData-- == 0) {
 
DebugOut.Analog[12] = stickOffsetPitch;
DebugOut.Analog[13] = stickOffsetRoll;
 
RC_PRTY[CONTROL_PITCH] = (RCChannel(CH_PITCH) - stickOffsetPitch) * staticParams.StickP + RCDiff(CH_PITCH) * staticParams.StickD;
RC_PRTY[CONTROL_ROLL] = (RCChannel(CH_ROLL) - stickOffsetRoll) * staticParams.StickP + RCDiff(CH_ROLL) * staticParams.StickD;
RC_PRTY[CONTROL_ROLL] = (RCChannel(CH_ROLL) - stickOffsetRoll) * staticParams.StickP + RCDiff(CH_ROLL) * staticParams.StickD;
RC_PRTY[CONTROL_THROTTLE] = RCChannel(CH_THROTTLE) + PPM_diff[staticParams.ChannelAssignment[CH_THROTTLE]] * dynamicParams.UserParams[6] + 120;
if (RC_PRTY[CONTROL_THROTTLE] < 0) RC_PRTY[CONTROL_THROTTLE] = 0; // Throttle is non negative.
tmp1 = -RCChannel(CH_YAW) - RCDiff(CH_YAW);
276,8 → 284,8
// In HH, it s OK to trim the R/C. The effect should not be conteracted here.
stickOffsetPitch = stickOffsetRoll = 0;
} else {
stickOffsetPitch += RCChannel(CH_PITCH);
stickOffsetRoll += RCChannel(CH_ROLL);
stickOffsetPitch = RCChannel(CH_PITCH);
stickOffsetRoll = RCChannel(CH_ROLL);
}
}