simplify serialrx by Cesco

fix bug in softserial with digitalIn usage (todo rewrite this properly)

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@425 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2013-10-02 00:10:40 +00:00
parent fa810e907a
commit 5332b78200
2 changed files with 7 additions and 10 deletions

View File

@ -17,7 +17,7 @@ void onSerialTimer(uint8_t portIndex, uint16_t capture);
uint8_t readRxSignal(softSerial_t *softSerial)
{
return digitalIn(softSerial->rxTimerHardware->gpio, softSerial->rxTimerHardware->pin);
return !(digitalIn(softSerial->rxTimerHardware->gpio, softSerial->rxTimerHardware->pin) == 0);
}
void setTxSignal(softSerial_t *softSerial, uint8_t state)

View File

@ -435,28 +435,25 @@ void loop(void)
uint16_t auxState = 0;
static uint8_t GPSNavReset = 1;
bool isThrottleLow = false;
bool rcReady = false;
// calculate rc stuff from serial-based receivers (spek/sbus)
if (feature(FEATURE_SERIALRX)) {
bool ready = false;
switch (mcfg.serialrx_type) {
case SERIALRX_SPEKTRUM1024:
case SERIALRX_SPEKTRUM2048:
ready = spektrumFrameComplete();
rcReady = spektrumFrameComplete();
break;
case SERIALRX_SBUS:
ready = sbusFrameComplete();
rcReady = sbusFrameComplete();
break;
}
if (ready)
computeRC();
}
if ((int32_t)(currentTime - rcTime) >= 0) { // 50Hz
if (((int32_t)(currentTime - rcTime) >= 0) || rcReady) { // 50Hz or data driven
rcReady = false;
rcTime = currentTime + 20000;
// TODO clean this up. computeRC should handle this check
if (!feature(FEATURE_SERIALRX))
computeRC();
computeRC();
// in 3D mode, we need to be able to disarm by switch at any time
if (feature(FEATURE_3D)) {