1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Merge pull request #3694 from DanNixon/rx_test_addition

Additional RX test
This commit is contained in:
Michael Keller 2017-08-01 01:47:35 +08:00 committed by GitHub
commit 94e1c9e761

View file

@ -59,7 +59,7 @@ typedef struct testData_s {
static testData_t testData;
TEST(RxTest, TestValidFlightChannels)
TEST(RxTest, TestValidFlightChannelsLowArm)
{
// given
memset(&testData, 0, sizeof(testData));
@ -94,6 +94,41 @@ TEST(RxTest, TestValidFlightChannels)
EXPECT_TRUE(rxHaveValidFlightChannels());
}
TEST(RxTest, TestValidFlightChannelsHighArm)
{
// given
memset(&testData, 0, sizeof(testData));
memset(&rcModeActivationMask, 0, sizeof(rcModeActivationMask)); // BOXFAILSAFE must be OFF
// and
rxConfigMutable()->rx_min_usec = 1000;
rxConfigMutable()->rx_max_usec = 2000;
// and
modeActivationConditionsMutable(0)->auxChannelIndex = 0;
modeActivationConditionsMutable(0)->modeId = BOXARM;
modeActivationConditionsMutable(0)->range.startStep = CHANNEL_VALUE_TO_STEP(1400);
modeActivationConditionsMutable(0)->range.endStep = CHANNEL_VALUE_TO_STEP(CHANNEL_RANGE_MAX);
// when
rxInit();
// then (ARM channel should be positioned just 1 step below active range to init to OFF)
EXPECT_EQ(1375, rcData[modeActivationConditions(0)->auxChannelIndex + NON_AUX_CHANNEL_COUNT]);
// given
rxResetFlightChannelStatus();
// and
for (uint8_t channelIndex = 0; channelIndex < MAX_SUPPORTED_RC_CHANNEL_COUNT; channelIndex++) {
bool validPulse = isPulseValid(1500);
rxUpdateFlightChannelStatus(channelIndex, validPulse);
}
// then
EXPECT_TRUE(rxHaveValidFlightChannels());
}
TEST(RxTest, TestInvalidFlightChannels)
{
// given