core.numRCChannels now set by RC drivers to show max inputs available.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@433 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2013-10-12 06:58:28 +00:00
parent 6bbc8fdb22
commit 37b73a057b
4 changed files with 5 additions and 2 deletions

View File

@ -254,7 +254,7 @@ static void ppmCallback(uint8_t port, uint16_t capture)
if (diff > 2700) { // Per http://www.rcgroups.com/forums/showpost.php?p=21996147&postcount=3960 "So, if you use 2.5ms or higher as being the reset for the PPM stream start, you will be fine. I use 2.7ms just to be safe."
chan = 0;
} else {
if (diff > 750 && diff < 2250 && chan < 8) { // 750 to 2250 ms is our 'valid' channel range
if (diff > 750 && diff < 2250 && chan < MAX_INPUTS) { // 750 to 2250 ms is our 'valid' channel range
captures[chan] = diff;
if (chan < 4 && diff > failsafeThreshold)
GoodPulses |= (1 << chan); // if signal is valid - mark channel as OK

View File

@ -80,8 +80,9 @@ int main(void)
pwmInit(&pwm_params);
// configure PWM/CPPM read function. spektrum or sbus below will override that
// configure PWM/CPPM read function and max number of channels. spektrum or sbus below will override both of these, if enabled
rcReadRawFunc = pwmReadRawRC;
core.numRCChannels = MAX_INPUTS;
if (feature(FEATURE_SERIALRX)) {
switch (mcfg.serialrx_type) {

View File

@ -26,6 +26,7 @@ void sbusInit(rcReadRawDataPtr *callback)
core.rcvrport = uartOpen(USART2, sbusDataReceive, 100000, MODE_RX);
if (callback)
*callback = sbusReadRawRC;
core.numRCChannels = SBUS_MAX_CHANNEL;
}
struct sbus_dat

View File

@ -37,6 +37,7 @@ void spektrumInit(rcReadRawDataPtr *callback)
core.rcvrport = uartOpen(USART2, spektrumDataReceive, 115200, MODE_RX);
if (callback)
*callback = spektrumReadRawRC;
core.numRCChannels = SPEK_MAX_CHANNEL;
}
// Receive ISR callback