mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Refactor Rx code and better support 25Hz links (#13435)
* RX task update rate to 22Hz, to improve 25Hz link stability * modified Rx code * add LQ to debug * use max of frameAge or FrameDelta * Require a dropouit of 200ms, not 100ms, before RXLOSS * remove FrameAge, use 150ms timeout 50ms checks * fix tests and tidy up the comments * Handle NULL input as before, log frame time * possible solutions to review comment about names * Remove rxFrameTimeUs - prepare for direct use of lastRcFrameTimeUs - refactor rx_spi callback * remove global currentRxRateHz * simplify updateRcRefreshRate * re-name to recheck interval, return frame time debug * Calculate RxRate only once * use rxReceivingSignal for consistency * use signalReceived not rxDataReceived for consistency * suggestions from review PL * move defines, thanks K * fixes from review, thanks MH * review changes, undo task interval change rename bool rxIsReceivingSignal to isRxReceivingSignal thanks Steve for resolving that tasks changes are not needed thanks PL for your feedback also --------- Co-authored-by: Petr Ledvina <ledvinap@hp124.ekotip.cz>
This commit is contained in:
parent
a37bd7c974
commit
776e8c7b3c
29 changed files with 108 additions and 116 deletions
|
@ -1051,7 +1051,7 @@ TEST(ArmingPreventionTest, Paralyze)
|
|||
extern "C" {
|
||||
uint32_t micros(void) { return simulationTime; }
|
||||
uint32_t millis(void) { return micros() / 1000; }
|
||||
bool rxIsReceivingSignal(void) { return simulationHaveRx; }
|
||||
bool isRxReceivingSignal(void) { return simulationHaveRx; }
|
||||
|
||||
bool featureIsEnabled(uint32_t f) { return simulationFeatureFlags & f; }
|
||||
void warningLedFlash(void) {}
|
||||
|
@ -1128,7 +1128,7 @@ extern "C" {
|
|||
bool isUpright(void) { return mockIsUpright; }
|
||||
void blackboxLogEvent(FlightLogEvent, union flightLogEventData_u *) {};
|
||||
void gyroFiltering(timeUs_t) {};
|
||||
timeDelta_t rxGetFrameDelta(timeDelta_t *) { return 0; }
|
||||
timeDelta_t rxGetFrameDelta() { return 0; }
|
||||
void updateRcRefreshRate(timeUs_t) {};
|
||||
uint16_t getAverageSystemLoadPercent(void) { return 0; }
|
||||
bool isMotorProtocolEnabled(void) { return true; }
|
||||
|
|
|
@ -380,7 +380,7 @@ void closeSerialPort(serialPort_t *) {}
|
|||
portSharing_e determinePortSharing(const serialPortConfig_t *, serialPortFunction_e ) {return PORTSHARING_UNUSED;}
|
||||
failsafePhase_e failsafePhase(void) {return FAILSAFE_IDLE;}
|
||||
bool rxAreFlightChannelsValid(void) {return false;}
|
||||
bool rxIsReceivingSignal(void) {return false;}
|
||||
bool isRxReceivingSignal(void) {return false;}
|
||||
bool isRssiConfigured(void) {return false;}
|
||||
float getMotorOutputLow(void) {return 0.0;}
|
||||
float getMotorOutputHigh(void) {return 0.0;}
|
||||
|
|
|
@ -387,6 +387,7 @@ bool isModeActivationConditionConfigured(const modeActivationCondition_t *, cons
|
|||
void delay(uint32_t) {}
|
||||
displayPort_t *osdGetDisplayPort(osdDisplayPortDevice_e *) { return NULL; }
|
||||
mcuTypeId_e getMcuTypeId(void) { return MCU_TYPE_UNKNOWN; }
|
||||
uint16_t getCurrentRxIntervalUs(void) { return 0; }
|
||||
uint16_t getCurrentRxRateHz(void) { return 0; }
|
||||
uint16_t getAverageSystemLoadPercent(void) { return 0; }
|
||||
bool getRxRateValid(void) { return false; }
|
||||
}
|
||||
|
|
|
@ -588,7 +588,7 @@ TEST(FlightFailsafeTest, TestFailsafeSwitchModeStage2Land)
|
|||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// now should be in monitoring mode, with switch holding signalReceived false
|
||||
// now should be in monitoring mode, with switch holding rxDataReceived false
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
|
|
|
@ -386,7 +386,7 @@ int scaleRange(int x, int srcMin, int srcMax, int destMin, int destMax)
|
|||
}
|
||||
|
||||
bool failsafeIsActive() { return false; }
|
||||
bool rxIsReceivingSignal() { return true; }
|
||||
bool isRxReceivingSignal() { return true; }
|
||||
|
||||
bool isBeeperOn() { return false; };
|
||||
|
||||
|
|
|
@ -622,7 +622,7 @@ void dashboardDisablePageCycling() {}
|
|||
void dashboardEnablePageCycling() {}
|
||||
|
||||
bool failsafeIsActive() { return false; }
|
||||
bool rxIsReceivingSignal() { return true; }
|
||||
bool isRxReceivingSignal() { return true; }
|
||||
bool failsafeIsReceivingRxData() { return true; }
|
||||
|
||||
uint8_t getCurrentControlRateProfileIndex(void)
|
||||
|
|
|
@ -130,7 +130,7 @@ extern "C" {
|
|||
uint8_t activePidLoopDenom = 1;
|
||||
uint32_t micros(void) { return simulationTime; }
|
||||
uint32_t millis(void) { return micros() / 1000; }
|
||||
bool rxIsReceivingSignal(void) { return simulationHaveRx; }
|
||||
bool isRxReceivingSignal(void) { return simulationHaveRx; }
|
||||
|
||||
bool featureIsEnabled(uint32_t f) { return simulationFeatureFlags & f; }
|
||||
void warningLedFlash(void) {}
|
||||
|
@ -202,7 +202,7 @@ extern "C" {
|
|||
bool isUpright(void) { return true; }
|
||||
void blackboxLogEvent(FlightLogEvent, union flightLogEventData_u *) {};
|
||||
void gyroFiltering(timeUs_t) {};
|
||||
timeDelta_t rxGetFrameDelta(timeDelta_t *) { return 0; }
|
||||
timeDelta_t rxGetFrameDelta() { return 0; }
|
||||
void updateRcRefreshRate(timeUs_t) {};
|
||||
uint16_t getAverageSystemLoadPercent(void) { return 0; }
|
||||
bool isMotorProtocolEnabled(void) { return false; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue