mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +03:00
Update unittest_flight_imu.
This commit is contained in:
parent
21e9b0b537
commit
f8b13d7c62
2 changed files with 26 additions and 14 deletions
|
@ -105,17 +105,20 @@ battery_unittest : $(OBJECT_DIR)/sensors/battery.o $(OBJECT_DIR)/battery_unittes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(OBJECT_DIR)/flight/altitudehold.o : $(USER_DIR)/flight/altitudehold.c $(USER_DIR)/flight/altitudehold.h $(GTEST_HEADERS)
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/altitudehold.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight/imu.o : $(USER_DIR)/flight/imu.c $(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/flight/imu.o : $(USER_DIR)/flight/imu.c $(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/imu.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/imu.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight_imu_unittest.o : $(TEST_DIR)/flight_imu_unittest.cc \
|
$(OBJECT_DIR)/flight_imu_unittest.o : $(TEST_DIR)/flight_imu_unittest.cc \
|
||||||
$(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
$(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/flight_imu_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/flight_imu_unittest.cc -o $@
|
||||||
|
|
||||||
flight_imu_unittest : $(OBJECT_DIR)/flight/imu.o $(OBJECT_DIR)/flight_imu_unittest.o $(OBJECT_DIR)/gtest_main.a
|
flight_imu_unittest : $(OBJECT_DIR)/flight/imu.o $(OBJECT_DIR)/flight/altitudehold.o $(OBJECT_DIR)/flight_imu_unittest.o $(OBJECT_DIR)/gtest_main.a
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
|
|
||||||
#define BARO
|
#define BARO
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
#include "flight/flight.h"
|
#include "flight/flight.h"
|
||||||
|
#include "flight/altitudehold.h"
|
||||||
|
|
||||||
#include "sensors/sensors.h"
|
#include "sensors/sensors.h"
|
||||||
#include "drivers/accgyro.h"
|
#include "drivers/accgyro.h"
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
|
|
||||||
#include "flight/mixer.h"
|
#include "flight/mixer.h"
|
||||||
#include "flight/imu.h"
|
#include "flight/imu.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include "unittest_macros.h"
|
#include "unittest_macros.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -44,7 +47,9 @@
|
||||||
#define UPWARDS_THRUST false
|
#define UPWARDS_THRUST false
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
bool isThrustFacingDownwards(rollAndPitchInclination_t *inclinations);
|
bool isThrustFacingDownwards(rollAndPitchInclination_t *inclinations);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct inclinationExpectation_s {
|
typedef struct inclinationExpectation_s {
|
||||||
rollAndPitchInclination_t inclination;
|
rollAndPitchInclination_t inclination;
|
||||||
|
@ -82,6 +87,8 @@ TEST(FlightImuTest, IsThrustFacingDownwards)
|
||||||
|
|
||||||
// STUBS
|
// STUBS
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
uint16_t acc_1G;
|
uint16_t acc_1G;
|
||||||
int16_t heading;
|
int16_t heading;
|
||||||
gyro_t gyro;
|
gyro_t gyro;
|
||||||
|
@ -118,3 +125,5 @@ int constrain(int amt, int low, int high)
|
||||||
UNUSED(high);
|
UNUSED(high);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue