mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Remove failsafe vtable usage.
This commit is contained in:
parent
60a95f1d22
commit
e40a3663d2
8 changed files with 88 additions and 113 deletions
|
@ -79,8 +79,6 @@ static rxConfig_t *rxConfig;
|
|||
|
||||
void serialRxInit(rxConfig_t *rxConfig);
|
||||
|
||||
static failsafe_t *failsafe;
|
||||
|
||||
void useRxConfig(rxConfig_t *rxConfigToUse)
|
||||
{
|
||||
rxConfig = rxConfigToUse;
|
||||
|
@ -88,7 +86,7 @@ void useRxConfig(rxConfig_t *rxConfigToUse)
|
|||
|
||||
#define STICK_CHANNEL_COUNT 4
|
||||
|
||||
void rxInit(rxConfig_t *rxConfig, failsafe_t *initialFailsafe)
|
||||
void rxInit(rxConfig_t *rxConfig)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
|
@ -98,8 +96,6 @@ void rxInit(rxConfig_t *rxConfig, failsafe_t *initialFailsafe)
|
|||
rcData[i] = rxConfig->midrc;
|
||||
}
|
||||
|
||||
failsafe = initialFailsafe;
|
||||
|
||||
#ifdef SERIAL_RX
|
||||
if (feature(FEATURE_RX_SERIAL)) {
|
||||
serialRxInit(rxConfig);
|
||||
|
@ -205,7 +201,7 @@ void updateRx(void)
|
|||
|
||||
if (rcDataReceived) {
|
||||
if (feature(FEATURE_FAILSAFE)) {
|
||||
failsafe->vTable->reset();
|
||||
failsafeReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +273,7 @@ void processRxChannels(void)
|
|||
uint16_t sample = rcReadRawFunc(&rxRuntimeConfig, rawChannel);
|
||||
|
||||
if (feature(FEATURE_FAILSAFE) && shouldCheckPulse) {
|
||||
failsafe->vTable->checkPulse(chan, sample);
|
||||
failsafeCheckPulse(chan, sample);
|
||||
}
|
||||
|
||||
// validate the range
|
||||
|
@ -295,7 +291,7 @@ void processRxChannels(void)
|
|||
void processDataDrivenRx(void)
|
||||
{
|
||||
if (rcDataReceived) {
|
||||
failsafe->vTable->reset();
|
||||
failsafeReset();
|
||||
}
|
||||
|
||||
processRxChannels();
|
||||
|
@ -315,7 +311,7 @@ void calculateRxChannelsAndUpdateFailsafe(uint32_t currentTime)
|
|||
rxUpdateAt = currentTime + DELAY_50_HZ;
|
||||
|
||||
if (feature(FEATURE_FAILSAFE)) {
|
||||
failsafe->vTable->incrementCounter();
|
||||
failsafeOnRxCycle();
|
||||
}
|
||||
|
||||
if (isRxDataDriven()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue