mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
reorganization of uart-based receiver drivers
FEATURE_SPEKTRUM has been removed and replaced with FEATURE_SERIALRX. cli option serialrx_type now configures what type of receiver it is 0 = spektrum1024, 1 = spektrum2048, 2 = sbus sbus will need hardware inverter to use. also cleaned up receiver drivers to assign readrawRC callback instead of assigning in code in main() none of this has been tested. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@418 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
04ab548d2e
commit
2272e1a5a6
10 changed files with 191 additions and 31 deletions
20
src/mw.c
20
src/mw.c
|
@ -436,14 +436,26 @@ void loop(void)
|
|||
static uint8_t GPSNavReset = 1;
|
||||
bool isThrottleLow = false;
|
||||
|
||||
// this will return false if spektrum is disabled. shrug.
|
||||
if (spektrumFrameComplete())
|
||||
computeRC();
|
||||
// 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();
|
||||
break;
|
||||
case SERIALRX_SBUS:
|
||||
ready = sbusFrameComplete();
|
||||
break;
|
||||
}
|
||||
if (ready)
|
||||
computeRC();
|
||||
}
|
||||
|
||||
if ((int32_t)(currentTime - rcTime) >= 0) { // 50Hz
|
||||
rcTime = currentTime + 20000;
|
||||
// TODO clean this up. computeRC should handle this check
|
||||
if (!feature(FEATURE_SPEKTRUM))
|
||||
if (!feature(FEATURE_SERIALRX))
|
||||
computeRC();
|
||||
|
||||
// in 3D mode, we need to be able to disarm by switch at any time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue