Skip to content

Commit

Permalink
Remove rxFrameReady()
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans committed Apr 17, 2022
1 parent 12bb43c commit 1368b22
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
8 changes: 0 additions & 8 deletions src/main/fc/core.c
Expand Up @@ -1262,14 +1262,6 @@ FAST_CODE bool pidLoopReady(void)
return false;
}

FAST_CODE bool rxFrameReady(void)
{
if ((activePidLoopDenom == 1) || (pidUpdateCounter % activePidLoopDenom == 0)) {
return true;
}
return false;
}

FAST_CODE void taskFiltering(timeUs_t currentTimeUs)
{
gyroFiltering(currentTimeUs);
Expand Down
1 change: 0 additions & 1 deletion src/main/fc/core.h
Expand Up @@ -82,7 +82,6 @@ void updateArmingStatus(void);
void taskGyroSample(timeUs_t currentTimeUs);
bool gyroFilterReady(void);
bool pidLoopReady(void);
bool rxFrameReady(void);
void taskFiltering(timeUs_t currentTimeUs);
void taskMainPidLoop(timeUs_t currentTimeUs);

Expand Down
14 changes: 7 additions & 7 deletions src/main/scheduler/scheduler.c
Expand Up @@ -503,13 +503,13 @@ FAST_CODE void scheduler(void)
if (pidLoopReady()) {
taskExecutionTimeUs += schedulerExecuteTask(getTask(TASK_PID), currentTimeUs);
}
if (rxFrameReady()) {
// Check for incoming RX data. Don't do this in the checker as that is called repeatedly within
// a given gyro loop, and ELRS takes a long time to process this and so can only be safely processed
// before the checkers
rxFrameCheck(currentTimeUs, cmpTimeUs(currentTimeUs, getTask(TASK_RX)->lastExecutedAtUs));
}
// Check for failsafe conditions every 10ms, independently of the Rx Task, which runs at 33hz.

// Check for incoming RX data. Don't do this in the checker as that is called repeatedly within
// a given gyro loop, and ELRS takes a long time to process this and so can only be safely processed
// before the checkers
rxFrameCheck(currentTimeUs, cmpTimeUs(currentTimeUs, getTask(TASK_RX)->lastExecutedAtUs));

// Check for failsafe conditions without reliance on the RX task being well behaved
if (cmp32(millis(), lastFailsafeCheckMs) > PERIOD_RXDATA_FAILURE) {
// This is very low cost taking less that 4us every 10ms
failsafeCheckDataFailurePeriod();
Expand Down
1 change: 0 additions & 1 deletion src/test/unit/scheduler_unittest.cc
Expand Up @@ -67,7 +67,6 @@ extern "C" {
int16_t debug[1];
uint8_t debugMode = 0;

bool rxFrameReady(void) { return 0; }
void rxFrameCheck(timeUs_t, timeDelta_t) {}

// set up micros() to simulate time
Expand Down

0 comments on commit 1368b22

Please sign in to comment.