mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 09:16:07 +03:00
Merge pull request #11579 from ctzsnooze/Fix-for-GPS-Return-XY-velocity-controller
This commit is contained in:
commit
9f2cd64100
23 changed files with 684 additions and 497 deletions
|
@ -72,7 +72,7 @@ extern "C" {
|
|||
bool cmsInMenu = false;
|
||||
float axisPID_P[3], axisPID_I[3], axisPID_D[3], axisPIDSum[3];
|
||||
rxRuntimeState_t rxRuntimeState = {};
|
||||
uint16_t GPS_distanceToHome = 0;
|
||||
uint32_t GPS_distanceToHomeCm = 0;
|
||||
int16_t GPS_directionToHome = 0;
|
||||
acc_t acc = {};
|
||||
bool mockIsUpright = false;
|
||||
|
@ -1059,6 +1059,8 @@ extern "C" {
|
|||
void failsafeStartMonitoring(void) {}
|
||||
void failsafeUpdateState(void) {}
|
||||
bool failsafeIsActive(void) { return false; }
|
||||
bool failsafeIsReceivingRxData(void) { return false; }
|
||||
bool rxAreFlightChannelsValid(void) { return false; }
|
||||
void pidResetIterm(void) {}
|
||||
void updateAdjustmentStates(void) {}
|
||||
void processRcAdjustments(controlRateConfig_t *) {}
|
||||
|
@ -1109,4 +1111,5 @@ extern "C" {
|
|||
bool isMotorProtocolEnabled(void) { return true; }
|
||||
void pinioBoxTaskControl(void) {}
|
||||
void schedulerSetNextStateTime(timeDelta_t) {}
|
||||
float pt1FilterGain(float, float) {return 0.5f;}
|
||||
}
|
||||
|
|
|
@ -513,46 +513,17 @@ TEST(FlightFailsafeTest, TestFailsafeSwitchModeStage1OrStage2Drop)
|
|||
// deactivate the failsafe switch
|
||||
deactivateBoxFailsafe();
|
||||
|
||||
// receivingRxData is immediately true
|
||||
// we go directly to failsafe monitoring mode, via Landing
|
||||
// because the switch also forces rxFlightChannelsValid false, emulating real failsafe
|
||||
// we have two delays to deal with before we can re-arm
|
||||
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// handle the first delay in rxDataRecoveryPeriod
|
||||
sysTickUptime += PERIOD_RXDATA_RECOVERY;
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// we should still be in failsafe monitoring mode
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// handle the second delay
|
||||
sysTickUptime += PERIOD_RXDATA_RECOVERY;
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// we should still be in failsafe monitoring mode
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// one tick later
|
||||
// by next evaluation we should be out of failsafe
|
||||
sysTickUptime ++;
|
||||
// receivingRxData is immediately true because signal exists
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// we should now have exited failsafe
|
||||
|
@ -647,34 +618,10 @@ TEST(FlightFailsafeTest, TestFailsafeSwitchModeStage2Land)
|
|||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// handle the first delay in rxDataRecoveryPeriod
|
||||
sysTickUptime += PERIOD_RXDATA_RECOVERY;
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// we should still be in failsafe monitoring mode
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// handle the second delay
|
||||
sysTickUptime += PERIOD_RXDATA_RECOVERY;
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
||||
// we should still be in failsafe monitoring mode
|
||||
EXPECT_TRUE(failsafeIsActive());
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(1, CALL_COUNTER(COUNTER_MW_DISARM));
|
||||
EXPECT_EQ(FAILSAFE_RX_LOSS_MONITORING, failsafePhase());
|
||||
|
||||
// one tick later
|
||||
sysTickUptime ++;
|
||||
failsafeOnValidDataReceived();
|
||||
|
||||
// when
|
||||
failsafeUpdateState();
|
||||
|
|
|
@ -626,6 +626,7 @@ void dashboardEnablePageCycling() {}
|
|||
|
||||
bool failsafeIsActive() { return false; }
|
||||
bool rxIsReceivingSignal() { return true; }
|
||||
bool failsafeIsReceivingRxData() { return true; }
|
||||
|
||||
uint8_t getCurrentControlRateProfileIndex(void) {
|
||||
return 0;
|
||||
|
|
|
@ -152,6 +152,8 @@ extern "C" {
|
|||
void failsafeStartMonitoring(void) {}
|
||||
void failsafeUpdateState(void) {}
|
||||
bool failsafeIsActive(void) { return false; }
|
||||
bool rxAreFlightChannelsValid(void) { return false; }
|
||||
bool failsafeIsReceivingRxData(void) { return false; }
|
||||
void pidResetIterm(void) {}
|
||||
void updateAdjustmentStates(void) {}
|
||||
void processRcAdjustments(controlRateConfig_t *) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue