1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Fixed tests.

This commit is contained in:
mikeller 2017-06-18 12:52:58 +12:00 committed by Michael Keller
parent db006b1585
commit a10e1d05ed
4 changed files with 34 additions and 12 deletions

View file

@ -29,14 +29,19 @@ extern "C" {
#include "common/axis.h"
#include "common/maths.h"
#include "common/bitarray.h"
#include "fc/runtime_config.h"
#include "io/beeper.h"
#include "fc/rc_modes.h"
#include "fc/rc_controls.h"
#include "rx/rx.h"
#include "flight/failsafe.h"
#include "io/beeper.h"
#include "rx/rx.h"
extern boxBitmask_t rcModeActivationMask;
}
#include "unittest_macros.h"
@ -304,7 +309,10 @@ TEST(FlightFailsafeTest, TestFailsafeDetectsKillswitchEvent)
// and
throttleStatus = THROTTLE_HIGH; // throttle HIGH to go for a failsafe landing procedure
failsafeConfigMutable()->failsafe_kill_switch = true; // configure AUX switch as kill switch
ACTIVATE_RC_MODE(BOXFAILSAFE); // and activate it
boxBitmask_t newMask;
memset(&newMask, 0, sizeof(newMask));
bitArraySet(&newMask, BOXFAILSAFE);
rcModeUpdate(&newMask); // activate BOXFAILSAFE mode
sysTickUptime = 0; // restart time from 0
failsafeOnValidDataReceived(); // set last valid sample at current time
sysTickUptime = PERIOD_RXDATA_FAILURE + 1; // adjust time to point just past the failure time to
@ -324,7 +332,7 @@ TEST(FlightFailsafeTest, TestFailsafeDetectsKillswitchEvent)
sysTickUptime += PERIOD_RXDATA_RECOVERY + 1; // adjust time to point just past the recovery time to
failsafeOnValidDataReceived(); // cause a recovered link
rcModeActivationMask = DE_ACTIVATE_ALL_BOXES; // BOXFAILSAFE must be off (kill switch)
memset(&rcModeActivationMask, 0, sizeof(rcModeActivationMask)); // BOXFAILSAFE must be off (kill switch)
// when
failsafeUpdateState();
@ -404,7 +412,6 @@ extern "C" {
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
uint8_t armingFlags;
float rcCommand[4];
uint32_t rcModeActivationMask;
int16_t debug[DEBUG16_VALUE_COUNT];
bool isUsingSticksToArm = true;