1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

CF/BF - Update re-instated unit tests due to rc_modes changes.

This commit is contained in:
Hydra 2017-06-17 21:02:59 +01:00 committed by Michael Keller
parent 75511249d8
commit 0227b7fb28
5 changed files with 17 additions and 2 deletions

View file

@ -309,10 +309,11 @@ TEST(FlightFailsafeTest, TestFailsafeDetectsKillswitchEvent)
// and // and
throttleStatus = THROTTLE_HIGH; // throttle HIGH to go for a failsafe landing procedure throttleStatus = THROTTLE_HIGH; // throttle HIGH to go for a failsafe landing procedure
failsafeConfigMutable()->failsafe_kill_switch = true; // configure AUX switch as kill switch failsafeConfigMutable()->failsafe_kill_switch = true; // configure AUX switch as kill switch
boxBitmask_t newMask; boxBitmask_t newMask;
memset(&newMask, 0, sizeof(newMask));
bitArraySet(&newMask, BOXFAILSAFE); bitArraySet(&newMask, BOXFAILSAFE);
rcModeUpdate(&newMask); // activate BOXFAILSAFE mode rcModeUpdate(&newMask); // activate BOXFAILSAFE mode
sysTickUptime = 0; // restart time from 0 sysTickUptime = 0; // restart time from 0
failsafeOnValidDataReceived(); // set last valid sample at current time failsafeOnValidDataReceived(); // set last valid sample at current time
sysTickUptime = PERIOD_RXDATA_FAILURE + 1; // adjust time to point just past the failure time to sysTickUptime = PERIOD_RXDATA_FAILURE + 1; // adjust time to point just past the failure time to
@ -332,7 +333,8 @@ TEST(FlightFailsafeTest, TestFailsafeDetectsKillswitchEvent)
sysTickUptime += PERIOD_RXDATA_RECOVERY + 1; // adjust time to point just past the recovery time to sysTickUptime += PERIOD_RXDATA_RECOVERY + 1; // adjust time to point just past the recovery time to
failsafeOnValidDataReceived(); // cause a recovered link failsafeOnValidDataReceived(); // cause a recovered link
memset(&rcModeActivationMask, 0, sizeof(rcModeActivationMask)); // BOXFAILSAFE must be off (kill switch) memset(&newMask, 0, sizeof(newMask));
rcModeUpdate(&newMask); // BOXFAILSAFE must be off (kill switch)
// when // when
failsafeUpdateState(); failsafeUpdateState();

View file

@ -43,6 +43,7 @@ extern "C" {
#include "fc/runtime_config.h" #include "fc/runtime_config.h"
#include "fc/rc_controls.h" #include "fc/rc_controls.h"
#include "fc/rc_modes.h"
#include "rx/rx.h" #include "rx/rx.h"
@ -234,6 +235,11 @@ bool sensors(uint32_t mask)
return false; return false;
}; };
bool feature(uint32_t mask) {
UNUSED(mask);
return false;
}
uint32_t millis(void) { return 0; } uint32_t millis(void) { return 0; }
uint32_t micros(void) { return 0; } uint32_t micros(void) { return 0; }

View file

@ -35,6 +35,7 @@ extern "C" {
#include "fc/config.h" #include "fc/config.h"
#include "fc/rc_controls.h" #include "fc/rc_controls.h"
#include "fc/rc_modes.h"
#include "fc/runtime_config.h" #include "fc/runtime_config.h"
#include "drivers/light_ws2811strip.h" #include "drivers/light_ws2811strip.h"

View file

@ -28,6 +28,7 @@ extern "C" {
#include "telemetry/ibus_shared.h" #include "telemetry/ibus_shared.h"
#include "telemetry/telemetry.h" #include "telemetry/telemetry.h"
#include "fc/rc_controls.h" #include "fc/rc_controls.h"
#include "fc/rc_modes.h"
#include "sensors/barometer.h" #include "sensors/barometer.h"
#include "sensors/battery.h" #include "sensors/battery.h"
} }

View file

@ -217,5 +217,10 @@ void failsafeOnValidDataFailed(void)
{ {
} }
bool IS_RC_MODE_ACTIVE(boxId_e)
{
return false;
}
} }