mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +03:00
Merge pull request #3694 from DanNixon/rx_test_addition
Additional RX test
This commit is contained in:
commit
94e1c9e761
1 changed files with 36 additions and 1 deletions
|
@ -59,7 +59,7 @@ typedef struct testData_s {
|
||||||
|
|
||||||
static testData_t testData;
|
static testData_t testData;
|
||||||
|
|
||||||
TEST(RxTest, TestValidFlightChannels)
|
TEST(RxTest, TestValidFlightChannelsLowArm)
|
||||||
{
|
{
|
||||||
// given
|
// given
|
||||||
memset(&testData, 0, sizeof(testData));
|
memset(&testData, 0, sizeof(testData));
|
||||||
|
@ -94,6 +94,41 @@ TEST(RxTest, TestValidFlightChannels)
|
||||||
EXPECT_TRUE(rxHaveValidFlightChannels());
|
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)
|
TEST(RxTest, TestInvalidFlightChannels)
|
||||||
{
|
{
|
||||||
// given
|
// given
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue