documentation/comments

This commit is contained in:
myles-parfeniuk 2024-11-16 21:36:11 -08:00
parent 047ff45347
commit 2867eba1da
7 changed files with 797 additions and 279 deletions

View File

@ -1,3 +1,7 @@
/**
* @file BNO08x.hpp
* @author Myles Parfeniuk
*/
#pragma once
// standard library includes
#include <inttypes.h>
@ -21,6 +25,10 @@
// in-house includes
#include "BNO08x_global_types.hpp"
/**
* @class BNO08x
* @brief BNO08x IMU driver class.
* */
class BNO08x
{
public:
@ -324,7 +332,7 @@ class BNO08x
uint16_t parse_feature_get_response_report(bno08x_rx_packet_t* packet);
uint16_t parse_input_report(bno08x_rx_packet_t* packet);
void parse_input_report_data(bno08x_rx_packet_t* packet, uint16_t* data, uint16_t data_length);
uint16_t parse_gyro_report(bno08x_rx_packet_t* packet);
uint16_t parse_gyro_integrated_rotation_vector_report(bno08x_rx_packet_t* packet);
uint16_t parse_command_report(bno08x_rx_packet_t* packet);
// functions to update data returned to user
@ -365,8 +373,8 @@ class BNO08x
esp_err_t launch_tasks();
esp_err_t kill_all_tasks();
void update_report_period(uint8_t report_ID, uint32_t new_period);
static uint8_t report_ID_to_report_period_idx(uint8_t report_ID);
void update_report_period_trackers(uint8_t report_ID, uint32_t new_period);
static uint8_t report_ID_to_report_period_tracker_idx(uint8_t report_ID);
EventGroupHandle_t
evt_grp_spi; ///<Event group for indicating when bno08x hint pin has triggered and when new data has been processed. Used by calls to sending or receiving functions.

View File

@ -1,8 +1,16 @@
/**
* @file BNO08xTestHelper.hpp
* @author Myles Parfeniuk
*/
#pragma once
#include "stdio.h"
#include "BNO08x.hpp"
/**
* @class BNO08xTestHelper
* @brief BNO08x unit test helper class.
* */
class BNO08xTestHelper
{
private:
@ -12,6 +20,7 @@ class BNO08xTestHelper
static const constexpr char* TAG = "BNO08xTestHelper";
public:
/// @brief IMU configuration settings passed into constructor
typedef struct imu_report_data_t
{
uint32_t time_stamp;
@ -68,26 +77,60 @@ class BNO08xTestHelper
} imu_report_data_t;
/**
* @brief Prints test begin banner.
*
* @param TEST_TAG String containing test name.
*
* @return void, nothing to return
*/
static void print_test_start_banner(const char* TEST_TAG)
{
printf("------------------------ BEGIN TEST: %s ------------------------\n\r", TEST_TAG);
}
/**
* @brief Prints end begin banner.
*
* @param TEST_TAG String containing test name.
*
* @return void, nothing to return
*/
static void print_test_end_banner(const char* TEST_TAG)
{
printf("------------------------ END TEST: %s ------------------------\n\r", TEST_TAG);
}
/**
* @brief Prints a message during a test.
*
* @param TEST_TAG String containing test name.
* @param msg String containing message to print.
*
* @return void, nothing to return
*/
static void print_test_msg(const char* TEST_TAG, const char* msg)
{
printf("%s: %s: %s\n\r", TAG, TEST_TAG, msg);
}
/**
* @brief Set test imu configuration used with create_test_imu()
*
* @param cfg String containing test name.
*
* @return void, nothing to return
*/
static void set_test_imu_cfg(bno08x_config_t cfg)
{
imu_cfg = cfg;
}
/**
* @brief Calls BNO08x constructor and creates new test IMU on heap.
*
* @return void, nothing to return
*/
static void create_test_imu()
{
if (test_imu != nullptr)
@ -96,6 +139,11 @@ class BNO08xTestHelper
test_imu = new BNO08x();
}
/**
* @brief Deletes test IMU calling deconstructor and releases heap allocated memory.
*
* @return void, nothing to return
*/
static void destroy_test_imu()
{
if (test_imu != nullptr)
@ -105,11 +153,21 @@ class BNO08xTestHelper
}
}
/**
* @brief Deletes test IMU calling deconstructor and releases heap allocated memory.
*
* @return Pointer to BNO08x IMU object to test.
*/
static BNO08x* get_test_imu()
{
return test_imu;
}
/**
* @brief Used to call private BNO08x::init_config_args() member for tests.
*
* @return ESP_OK if init succeeded.
*/
static esp_err_t call_init_config_args()
{
if (test_imu == nullptr)
@ -118,6 +176,11 @@ class BNO08xTestHelper
return test_imu->init_config_args();
}
/**
* @brief Used to call private BNO08x::init_gpio() member for tests.
*
* @return ESP_OK if init succeeded.
*/
static esp_err_t call_init_gpio()
{
if (test_imu == nullptr)
@ -126,6 +189,11 @@ class BNO08xTestHelper
return test_imu->init_gpio();
}
/**
* @brief Used to call private BNO08x::init_hint_isr() member for tests.
*
* @return ESP_OK if init succeeded.
*/
static esp_err_t call_init_hint_isr()
{
if (test_imu == nullptr)
@ -134,6 +202,11 @@ class BNO08xTestHelper
return test_imu->init_hint_isr();
}
/**
* @brief Used to call private BNO08x::init_spi() member for tests.
*
* @return ESP_OK if init succeeded.
*/
static esp_err_t call_init_spi()
{
if (test_imu == nullptr)
@ -142,6 +215,11 @@ class BNO08xTestHelper
return test_imu->init_spi();
}
/**
* @brief Used to call private BNO08x::launch_tasks() member for tests.
*
* @return ESP_OK if init succeeded.
*/
static esp_err_t call_launch_tasks()
{
if (test_imu == nullptr)
@ -150,294 +228,402 @@ class BNO08xTestHelper
return test_imu->launch_tasks();
}
static bool rotation_vector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool rotation_vector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
// prev report should always contain the default test values as per test structure
if (report_data->quat_I != prev_report_data->quat_I)
if (report_data->quat_I != default_report_data->quat_I)
new_data = true;
if (report_data->quat_J != prev_report_data->quat_J)
if (report_data->quat_J != default_report_data->quat_J)
new_data = true;
if (report_data->quat_K != prev_report_data->quat_K)
if (report_data->quat_K != default_report_data->quat_K)
new_data = true;
if (report_data->quat_real != prev_report_data->quat_real)
if (report_data->quat_real != default_report_data->quat_real)
new_data = true;
if (report_data->quat_accuracy != prev_report_data->quat_accuracy)
if (report_data->quat_accuracy != default_report_data->quat_accuracy)
new_data = true;
if (report_data->quat_radian_accuracy != prev_report_data->quat_radian_accuracy)
if (report_data->quat_radian_accuracy != default_report_data->quat_radian_accuracy)
new_data = true;
return new_data;
}
static bool gyro_integrated_rotation_vector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool gyro_integrated_rotation_vector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->quat_I != prev_report_data->quat_I)
if (report_data->quat_I != default_report_data->quat_I)
new_data = true;
if (report_data->quat_J != prev_report_data->quat_J)
if (report_data->quat_J != default_report_data->quat_J)
new_data = true;
if (report_data->quat_K != prev_report_data->quat_K)
if (report_data->quat_K != default_report_data->quat_K)
new_data = true;
if (report_data->quat_real != prev_report_data->quat_real)
if (report_data->quat_real != default_report_data->quat_real)
new_data = true;
if (report_data->integrated_gyro_vel_x != prev_report_data->integrated_gyro_vel_x)
if (report_data->integrated_gyro_vel_x != default_report_data->integrated_gyro_vel_x)
new_data = true;
if (report_data->integrated_gyro_vel_y != prev_report_data->integrated_gyro_vel_y)
if (report_data->integrated_gyro_vel_y != default_report_data->integrated_gyro_vel_y)
new_data = true;
if (report_data->integrated_gyro_vel_z != prev_report_data->integrated_gyro_vel_z)
if (report_data->integrated_gyro_vel_z != default_report_data->integrated_gyro_vel_z)
new_data = true;
return new_data;
}
static bool uncalibrated_gyro_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool uncalibrated_gyro_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->uncalib_gyro_vel_x != prev_report_data->uncalib_gyro_vel_x)
if (report_data->uncalib_gyro_vel_x != default_report_data->uncalib_gyro_vel_x)
new_data = true;
if (report_data->uncalib_gyro_vel_y != prev_report_data->uncalib_gyro_vel_y)
if (report_data->uncalib_gyro_vel_y != default_report_data->uncalib_gyro_vel_y)
new_data = true;
if (report_data->uncalib_gyro_vel_z != prev_report_data->uncalib_gyro_vel_z)
if (report_data->uncalib_gyro_vel_z != default_report_data->uncalib_gyro_vel_z)
new_data = true;
if (report_data->uncalib_gyro_drift_x != prev_report_data->uncalib_gyro_drift_x)
if (report_data->uncalib_gyro_drift_x != default_report_data->uncalib_gyro_drift_x)
new_data = true;
if (report_data->uncalib_gyro_drift_y != prev_report_data->uncalib_gyro_drift_y)
if (report_data->uncalib_gyro_drift_y != default_report_data->uncalib_gyro_drift_y)
new_data = true;
if (report_data->uncalib_gyro_drift_z != prev_report_data->uncalib_gyro_drift_z)
if (report_data->uncalib_gyro_drift_z != default_report_data->uncalib_gyro_drift_z)
new_data = true;
return new_data;
}
static bool calibrated_gyro_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool calibrated_gyro_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->calib_gyro_vel_x != prev_report_data->calib_gyro_vel_x)
if (report_data->calib_gyro_vel_x != default_report_data->calib_gyro_vel_x)
new_data = true;
if (report_data->calib_gyro_vel_y != prev_report_data->calib_gyro_vel_y)
if (report_data->calib_gyro_vel_y != default_report_data->calib_gyro_vel_y)
new_data = true;
if (report_data->calib_gyro_vel_z != prev_report_data->calib_gyro_vel_z)
if (report_data->calib_gyro_vel_z != default_report_data->calib_gyro_vel_z)
new_data = true;
return new_data;
}
static bool accelerometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool accelerometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->accel_x != prev_report_data->accel_x)
if (report_data->accel_x != default_report_data->accel_x)
new_data = true;
if (report_data->accel_y != prev_report_data->accel_y)
if (report_data->accel_y != default_report_data->accel_y)
new_data = true;
if (report_data->accel_z != prev_report_data->accel_z)
if (report_data->accel_z != default_report_data->accel_z)
new_data = true;
if (report_data->accel_accuracy != prev_report_data->accel_accuracy)
if (report_data->accel_accuracy != default_report_data->accel_accuracy)
new_data = true;
return new_data;
}
static bool linear_accelerometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool linear_accelerometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->lin_accel_x != prev_report_data->lin_accel_x)
if (report_data->lin_accel_x != default_report_data->lin_accel_x)
new_data = true;
if (report_data->lin_accel_y != prev_report_data->lin_accel_y)
if (report_data->lin_accel_y != default_report_data->lin_accel_y)
new_data = true;
if (report_data->lin_accel_z != prev_report_data->lin_accel_z)
if (report_data->lin_accel_z != default_report_data->lin_accel_z)
new_data = true;
if (report_data->lin_accel_accuracy != prev_report_data->lin_accel_accuracy)
if (report_data->lin_accel_accuracy != default_report_data->lin_accel_accuracy)
new_data = true;
return new_data;
}
static bool gravity_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool gravity_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->grav_x != prev_report_data->grav_x)
if (report_data->grav_x != default_report_data->grav_x)
new_data = true;
if (report_data->grav_y != prev_report_data->grav_y)
if (report_data->grav_y != default_report_data->grav_y)
new_data = true;
if (report_data->grav_z != prev_report_data->grav_z)
if (report_data->grav_z != default_report_data->grav_z)
new_data = true;
if (report_data->grav_accuracy != prev_report_data->grav_accuracy)
if (report_data->grav_accuracy != default_report_data->grav_accuracy)
new_data = true;
return new_data;
}
static bool magnetometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool magnetometer_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->magf_x != prev_report_data->magf_x)
if (report_data->magf_x != default_report_data->magf_x)
new_data = true;
if (report_data->magf_y != prev_report_data->magf_y)
if (report_data->magf_y != default_report_data->magf_y)
new_data = true;
if (report_data->magf_z != prev_report_data->magf_z)
if (report_data->magf_z != default_report_data->magf_z)
new_data = true;
if (report_data->magf_accuracy != prev_report_data->magf_accuracy)
if (report_data->magf_accuracy != default_report_data->magf_accuracy)
new_data = true;
return new_data;
}
static bool step_detector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool step_detector_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->step_count != prev_report_data->step_count)
if (report_data->step_count != default_report_data->step_count)
new_data = true;
return new_data;
}
static bool stability_classifier_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool stability_classifier_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->stability_classifier != prev_report_data->stability_classifier)
if (report_data->stability_classifier != default_report_data->stability_classifier)
new_data = true;
return new_data;
}
static bool activity_classifier_data_is_default(imu_report_data_t* report_data, imu_report_data_t* prev_report_data)
/**
* @brief Checks if report_data matches the default states stored within prev_report_data data for respective report.
*
* @param report_data Current report data.
* @param default_report_data Default report data to compare (should always contain default values)
*
* @return ESP_OK if init succeeded.
*/
static bool activity_classifier_data_is_default(imu_report_data_t* report_data, imu_report_data_t* default_report_data)
{
bool new_data = false;
if (report_data->activity_classifier != prev_report_data->activity_classifier)
if (report_data->activity_classifier != default_report_data->activity_classifier)
new_data = true;
return new_data;
}
static void update_report_data(imu_report_data_t* report_data, BNO08x* imu)
/**
* @brief Updates report data with calls relevant test_imu methods.
*
* @param report_data Pointer to imu_report_data_t struct to save report data.
*
* @return ESP_OK if init succeeded.
*/
static void update_report_data(imu_report_data_t* report_data)
{
imu->get_quat(report_data->quat_I, report_data->quat_J, report_data->quat_K, report_data->quat_real, report_data->quat_radian_accuracy,
report_data->quat_accuracy);
imu->get_integrated_gyro_velocity(
test_imu->get_quat(report_data->quat_I, report_data->quat_J, report_data->quat_K, report_data->quat_real,
report_data->quat_radian_accuracy, report_data->quat_accuracy);
test_imu->get_integrated_gyro_velocity(
report_data->integrated_gyro_vel_x, report_data->integrated_gyro_vel_y, report_data->integrated_gyro_vel_z);
imu->get_accel(report_data->accel_x, report_data->accel_y, report_data->accel_z, report_data->accel_accuracy);
imu->get_linear_accel(report_data->lin_accel_x, report_data->lin_accel_y, report_data->lin_accel_z, report_data->lin_accel_accuracy);
imu->get_gravity(report_data->grav_x, report_data->grav_y, report_data->grav_z, report_data->grav_accuracy);
imu->get_calibrated_gyro_velocity(report_data->calib_gyro_vel_x, report_data->calib_gyro_vel_y, report_data->calib_gyro_vel_z);
imu->get_uncalibrated_gyro_velocity(report_data->uncalib_gyro_vel_x, report_data->uncalib_gyro_vel_y, report_data->uncalib_gyro_vel_z,
report_data->uncalib_gyro_drift_x, report_data->uncalib_gyro_drift_y, report_data->uncalib_gyro_drift_z);
imu->get_magf(report_data->magf_x, report_data->magf_y, report_data->magf_z, report_data->magf_accuracy);
imu->get_raw_mems_gyro(report_data->raw_mems_gyro_x, report_data->raw_mems_gyro_y, report_data->raw_mems_gyro_z);
report_data->step_count = imu->get_step_count();
report_data->stability_classifier = imu->get_stability_classifier();
report_data->activity_classifier = imu->get_activity_classifier();
test_imu->get_accel(report_data->accel_x, report_data->accel_y, report_data->accel_z, report_data->accel_accuracy);
test_imu->get_linear_accel(report_data->lin_accel_x, report_data->lin_accel_y, report_data->lin_accel_z, report_data->lin_accel_accuracy);
test_imu->get_gravity(report_data->grav_x, report_data->grav_y, report_data->grav_z, report_data->grav_accuracy);
test_imu->get_calibrated_gyro_velocity(report_data->calib_gyro_vel_x, report_data->calib_gyro_vel_y, report_data->calib_gyro_vel_z);
test_imu->get_uncalibrated_gyro_velocity(report_data->uncalib_gyro_vel_x, report_data->uncalib_gyro_vel_y,
report_data->uncalib_gyro_vel_z, report_data->uncalib_gyro_drift_x, report_data->uncalib_gyro_drift_y,
report_data->uncalib_gyro_drift_z);
test_imu->get_magf(report_data->magf_x, report_data->magf_y, report_data->magf_z, report_data->magf_accuracy);
test_imu->get_raw_mems_gyro(report_data->raw_mems_gyro_x, report_data->raw_mems_gyro_y, report_data->raw_mems_gyro_z);
report_data->step_count = test_imu->get_step_count();
report_data->stability_classifier = test_imu->get_stability_classifier();
report_data->activity_classifier = test_imu->get_activity_classifier();
}
static void reset_all_imu_data_to_test_defaults(BNO08x* imu)
/**
* @brief Resets internal test imu data with test defaults.
*
* @return ESP_OK if init succeeded.
*/
static void reset_all_imu_data_to_test_defaults()
{
static const constexpr uint16_t TEST_VAL_UINT16 = 65535U;
static const constexpr uint16_t TEST_VAL_UINT8 = 255;
imu->time_stamp = 0UL;
test_imu->time_stamp = 0UL;
imu->raw_accel_X = TEST_VAL_UINT16;
imu->raw_accel_Y = TEST_VAL_UINT16;
imu->raw_accel_Z = TEST_VAL_UINT16;
imu->accel_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->raw_accel_X = TEST_VAL_UINT16;
test_imu->raw_accel_Y = TEST_VAL_UINT16;
test_imu->raw_accel_Z = TEST_VAL_UINT16;
test_imu->accel_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->raw_lin_accel_X = TEST_VAL_UINT16;
imu->raw_lin_accel_Y = TEST_VAL_UINT16;
imu->raw_lin_accel_Z = TEST_VAL_UINT16;
imu->accel_lin_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->raw_lin_accel_X = TEST_VAL_UINT16;
test_imu->raw_lin_accel_Y = TEST_VAL_UINT16;
test_imu->raw_lin_accel_Z = TEST_VAL_UINT16;
test_imu->accel_lin_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->raw_calib_gyro_X = TEST_VAL_UINT16;
imu->raw_calib_gyro_Y = TEST_VAL_UINT16;
imu->raw_calib_gyro_Z = TEST_VAL_UINT16;
test_imu->raw_calib_gyro_X = TEST_VAL_UINT16;
test_imu->raw_calib_gyro_Y = TEST_VAL_UINT16;
test_imu->raw_calib_gyro_Z = TEST_VAL_UINT16;
// reset quaternion to nan
imu->raw_quat_I = TEST_VAL_UINT16;
imu->raw_quat_J = TEST_VAL_UINT16;
imu->raw_quat_K = TEST_VAL_UINT16;
imu->raw_quat_real = TEST_VAL_UINT16;
imu->raw_quat_radian_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->quat_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->raw_quat_I = TEST_VAL_UINT16;
test_imu->raw_quat_J = TEST_VAL_UINT16;
test_imu->raw_quat_K = TEST_VAL_UINT16;
test_imu->raw_quat_real = TEST_VAL_UINT16;
test_imu->raw_quat_radian_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->quat_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->integrated_gyro_velocity_X = TEST_VAL_UINT16;
imu->integrated_gyro_velocity_Y = TEST_VAL_UINT16;
imu->integrated_gyro_velocity_Z = TEST_VAL_UINT16;
test_imu->integrated_gyro_velocity_X = TEST_VAL_UINT16;
test_imu->integrated_gyro_velocity_Y = TEST_VAL_UINT16;
test_imu->integrated_gyro_velocity_Z = TEST_VAL_UINT16;
imu->gravity_X = TEST_VAL_UINT16;
imu->gravity_Y = TEST_VAL_UINT16;
imu->gravity_Z = TEST_VAL_UINT16;
imu->gravity_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->gravity_X = TEST_VAL_UINT16;
test_imu->gravity_Y = TEST_VAL_UINT16;
test_imu->gravity_Z = TEST_VAL_UINT16;
test_imu->gravity_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->raw_uncalib_gyro_X = TEST_VAL_UINT16;
imu->raw_uncalib_gyro_Y = TEST_VAL_UINT16;
imu->raw_uncalib_gyro_Z = TEST_VAL_UINT16;
imu->raw_bias_X = TEST_VAL_UINT16;
imu->raw_bias_Y = TEST_VAL_UINT16;
imu->raw_bias_Z = TEST_VAL_UINT16;
test_imu->raw_uncalib_gyro_X = TEST_VAL_UINT16;
test_imu->raw_uncalib_gyro_Y = TEST_VAL_UINT16;
test_imu->raw_uncalib_gyro_Z = TEST_VAL_UINT16;
test_imu->raw_bias_X = TEST_VAL_UINT16;
test_imu->raw_bias_Y = TEST_VAL_UINT16;
test_imu->raw_bias_Z = TEST_VAL_UINT16;
imu->raw_magf_X = TEST_VAL_UINT16;
imu->raw_magf_Y = TEST_VAL_UINT16;
imu->raw_magf_Z = TEST_VAL_UINT16;
imu->magf_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
test_imu->raw_magf_X = TEST_VAL_UINT16;
test_imu->raw_magf_Y = TEST_VAL_UINT16;
test_imu->raw_magf_Z = TEST_VAL_UINT16;
test_imu->magf_accuracy = static_cast<uint16_t>(BNO08xAccuracy::UNDEFINED);
imu->tap_detector = TEST_VAL_UINT8;
imu->step_count = TEST_VAL_UINT16;
imu->stability_classifier = TEST_VAL_UINT8;
imu->activity_classifier = TEST_VAL_UINT8;
test_imu->tap_detector = TEST_VAL_UINT8;
test_imu->step_count = TEST_VAL_UINT16;
test_imu->stability_classifier = TEST_VAL_UINT8;
test_imu->activity_classifier = TEST_VAL_UINT8;
imu->mems_raw_accel_X = TEST_VAL_UINT16;
imu->mems_raw_accel_Y = TEST_VAL_UINT16;
imu->mems_raw_accel_Z = TEST_VAL_UINT16;
test_imu->mems_raw_accel_X = TEST_VAL_UINT16;
test_imu->mems_raw_accel_Y = TEST_VAL_UINT16;
test_imu->mems_raw_accel_Z = TEST_VAL_UINT16;
imu->mems_raw_gyro_X = TEST_VAL_UINT16;
imu->mems_raw_gyro_Y = TEST_VAL_UINT16;
imu->mems_raw_gyro_Z = TEST_VAL_UINT16;
test_imu->mems_raw_gyro_X = TEST_VAL_UINT16;
test_imu->mems_raw_gyro_Y = TEST_VAL_UINT16;
test_imu->mems_raw_gyro_Z = TEST_VAL_UINT16;
imu->mems_raw_magf_X = TEST_VAL_UINT16;
imu->mems_raw_magf_Y = TEST_VAL_UINT16;
imu->mems_raw_magf_Z = TEST_VAL_UINT16;
test_imu->mems_raw_magf_X = TEST_VAL_UINT16;
test_imu->mems_raw_magf_Y = TEST_VAL_UINT16;
test_imu->mems_raw_magf_Z = TEST_VAL_UINT16;
}
/**
* @brief Converts BNO08xAccuracy enum class object to string.
*
* @param report_data BNO08xAccuracy object to convert to string.
*
* @return The resulting string conversion.
*/
static const char* BNO08xAccuracy_to_str(BNO08xAccuracy accuracy)
{
switch (accuracy)

View File

@ -1,15 +1,22 @@
/**
* @file BNO08xTestSuite.hpp
* @author Myles Parfeniuk
*
*
* @warning YOU MUST ADD THE FOLLOWING LINE TO YOUR MAIN PROJECTS CMakeLists.txt IN ORDER FOR THIS TEST SUITE TO BE BUILT WITH PROJECT:
* set(TEST_COMPONENTS "esp32_BNO08x" CACHE STRING "Components to test.")
*/
#pragma once
/*
YOU MUST ADD THE FOLLOWING LINE TO YOUR MAIN PROJECTS CMakeLists.txt IN ORDER FOR THIS TEST SUITE TO BE FUNCTIONAL:
set(TEST_COMPONENTS "esp32_BNO08x" CACHE STRING "Components to test.")
*/
#include <stdio.h>
#include <string.h>
#include "unity.h"
#include "BNO08xTestHelper.hpp"
/**
* @class BNO08xTestSuite
* @brief BNO08x unit test launch point class.
* */
class BNO08xTestSuite
{
private:

View File

@ -1,3 +1,7 @@
/**
* @file BNO08x_global_types.hpp
* @author Myles Parfeniuk
*/
#pragma once
#include <driver/gpio.h>

View File

@ -1,3 +1,7 @@
/**
* @file BNO08xTestHelper.hpp
* @author Myles Parfeniuk
*/
#pragma once
// standard library includes
@ -7,92 +11,313 @@
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>
/**
* @brief Clears the most significant byte of a 16-bit value.
*
* @param evt_grp_task_flow Task flow event group handle.
* @param running_bit EVT_GRP_TSK_FLW_RUNNING_BIT
*
* @return The value with the MSB cleared.
*/
#define CHECK_TASKS_RUNNING(evt_grp_task_flow, running_bit) ((xEventGroupGetBits(evt_grp_task_flow) & (running_bit)) != 0)
// packet parsing macros
/**
* @brief Clears the most significant byte of a 16-bit value.
*
* @param val_16bit The 16-bit value to modify.
* @return The value with the MSB cleared.
*/
#define UINT16_CLR_MSB(val_16bit) ((val_16bit) & 0x00FFU)
/**
* @brief Clears the least significant byte of a 16-bit value.
*
* @param val_16bit The 16-bit value to modify.
* @return The value with the MSB cleared.
*/
#define UINT16_CLR_LSB(val_16bit) ((val_16bit) & 0xFF00U)
/**
* @brief Clears a specified byte in a 32-bit value.
*
* @param val_32bit The 32-bit value to modify.
* @param byte2clear The byte index to clear (0 = LSB, 3 = MSB).
* @return The value with the specified byte cleared.
*/
#define UINT32_CLR_BYTE(val_32bit, byte2clear) ((val_32bit) & ~(0xFFUL << (byte2clear * 8UL)))
/**
* @brief Masks a specified byte in a 32-bit value.
*
* @param val_32bit The 32-bit value to modify.
* @param byte2mask The byte index to mask (0 = LSB, 3 = MSB).
* @return The value with the specified byte masked.
*/
#define UINT32_MSK_BYTE(val_32bit, byte2mask) ((val_32bit) & (0xFFUL << (byte2mask * 8UL)))
// parsing universal to any packet
#define PARSE_PACKET_LENGTH(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->header[1]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->header[0])))
#define PARSE_PACKET_DATA_LENGTH(packet_ptr) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->header[1]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->header[0])))
/**
* @brief Parse length from SHTP packet header.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Length of SHTP packet.
*/
#define PARSE_PACKET_LENGTH(packet_ptr) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet_ptr->header[1]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet_ptr->header[0])))
/**
* @brief Parse timestamp from SHTP packet.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Packet timestamp.
*/
#define PARSE_PACKET_TIMESTAMP(packet_ptr) \
(UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[4]) << 24UL, 3UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[3]) << 16UL, 2UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[2]) << 8UL, 1UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[1]), 0UL))
// product id report parsing
/**
* @brief Parse reset reason from SHTP packet containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Reset reason.
*/
#define PARSE_PRODUCT_ID_REPORT_RESET_REASON(packet_ptr) UINT32_MSK_BYTE(static_cast<uint32_t>(packet_ptr->body[1]), 0UL)
/**
* @brief Parse sw part number from SHTP packet containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sw part number.
*/
#define PARSE_PRODUCT_ID_REPORT_SW_PART_NO(packet_ptr) \
(UINT32_MSK_BYTE(static_cast<uint32_t>(packet_ptr->body[7]) << 24UL, 3UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet_ptr->body[6]) << 16UL, 2UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet_ptr->body[5]) << 8UL, 1UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet_ptr->body[4]), 0UL))
/**
* @brief Parse sw build number from SHTP packet containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sw build number.
*/
#define PARSE_PRODUCT_ID_REPORT_SW_BUILD_NO(packet_ptr) \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[11]) << 24UL, 3UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[10]) << 16UL, 2UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[9]) << 8UL, 1UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[8]), 0UL)
/**
* @brief Parse sw version patch from SHTP packet containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sw version patch.
*/
#define PARSE_PRODUCT_ID_REPORT_SW_VERSION_PATCH(packet_ptr) \
(UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[13]) << 8UL, 1UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[12]), 0UL))
/**
* @brief Parse product ID SHTP packet containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Product ID.
*/
#define PARSE_PRODUCT_ID_REPORT_PRODUCT_ID(packet_ptr) UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[0]), 0UL)
/**
* @brief Parse product sw version major containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sw version major.
*/
#define PARSE_PRODUCT_ID_REPORT_SW_VERSION_MAJOR(packet_ptr) UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[2]), 0UL)
/**
* @brief Parse product sw version minor containing product ID report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sw version minor.
*/
#define PARSE_PRODUCT_ID_REPORT_SW_VERSION_MINOR(packet_ptr) UINT32_MSK_BYTE(static_cast<uint32_t>(packet->body[3]), 0UL)
// gyro report parsing
/**
* @brief Parse quat I data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Quat I data.
*/
#define PARSE_GYRO_REPORT_RAW_QUAT_I(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[1]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[0])))
/**
* @brief Parse quat J data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Quat J data.
*/
#define PARSE_GYRO_REPORT_RAW_QUAT_J(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[3]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[2])))
/**
* @brief Parse quat K data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Quat K data.
*/
#define PARSE_GYRO_REPORT_RAW_QUAT_K(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[4])))
/**
* @brief Parse quat real data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Quat real data.
*/
#define PARSE_GYRO_REPORT_RAW_QUAT_REAL(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[7]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[6])))
/**
* @brief Parse x axis velocity data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return x velocity data.
*/
#define PARSE_GYRO_REPORT_RAW_GYRO_VEL_X(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[9]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[8])))
/**
* @brief Parse y axis velocity data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return y velocity data.
*/
#define PARSE_GYRO_REPORT_RAW_GYRO_VEL_Y(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[11]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[10])))
/**
* @brief Parse z axis velocity data from integrated gyro rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return z velocity data.
*/
#define PARSE_GYRO_REPORT_RAW_GYRO_VEL_Z(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[13]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[12])))
// input report parsing
/**
* @brief Parse status bits from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Input report status bits.
*/
#define PARSE_INPUT_REPORT_STATUS_BITS(packet) (packet->body[5 + 2] & 0x03U)
/**
* @brief Parse report ID from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Report ID.
*/
#define PARSE_INPUT_REPORT_REPORT_ID(packet) UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5]))
/**
* @brief Parse first data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return First data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_1(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 5]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 4])))
/**
* @brief Parse second data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return Second data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_2(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 7]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 6])))
/**
* @brief Parse third data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return third data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_3(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 9]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 8])))
/**
* @brief Parse fourth data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return fourth data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_4(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 11]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 10])))
/**
* @brief Parse fifth data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return fifth data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_5(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 13]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 12])))
/**
* @brief Parse sixth data block from input report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return sixth data block of input report.
*/
#define PARSE_INPUT_REPORT_DATA_6(packet) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet->body[5 + 15]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet->body[5 + 14])))
/**
* @brief Checks if packet containing input report is a rotation vector report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return True if contained input report is rotation vector report.
*/
#define IS_ROTATION_VECTOR_REPORT(packet) \
((packet)->body[5] == SENSOR_REPORT_ID_ROTATION_VECTOR || (packet)->body[5] == SENSOR_REPORT_ID_GAME_ROTATION_VECTOR || \
(packet)->body[5] == SENSOR_REPORT_ID_ARVR_STABILIZED_ROTATION_VECTOR || \
(packet)->body[5] == SENSOR_REPORT_ID_ARVR_STABILIZED_GAME_ROTATION_VECTOR)
// frs read response report parsing
/**
* @brief Parse FRS record ID from FRS read response report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return FRS record ID.
*/
#define PARSE_FRS_READ_RESPONSE_REPORT_RECORD_ID(packet_body) \
(UINT16_CLR_LSB(static_cast<uint16_t>(packet_body[13]) << 8U) | UINT16_CLR_MSB(static_cast<uint16_t>(packet_body[12])))
/**
* @brief Parse data block 1 from FRS read response report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return FRS read response data block 1.
*/
#define PARSE_FRS_READ_RESPONSE_REPORT_DATA_1(packet_body) \
(UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[7]) << 24UL, 3UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[6]) << 16UL, 2UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[5]) << 8UL, 1UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[4]), 0UL))
/**
* @brief Parse data block 2 from FRS read response report.
*
* @param packet Pointer to bno08x_rx_packet_t containing data.
* @return FRS read response data block 2.
*/
#define PARSE_FRS_READ_RESPONSE_REPORT_DATA_2(packet_body) \
(UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[11]) << 24UL, 3UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[10]) << 16UL, 2UL) | \
UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[9]) << 8UL, 1UL) | UINT32_MSK_BYTE(static_cast<uint32_t>(packet_body[8]), 0UL))

View File

@ -5,7 +5,6 @@
* @brief BNO08x imu constructor.
*
* Construct a BNO08x object for managing a BNO08x sensor.
* Initializes required GPIO pins, interrupts, SPI peripheral.
*
* @param imu_config Configuration settings (optional), default settings can be seen in bno08x_config_t
* @return void, nothing to return
@ -25,6 +24,13 @@ BNO08x::BNO08x(bno08x_config_t imu_config)
{
}
/**
* @brief BNO08x imu deconstructor.
*
* Deconstructs a BNO08x object and releases any utilized resources.
*
* @return void, nothing to return
*/
BNO08x::~BNO08x()
{
// disable interrupts before beginning so we can ensure SPI task doesn't attempt to run
@ -60,10 +66,10 @@ BNO08x::~BNO08x()
/**
* @brief Initializes BNO08x sensor
*
* Resets sensor and goes through initializing process outlined in BNO08x datasheet.
* Launches two tasks, one to manage SPI transactions, another to process any received data.
* Resets sensor and goes through initialization process.
* Configures GPIO, required ISRs, and launches two tasks, one to manage SPI transactions, another to process any received data.
*
* @return void, nothing to return
* @return true if initialization was success, false if otherwise
*/
bool BNO08x::initialize()
{
@ -101,6 +107,11 @@ bool BNO08x::initialize()
return true;
}
/**
* @brief Initializes required esp-idf SPI data structures with values from user passed bno08x_config_t struct.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_config_args()
{
if ((imu_config.io_cs == GPIO_NUM_NC))
@ -162,6 +173,11 @@ esp_err_t BNO08x::init_config_args()
return ESP_OK;
}
/**
* @brief Initializes required gpio inputs.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_gpio_inputs()
{
esp_err_t ret = ESP_OK;
@ -184,6 +200,11 @@ esp_err_t BNO08x::init_gpio_inputs()
return ret;
}
/**
* @brief Initializes required gpio outputs.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_gpio_outputs()
{
esp_err_t ret = ESP_OK;
@ -209,6 +230,11 @@ esp_err_t BNO08x::init_gpio_outputs()
return ret;
}
/**
* @brief Initializes required gpio.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_gpio()
{
esp_err_t ret = ESP_OK;
@ -232,6 +258,11 @@ esp_err_t BNO08x::init_gpio()
return ret;
}
/**
* @brief Initializes host interrupt ISR.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_hint_isr()
{
esp_err_t ret = ESP_OK;
@ -267,6 +298,11 @@ esp_err_t BNO08x::init_hint_isr()
return ret;
}
/**
* @brief Initializes SPI.
*
* @return ESP_OK if initialization was success.
*/
esp_err_t BNO08x::init_spi()
{
esp_err_t ret = ESP_OK;
@ -307,6 +343,11 @@ esp_err_t BNO08x::init_spi()
return ret;
}
/**
* @brief Deinitializes GPIO, called from deconstructor.
*
* @return ESP_OK if deinitialization was success.
*/
esp_err_t BNO08x::deinit_gpio()
{
esp_err_t ret = ESP_OK;
@ -328,6 +369,11 @@ esp_err_t BNO08x::deinit_gpio()
return ret;
}
/**
* @brief Deinitializes GPIO inputs, called from deconstructor.
*
* @return ESP_OK if deinitialization was success.
*/
esp_err_t BNO08x::deinit_gpio_inputs()
{
esp_err_t ret = ESP_OK;
@ -339,6 +385,11 @@ esp_err_t BNO08x::deinit_gpio_inputs()
return ret;
}
/**
* @brief Deinitializes GPIO outputs, called from deconstructor.
*
* @return ESP_OK if deinitialization was success.
*/
esp_err_t BNO08x::deinit_gpio_outputs()
{
esp_err_t ret = ESP_OK;
@ -370,6 +421,11 @@ esp_err_t BNO08x::deinit_gpio_outputs()
return ret;
}
/**
* @brief Deinitializes host interrupt ISR, called from deconstructor.
*
* @return ESP_OK if deinitialization was success.
*/
esp_err_t BNO08x::deinit_hint_isr()
{
esp_err_t ret = ESP_OK;
@ -396,6 +452,11 @@ esp_err_t BNO08x::deinit_hint_isr()
return ret;
}
/**
* @brief Deinitializes SPI.
*
* @return ESP_OK if deinitialization was success.
*/
esp_err_t BNO08x::deinit_spi()
{
esp_err_t ret = ESP_OK;
@ -722,6 +783,13 @@ esp_err_t BNO08x::receive_packet()
return ret;
}
/**
* @brief Receives a SHTP packet header via SPI.
*
* @param packet Pointer to bno08x_rx_packet_t to save header to.
*
* @return ESP_OK if receive was success.
*/
esp_err_t BNO08x::receive_packet_header(bno08x_rx_packet_t* packet)
{
@ -747,6 +815,13 @@ esp_err_t BNO08x::receive_packet_header(bno08x_rx_packet_t* packet)
return ret;
}
/**
* @brief Receives a SHTP packet body via SPI.
*
* @param packet Pointer to bno08x_rx_packet_t to save body to.
*
* @return ESP_OK if receive was success.
*/
esp_err_t BNO08x::receive_packet_body(bno08x_rx_packet_t* packet)
{
esp_err_t ret = ESP_OK;
@ -782,7 +857,7 @@ void BNO08x::enable_report(uint8_t report_ID, uint32_t time_between_reports, con
if ((xEventGroupGetBits(evt_grp_report_en) & ~report_evt_grp_bit) == 0)
hard_reset();
update_report_period(report_ID, time_between_reports);
update_report_period_trackers(report_ID, time_between_reports);
queue_feature_command(report_ID, time_between_reports, special_config);
if (wait_for_tx_done()) // wait for transmit operation to complete
@ -812,7 +887,7 @@ void BNO08x::enable_report(uint8_t report_ID, uint32_t time_between_reports, con
*/
void BNO08x::disable_report(uint8_t report_ID, const EventBits_t report_evt_grp_bit)
{
update_report_period(report_ID, 0);
update_report_period_trackers(report_ID, 0);
queue_feature_command(report_ID, 0);
if (wait_for_tx_done()) // wait for transmit operation to complete
{
@ -836,9 +911,8 @@ void BNO08x::disable_report(uint8_t report_ID, const EventBits_t report_evt_grp_
0x00 0x00 0x00 0x00 0x00
The 0xFC indicates it is a get feature response, the 0x05 indicates it is for the rotation vector, the rest of the body will be 0.
Lets flush this response as it's currently detected as an invalid packet, we don't care about it.
It might be wise to detect the response for the respective report being disabled, but is probably not necessary.
It might be wise to detect the response for the respective report being disabled, but is probably not necessary. For now, all get feature
responses are detected as valid packets.
*/
// no reports enabled, disable hint to avoid wasting processing time
@ -1008,6 +1082,7 @@ void BNO08x::calibrate_planar_accelerometer()
* @brief Queues a packet containing a command to calibrate the specified sensor.
*
* @param sensor_to_calibrate The sensor to calibrate.
*
* @return void, nothing to return
*/
void BNO08x::queue_calibrate_command(uint8_t sensor_to_calibrate)
@ -1072,7 +1147,7 @@ void BNO08x::request_calibration_status()
/**
* @brief Returns true if calibration has completed.
*
* @return void, nothing to return
* @return True if calibration complete, false if otherwise.
*/
bool BNO08x::calibration_complete()
{
@ -1116,7 +1191,7 @@ void BNO08x::save_calibration()
* Waits for accuracy of returned quaternions and magnetic field vectors to be high, then saves calibration data and
* returns.
*
* @return void, nothing to return
* @return True if calibration succeeded, false if otherwise.
*/
bool BNO08x::run_full_calibration_routine()
{
@ -1211,7 +1286,8 @@ bool BNO08x::run_full_calibration_routine()
* @brief Checks if BNO08x has asserted interrupt and sent data.
*
* @param ignore_no_reports_enabled Forces a wait for data even if no reports are enabled (default is false), used for unit tests.
* @return true if new data has been parsed and saved
*
* @return True if new data has been parsed and saved, false if otherwise.
*/
bool BNO08x::data_available(bool ignore_no_reports_enabled)
{
@ -1229,6 +1305,7 @@ bool BNO08x::data_available(bool ignore_no_reports_enabled)
* @brief Registers a callback to execute when new data from a report is received.
*
* @param cb_fxn Pointer to the call-back function should be of void return type and void input parameters.
*
* @return void, nothing to return
*/
void BNO08x::register_cb(std::function<void()> cb_fxn)
@ -1242,7 +1319,8 @@ void BNO08x::register_cb(std::function<void()> cb_fxn)
* @param packet The packet to be parsed.
* @param notify_users Bool reference that is set to true if users should be notified of new data through callbacks/polling, false if packet is valid
* but users don't need to be notified.
* @return 0 if invalid packet.
*
* @return 0 if invalid packet, non-zero if otherwise.
*/
uint16_t BNO08x::parse_packet(bno08x_rx_packet_t* packet, bool& notify_users)
{
@ -1310,7 +1388,7 @@ uint16_t BNO08x::parse_packet(bno08x_rx_packet_t* packet, bool& notify_users)
// clang-format on
// this will update the rawAccelX, etc variables depending on which feature report is found
return parse_gyro_report(packet);
return parse_gyro_integrated_rotation_vector_report(packet);
break;
@ -1350,6 +1428,7 @@ uint16_t BNO08x::parse_packet(bno08x_rx_packet_t* packet, bool& notify_users)
* @brief Parses product id report and prints device info.
*
* @param packet The packet containing product id report.
*
* @return 1, always valid.
*/
uint16_t BNO08x::parse_product_id_report(bno08x_rx_packet_t* packet)
@ -1389,6 +1468,7 @@ uint16_t BNO08x::parse_product_id_report(bno08x_rx_packet_t* packet)
* @brief Sends packet to be parsed to meta data function call (FRS_read_data()) through queue.
*
* @param packet The packet containing the frs read report.
*
* @return 1, always valid, parsing for this happens in frs_read_word()
*/
uint16_t BNO08x::parse_frs_read_response_report(bno08x_rx_packet_t* packet)
@ -1401,6 +1481,7 @@ uint16_t BNO08x::parse_feature_get_response_report(bno08x_rx_packet_t* packet)
{
uint16_t report_ID = 0;
// TODO: add get feature requests and handle this properly, this is just to handle the unsolcited get feature responses due to report rate changes
switch (packet->body[1])
{
case SENSOR_REPORT_ID_ACCELEROMETER:
@ -1505,12 +1586,12 @@ uint16_t BNO08x::parse_feature_get_response_report(bno08x_rx_packet_t* packet)
*
* @param packet bno8x_rx_packet_t containing the input report to parse
*
* @return The report ID of the respective sensor, for ex. SENSOR_REPORT_ID_GYRO_INTEGRATED_ROTATION_VECTOR, 0 if invalid.
* @return The report ID of the respective sensor, for ex. SENSOR_REPORT_ID_ACCELEROMETER, 0 if invalid.
*/
uint16_t BNO08x::parse_input_report(bno08x_rx_packet_t* packet)
{
uint8_t status = PARSE_INPUT_REPORT_STATUS_BITS(packet);
uint16_t data_length = PARSE_PACKET_DATA_LENGTH(packet);
uint16_t data_length = PARSE_PACKET_LENGTH(packet);
uint16_t report_ID = PARSE_INPUT_REPORT_REPORT_ID(packet);
uint16_t data[6] = {0};
@ -1602,7 +1683,7 @@ uint16_t BNO08x::parse_input_report(bno08x_rx_packet_t* packet)
* @param data uint16_t array to store parsed data in
* @param data_length length of data in bytes parsed from packet header
*
* @return The report ID of the respective sensor, for ex. SENSOR_REPORT_ID_GYRO_INTEGRATED_ROTATION_VECTOR, 0 if invalid.
* @return void, nothing to return
*/
void BNO08x::parse_input_report_data(bno08x_rx_packet_t* packet, uint16_t* data, uint16_t data_length)
{
@ -1626,7 +1707,7 @@ void BNO08x::parse_input_report_data(bno08x_rx_packet_t* packet, uint16_t* data,
}
/**
* @brief Parses received gyro report sent by BNO08x.
* @brief Parses received gyro integrated rotation vector report sent by BNO08x.
*
* Unit responds with packet that contains the following:
*
@ -1639,15 +1720,12 @@ void BNO08x::parse_input_report_data(bno08x_rx_packet_t* packet, uint16_t* data,
* packet->body[10:11]: Raw gyroscope angular velocity in Y axis
* packet->body[12:13]: Raw gyroscope angular velocity in Z axis
*
* @param packet bno8x_rx_packet_t containing the gyro integrated rotation vector report report to parse
*
* @return Integrated rotation vector report ID (always valid)
*/
uint16_t BNO08x::parse_gyro_report(bno08x_rx_packet_t* packet)
uint16_t BNO08x::parse_gyro_integrated_rotation_vector_report(bno08x_rx_packet_t* packet)
{
// calculate the number of data bytes in this packet
uint16_t data_length = PARSE_PACKET_DATA_LENGTH(packet);
data_length &= ~(1U << 15U); // Clear the MSbit. This bit indicates if this package is a continuation of the last.
// the gyro-integrated input reports are sent via the special gyro channel and do not include the usual ID, sequence, and status fields
update_integrated_gyro_rotation_vector_data(packet);
@ -2022,7 +2100,7 @@ void BNO08x::enable_gravity(uint32_t time_between_reports)
}
/**
* @brief Sends command to enable gyro reports (See Ref. Manual 6.5.13)
* @brief Sends command to enable calibrated gyro reports (See Ref. Manual 6.5.13)
*
* @param time_between_reports Desired time between reports in microseconds.
* @return void, nothing to return
@ -2102,7 +2180,7 @@ void BNO08x::enable_activity_classifier(uint32_t time_between_reports, uint32_t
}
/**
* @brief Sends command to enable raw accelerometer reports (See Ref. Manual 6.5.8)
* @brief Sends command to enable raw MEMs accelerometer reports (See Ref. Manual 6.5.8)
*
* @param time_between_reports Desired time between reports in microseconds.
* @return void, nothing to return
@ -2124,7 +2202,7 @@ void BNO08x::enable_raw_mems_gyro(uint32_t time_between_reports)
}
/**
* @brief Sends command to enable raw magnetometer reports (See Ref. Manual 6.5.15)
* @brief Sends command to enable raw MEMs magnetometer reports (See Ref. Manual 6.5.15)
*
* @param time_between_reports Desired time between reports in microseconds.
* @return void, nothing to return
@ -2215,7 +2293,7 @@ void BNO08x::disable_gravity()
}
/**
* @brief Sends command to disable gyro reports by setting report interval to 0.
* @brief Sends command to disable calibrated gyro reports by setting report interval to 0.
*
* @return void, nothing to return
*/
@ -2886,7 +2964,7 @@ BNO08xAccuracy BNO08x::get_linear_accel_accuracy()
}
/**
* @brief Get full raw mems acceleration.
* @brief Get full raw acceleration from physical accelerometer MEMs sensor (See Ref. Manual 6.5.8).
*
* @param x Reference variable to save raw X axis acceleration.
* @param y Reference variable to save raw Y axis acceleration.
@ -2932,7 +3010,7 @@ uint16_t BNO08x::get_raw_mems_accel_Z()
}
/**
* @brief Get full raw mems gyro data.
* @brief Get raw gyroscope full reading from physical gyroscope MEMs sensor (See Ref. Manual 6.5.12)
*
* @param x Reference variable to save raw X axis data.
* @param y Reference variable to save raw Y axis data.
@ -2978,7 +3056,7 @@ uint16_t BNO08x::get_raw_mems_gyro_Z()
}
/**
* @brief Get full raw mems magnetometer data.
* @brief Get raw magnetometer full reading from physical magnetometer sensor (See Ref. Manual 6.5.15)
*
* @param x Reference variable to save raw X axis data.
* @param y Reference variable to save raw Y axis data.
@ -3713,6 +3791,11 @@ void BNO08x::data_proc_task()
vTaskDelete(NULL);
}
/**
* @brief Launches spi_task and data_proc_task on constructor call.
*
* @return ESP_OK if tasks successfully created.
*/
esp_err_t BNO08x::launch_tasks()
{
BaseType_t task_created = pdFALSE;
@ -3750,6 +3833,11 @@ esp_err_t BNO08x::launch_tasks()
return ESP_OK;
}
/**
* @brief Deletes spi_task and data_proc_task safely on deconstructor call.
*
* @return ESP_OK if tasks successfully deleted.
*/
esp_err_t BNO08x::kill_all_tasks()
{
static const constexpr uint8_t TASK_DELETE_TIMEOUT_MS = 10;
@ -3791,9 +3879,9 @@ esp_err_t BNO08x::kill_all_tasks()
* @param report_ID report ID to update period of.
* @return void, nothing to return
*/
void BNO08x::update_report_period(uint8_t report_ID, uint32_t new_period)
void BNO08x::update_report_period_trackers(uint8_t report_ID, uint32_t new_period)
{
uint8_t idx = report_ID_to_report_period_idx(report_ID);
uint8_t idx = report_ID_to_report_period_tracker_idx(report_ID);
if (idx != REPORT_CNT)
{
@ -3845,7 +3933,7 @@ void BNO08x::update_report_period(uint8_t report_ID, uint32_t new_period)
* @param report_ID report ID to return index for.
* @return Index in report_period_trackers corresponding to passed report ID.
*/
uint8_t BNO08x::report_ID_to_report_period_idx(uint8_t report_ID)
uint8_t BNO08x::report_ID_to_report_period_tracker_idx(uint8_t report_ID)
{
switch (report_ID)
{

View File

@ -22,8 +22,8 @@ TEST_CASE("Enable Incorrect Report", "[SingleReportEnableDisable]")
TEST_ASSERT_EQUAL(true, imu->initialize());
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable linear accelerometer report but check for angular accelerometer data (should remain as default test values) */
@ -36,7 +36,7 @@ TEST_CASE("Enable Incorrect Report", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::accelerometer_data_is_default(&report_data, &prev_report_data);
@ -54,8 +54,8 @@ TEST_CASE("Enable Incorrect Report", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
imu->disable_linear_accelerometer();
@ -76,8 +76,8 @@ TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -90,7 +90,7 @@ TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -105,8 +105,8 @@ TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -121,7 +121,7 @@ TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -137,8 +137,8 @@ TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -160,8 +160,8 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -174,7 +174,7 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -189,8 +189,8 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -205,7 +205,7 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -221,8 +221,8 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -244,8 +244,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnable
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -258,7 +258,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnable
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -273,8 +273,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnable
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -289,7 +289,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnable
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -305,8 +305,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnable
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -328,8 +328,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportE
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -342,7 +342,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportE
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -357,8 +357,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportE
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -373,7 +373,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportE
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -389,8 +389,8 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportE
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -412,8 +412,8 @@ TEST_CASE("Enable/Disable Gyro Integrated Rotation Vector", "[SingleReportEnable
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -426,7 +426,7 @@ TEST_CASE("Enable/Disable Gyro Integrated Rotation Vector", "[SingleReportEnable
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::gyro_integrated_rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -446,8 +446,8 @@ TEST_CASE("Enable/Disable Gyro Integrated Rotation Vector", "[SingleReportEnable
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -462,7 +462,7 @@ TEST_CASE("Enable/Disable Gyro Integrated Rotation Vector", "[SingleReportEnable
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::gyro_integrated_rotation_vector_data_is_default(&report_data, &prev_report_data);
@ -482,8 +482,8 @@ TEST_CASE("Enable/Disable Gyro Integrated Rotation Vector", "[SingleReportEnable
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -505,8 +505,8 @@ TEST_CASE("Enable/Disable Uncalibrated Gyro", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -519,7 +519,7 @@ TEST_CASE("Enable/Disable Uncalibrated Gyro", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::uncalibrated_gyro_data_is_default(&report_data, &prev_report_data);
@ -537,8 +537,8 @@ TEST_CASE("Enable/Disable Uncalibrated Gyro", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -553,7 +553,7 @@ TEST_CASE("Enable/Disable Uncalibrated Gyro", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::uncalibrated_gyro_data_is_default(&report_data, &prev_report_data);
@ -571,8 +571,8 @@ TEST_CASE("Enable/Disable Uncalibrated Gyro", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -594,8 +594,8 @@ TEST_CASE("Enable/Disable Calibrated Gyro", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -608,7 +608,7 @@ TEST_CASE("Enable/Disable Calibrated Gyro", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::calibrated_gyro_data_is_default(&report_data, &prev_report_data);
@ -625,8 +625,8 @@ TEST_CASE("Enable/Disable Calibrated Gyro", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -641,7 +641,7 @@ TEST_CASE("Enable/Disable Calibrated Gyro", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::calibrated_gyro_data_is_default(&report_data, &prev_report_data);
@ -658,8 +658,8 @@ TEST_CASE("Enable/Disable Calibrated Gyro", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -681,8 +681,8 @@ TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -695,7 +695,7 @@ TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::accelerometer_data_is_default(&report_data, &prev_report_data);
@ -713,8 +713,8 @@ TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -729,7 +729,7 @@ TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::accelerometer_data_is_default(&report_data, &prev_report_data);
@ -747,8 +747,8 @@ TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -770,8 +770,8 @@ TEST_CASE("Enable/Disable Linear Accelerometer", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -784,7 +784,7 @@ TEST_CASE("Enable/Disable Linear Accelerometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::linear_accelerometer_data_is_default(&report_data, &prev_report_data);
@ -802,8 +802,8 @@ TEST_CASE("Enable/Disable Linear Accelerometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -818,7 +818,7 @@ TEST_CASE("Enable/Disable Linear Accelerometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::linear_accelerometer_data_is_default(&report_data, &prev_report_data);
@ -836,8 +836,8 @@ TEST_CASE("Enable/Disable Linear Accelerometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -859,8 +859,8 @@ TEST_CASE("Enable/Disable Gravity", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -873,7 +873,7 @@ TEST_CASE("Enable/Disable Gravity", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::gravity_data_is_default(&report_data, &prev_report_data);
@ -891,8 +891,8 @@ TEST_CASE("Enable/Disable Gravity", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -907,7 +907,7 @@ TEST_CASE("Enable/Disable Gravity", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::gravity_data_is_default(&report_data, &prev_report_data);
@ -925,8 +925,8 @@ TEST_CASE("Enable/Disable Gravity", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -948,8 +948,8 @@ TEST_CASE("Enable/Disable Magnetometer", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -962,7 +962,7 @@ TEST_CASE("Enable/Disable Magnetometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::magnetometer_data_is_default(&report_data, &prev_report_data);
@ -980,8 +980,8 @@ TEST_CASE("Enable/Disable Magnetometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -996,7 +996,7 @@ TEST_CASE("Enable/Disable Magnetometer", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::magnetometer_data_is_default(&report_data, &prev_report_data);
@ -1014,8 +1014,8 @@ TEST_CASE("Enable/Disable Magnetometer", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -1037,8 +1037,8 @@ TEST_CASE("Enable/Disable Step Counter", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -1051,7 +1051,7 @@ TEST_CASE("Enable/Disable Step Counter", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::step_detector_data_is_default(&report_data, &prev_report_data);
@ -1065,8 +1065,8 @@ TEST_CASE("Enable/Disable Step Counter", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -1081,7 +1081,7 @@ TEST_CASE("Enable/Disable Step Counter", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::step_detector_data_is_default(&report_data, &prev_report_data);
@ -1095,8 +1095,8 @@ TEST_CASE("Enable/Disable Step Counter", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -1118,8 +1118,8 @@ TEST_CASE("Enable/Disable Stability Classifier", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -1132,7 +1132,7 @@ TEST_CASE("Enable/Disable Stability Classifier", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::stability_classifier_data_is_default(&report_data, &prev_report_data);
@ -1146,8 +1146,8 @@ TEST_CASE("Enable/Disable Stability Classifier", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -1162,7 +1162,7 @@ TEST_CASE("Enable/Disable Stability Classifier", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::stability_classifier_data_is_default(&report_data, &prev_report_data);
@ -1176,8 +1176,8 @@ TEST_CASE("Enable/Disable Stability Classifier", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
@ -1200,8 +1200,8 @@ TEST_CASE("Enable/Disable Activity Classifier", "[SingleReportEnableDisable]")
imu = BNO08xTestHelper::get_test_imu();
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
/*enable respective report to test and ensure it reports new data */
@ -1218,7 +1218,7 @@ TEST_CASE("Enable/Disable Activity Classifier", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::activity_classifier_data_is_default(&report_data, &prev_report_data);
@ -1232,8 +1232,8 @@ TEST_CASE("Enable/Disable Activity Classifier", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
@ -1248,7 +1248,7 @@ TEST_CASE("Enable/Disable Activity Classifier", "[SingleReportEnableDisable]")
if (imu->data_available())
{
prev_report_data = report_data;
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::update_report_data(&report_data);
// check if any default values have been overwritten, implying new data from respective report
new_data = BNO08xTestHelper::activity_classifier_data_is_default(&report_data, &prev_report_data);
@ -1262,8 +1262,8 @@ TEST_CASE("Enable/Disable Activity Classifier", "[SingleReportEnableDisable]")
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
// reset all data used in report test
BNO08xTestHelper::reset_all_imu_data_to_test_defaults(imu);
BNO08xTestHelper::update_report_data(&report_data, imu);
BNO08xTestHelper::reset_all_imu_data_to_test_defaults();
BNO08xTestHelper::update_report_data(&report_data);
}
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");