re_enable_reports() bugfix, circle detector rpts
This commit is contained in:
parent
4b5fccb4f3
commit
fe9c1922ad
|
|
@ -38,6 +38,7 @@ class BNO08x
|
|||
bool initialize();
|
||||
bool hard_reset();
|
||||
bool soft_reset();
|
||||
bool disable_all_reports();
|
||||
BNO08xResetReason get_reset_reason();
|
||||
|
||||
bool on();
|
||||
|
|
@ -91,6 +92,7 @@ class BNO08x
|
|||
BNO08xRptStabilityClassifier stability_classifier;
|
||||
BNO08xRptShakeDetector shake_detector;
|
||||
BNO08xRptTapDetector tap_detector;
|
||||
BNO08xRptCircleDetector circle_detector;
|
||||
|
||||
bno08x_reports_t(BNO08xPrivateTypes::bno08x_sync_ctx_t* sync_ctx)
|
||||
: accelerometer(SH2_ACCELEROMETER, BNO08xPrivateTypes::EVT_GRP_RPT_ACCELEROMETER_BIT, sync_ctx)
|
||||
|
|
@ -120,6 +122,7 @@ class BNO08x
|
|||
SH2_STABILITY_CLASSIFIER, BNO08xPrivateTypes::EVT_GRP_RPT_STABILITY_CLASSIFIER_BIT, sync_ctx)
|
||||
, shake_detector(SH2_SHAKE_DETECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_SHAKE_DETECTOR_BIT, sync_ctx)
|
||||
, tap_detector(SH2_TAP_DETECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_TAP_DETECTOR_BIT, sync_ctx)
|
||||
, circle_detector(SH2_CIRCLE_DETECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_CIRCLE_DETECTOR_BIT, sync_ctx)
|
||||
{
|
||||
}
|
||||
} bno08x_reports_t;
|
||||
|
|
@ -223,6 +226,7 @@ class BNO08x
|
|||
{SH2_STABILITY_CLASSIFIER, &rpt.stability_classifier},
|
||||
{SH2_SHAKE_DETECTOR, &rpt.shake_detector},
|
||||
{SH2_TAP_DETECTOR, &rpt.tap_detector},
|
||||
{SH2_CIRCLE_DETECTOR, &rpt.circle_detector},
|
||||
|
||||
// not implemented, see include/report for existing implementations to add your own
|
||||
{SH2_PRESSURE, nullptr}, // requires auxilary i2c sensor
|
||||
|
|
@ -239,7 +243,6 @@ class BNO08x
|
|||
{SH2_SLEEP_DETECTOR, nullptr},
|
||||
{SH2_TILT_DETECTOR, nullptr},
|
||||
{SH2_POCKET_DETECTOR, nullptr},
|
||||
{SH2_CIRCLE_DETECTOR, nullptr},
|
||||
{SH2_IZRO_MOTION_REQUEST, nullptr}
|
||||
};
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ namespace BNO08xPrivateTypes
|
|||
EVT_GRP_RPT_RAW_ACCELEROMETER_BIT = (1UL << 18U), ///< When set, raw accelerometer reports are active.
|
||||
EVT_GRP_RPT_RAW_GYRO_BIT = (1UL << 19U), ///< When set, raw gyro reports are active.
|
||||
EVT_GRP_RPT_RAW_MAGNETOMETER_BIT = (1UL << 20U), ///< When set, raw magnetometer reports are active.
|
||||
EVT_GRP_RPT_CIRCLE_DETECTOR_BIT = (1UL << 21U), ///< When set, circle detector reports are active.
|
||||
|
||||
EVT_GRP_RPT_ALL = EVT_GRP_RPT_RV_BIT | EVT_GRP_RPT_RV_GAME_BIT | EVT_GRP_RPT_RV_ARVR_S_BIT |
|
||||
EVT_GRP_RPT_RV_ARVR_S_GAME_BIT | EVT_GRP_RPT_LINEAR_ACCELEROMETER_BIT | EVT_GRP_RPT_GRAVITY_BIT |
|
||||
|
|
@ -106,7 +107,8 @@ namespace BNO08xPrivateTypes
|
|||
EVT_GRP_RPT_TAP_DETECTOR_BIT | EVT_GRP_RPT_STEP_COUNTER_BIT | EVT_GRP_RPT_STABILITY_CLASSIFIER_BIT |
|
||||
EVT_GRP_RPT_ACTIVITY_CLASSIFIER_BIT | EVT_GRP_RPT_RAW_ACCELEROMETER_BIT | EVT_GRP_RPT_RAW_GYRO_BIT |
|
||||
EVT_GRP_RPT_RAW_MAGNETOMETER_BIT | EVT_GRP_RPT_UNCAL_MAGNETOMETER_BIT | EVT_GRP_RPT_SHAKE_DETECTOR_BIT |
|
||||
EVT_GRP_RPT_ACCELEROMETER_BIT | EVT_GRP_RPT_GEOMAG_RV_BIT | EVT_GRP_RPT_GYRO_INTEGRATED_RV_BIT
|
||||
EVT_GRP_RPT_ACCELEROMETER_BIT | EVT_GRP_RPT_GEOMAG_RV_BIT | EVT_GRP_RPT_GYRO_INTEGRATED_RV_BIT |
|
||||
EVT_GRP_RPT_CIRCLE_DETECTOR_BIT
|
||||
};
|
||||
|
||||
/// @brief Bits for evt_grp_bno08x_task
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@
|
|||
#include "BNO08xRptStabilityClassifier.hpp"
|
||||
#include "BNO08xRptShakeDetector.hpp"
|
||||
#include "BNO08xRptTapDetector.hpp"
|
||||
#include "BNO08xRptCircleDetector.hpp"
|
||||
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
// standard library includes
|
||||
#include <functional>
|
||||
//esp-idf includes
|
||||
#include "esp_log.h"
|
||||
// in-house includes
|
||||
#include "BNO08xGlobalTypes.hpp"
|
||||
#include "BNO08xPrivateTypes.hpp"
|
||||
|
|
@ -23,7 +25,6 @@
|
|||
class BNO08xRpt
|
||||
{
|
||||
public:
|
||||
bool enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg);
|
||||
bool disable(sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg);
|
||||
bool register_cb(std::function<void(void)> cb_fxn);
|
||||
bool has_new_data();
|
||||
|
|
@ -31,6 +32,8 @@ class BNO08xRpt
|
|||
bool get_sample_counts(bno08x_sample_counts_t& sample_counts);
|
||||
bool clear_sample_counts();
|
||||
bool get_meta_data(bno08x_meta_data_t& meta_data);
|
||||
virtual bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) = 0;
|
||||
|
||||
protected:
|
||||
uint8_t ID; ///< Report ID, ex. SH2_ACCELERATION.
|
||||
|
|
@ -38,6 +41,7 @@ class BNO08xRpt
|
|||
uint32_t period_us; ///< The period/interval of the report in microseconds.
|
||||
BNO08xPrivateTypes::bno08x_sync_ctx_t* sync_ctx;
|
||||
|
||||
bool rpt_enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg);
|
||||
virtual void update_data(sh2_SensorValue_t* sensor_val) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptAcceleration : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_accel_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,13 +20,16 @@ class BNO08xRptActivityClassifier : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(uint32_t time_between_reports, BNO08xActivityEnable activities_to_enable,
|
||||
sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg);
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg) override;
|
||||
bno08x_activity_classifier_t get();
|
||||
BNO08xActivity get_most_likely_activity();
|
||||
void set_activities_to_enable(BNO08xActivityEnable activities_to_enable);
|
||||
|
||||
private:
|
||||
void update_data(sh2_SensorValue_t* sensor_val) override;
|
||||
bno08x_activity_classifier_t data; ///< Most recent report data, doesn't account for step rollover.
|
||||
BNO08xActivityEnable activities_to_enable =
|
||||
BNO08xActivityEnable::ALL; ///< Activities to be monitored, call enable after setting.
|
||||
static const constexpr char* TAG = "BNO08xRptActivityClassifier";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptCalGyro : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_gyro_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptCalMagnetometer : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_magf_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* @file BNO08xRptCircleDetector.hpp
|
||||
* @author Myles Parfeniuk
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BNO08xRpt.hpp"
|
||||
|
||||
/**
|
||||
* @class BNO08xRptCircleDetector
|
||||
*
|
||||
* @brief Class to represent circle detector reports. (See Ref. Manual 6.40.2)
|
||||
*/
|
||||
class BNO08xRptCircleDetector : public BNO08xRpt
|
||||
{
|
||||
public:
|
||||
BNO08xRptCircleDetector(uint8_t ID, EventBits_t rpt_bit, BNO08xPrivateTypes::bno08x_sync_ctx_t* sync_ctx)
|
||||
: BNO08xRpt(ID, rpt_bit, sync_ctx)
|
||||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
uint16_t get();
|
||||
|
||||
private:
|
||||
void update_data(sh2_SensorValue_t* sensor_val) override;
|
||||
uint16_t data; ///< Total amount of circles detected.
|
||||
static const constexpr char* TAG = "BNO08xRptCircleDetector";
|
||||
};
|
||||
|
|
@ -20,6 +20,8 @@ class BNO08xRptGravity : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_accel_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptLinearAcceleration : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_accel_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
class BNO08xRptRVGeneric : public BNO08xRpt
|
||||
{
|
||||
public:
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_quat_t get_quat();
|
||||
bno08x_euler_angle_t get_euler(bool in_degrees = true);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptRawMEMSAccelerometer : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_raw_accel_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptRawMEMSGyro : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_raw_gyro_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptRawMEMSMagnetometer : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_raw_magf_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptShakeDetector : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_shake_detector_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptStabilityClassifier : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_stability_classifier_t get();
|
||||
BNO08xStability get_stability();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptStepCounter : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_step_counter_t get();
|
||||
uint32_t get_total_steps();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ class BNO08xRptTapDetector : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg);
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
bno08x_tap_detector_t get();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class BNO08xRptUncalGyro : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
void get(bno08x_gyro_t& vel, bno08x_gyro_bias_t& bias);
|
||||
bno08x_gyro_t get_vel();
|
||||
bno08x_gyro_bias_t get_bias();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class BNO08xRptUncalMagnetometer : public BNO08xRpt
|
|||
{
|
||||
}
|
||||
|
||||
bool enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg) override;
|
||||
void get(bno08x_magf_t& magf, bno08x_magf_bias_t& bias);
|
||||
bno08x_magf_t get_magf();
|
||||
bno08x_magf_bias_t get_bias();
|
||||
|
|
|
|||
|
|
@ -185,16 +185,22 @@ void BNO08x::sh2_HAL_service_task_trampoline(void* arg)
|
|||
void BNO08x::sh2_HAL_service_task()
|
||||
{
|
||||
EventBits_t evt_grp_bno08x_task_bits = 0U;
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
int64_t last_hint_time = esp_timer_get_time();
|
||||
int64_t current_hint_time;
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
if (evt_grp_bno08x_task_bits & EVT_GRP_BNO08x_TASK_RESET_OCCURRED)
|
||||
{
|
||||
if (!re_enable_reports())
|
||||
if (re_enable_reports() != ESP_OK)
|
||||
{
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
#ifdef CONFIG_ESP32_BNO08x_LOG_STATEMENTS
|
||||
ESP_LOGE(TAG, "Failed to re-enable enabled reports after IMU reset.");
|
||||
#endif
|
||||
// clang-format on
|
||||
|
|
@ -211,6 +217,14 @@ void BNO08x::sh2_HAL_service_task()
|
|||
evt_grp_bno08x_task_bits = xEventGroupWaitBits(sync_ctx.evt_grp_task,
|
||||
EVT_GRP_BNO08x_TASK_HINT_ASSRT_BIT | EVT_GRP_BNO08x_TASK_RESET_OCCURRED, pdFALSE, pdFALSE, portMAX_DELAY);
|
||||
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
current_hint_time = esp_timer_get_time();
|
||||
ESP_LOGW(TAG, "HINT Asserted, time since last assertion: %lldus", current_hint_time - last_hint_time);
|
||||
last_hint_time = current_hint_time;
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
} while (evt_grp_bno08x_task_bits & EVT_GRP_BNO08x_TASKS_RUNNING);
|
||||
|
||||
xSemaphoreGive(sem_kill_tasks); // signal to deconstructor deletion is completed
|
||||
|
|
@ -320,6 +334,12 @@ void BNO08x::handle_sensor_report(sh2_SensorValue_t* sensor_val)
|
|||
{
|
||||
uint8_t rpt_ID = sensor_val->sensorId;
|
||||
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
ESP_LOGE(TAG, "Report RX'd, ID: %d", sensor_val->sensorId);
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// check if report implementation exists within map
|
||||
if (rpt_ID == SH2_RESERVED)
|
||||
return;
|
||||
|
|
@ -990,7 +1010,7 @@ esp_err_t BNO08x::deinit_tasks()
|
|||
if (kill_count != init_count)
|
||||
{
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
#ifdef CONFIG_ESP32_BNO08x_LOG_STATEMENTS
|
||||
ESP_LOGE(TAG, "Task deletion timed out in deconstructor call.");
|
||||
#endif
|
||||
// clang-format on
|
||||
|
|
@ -1120,6 +1140,47 @@ bool BNO08x::soft_reset()
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables all currently enabled reports.
|
||||
*
|
||||
* @return True if all currently enabled reports were disabled successfully.
|
||||
*/
|
||||
bool BNO08x::disable_all_reports()
|
||||
{
|
||||
int attempts = 0;
|
||||
|
||||
xEventGroupClearBits(sync_ctx.evt_grp_rpt_en, EVT_GRP_RPT_ALL);
|
||||
|
||||
while (sync_ctx.en_report_ids.size() != 0 && (attempts < TOTAL_RPT_COUNT))
|
||||
{
|
||||
uint8_t rpt_ID = sync_ctx.en_report_ids.back();
|
||||
BNO08xRpt* rpt = usr_reports.at(rpt_ID);
|
||||
if (rpt == nullptr)
|
||||
{
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_LOG_STATEMENTS
|
||||
ESP_LOGE(TAG, "NULL pointer detected in usr_reports map for enabled report.");
|
||||
#endif
|
||||
// clang-format on
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!rpt->disable())
|
||||
{
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_LOG_STATEMENTS
|
||||
ESP_LOGE(TAG, "Failed to disable: %d", rpt->ID);
|
||||
#endif
|
||||
// clang-format on
|
||||
return false;
|
||||
}
|
||||
|
||||
attempts++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns reason for previous reset via product ID report.
|
||||
*
|
||||
|
|
@ -1491,6 +1552,8 @@ esp_err_t BNO08x::re_enable_reports()
|
|||
continue;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Re-enabling. %d", rpt->ID);
|
||||
|
||||
if (rpt->rpt_bit & report_en_bits)
|
||||
{
|
||||
if (!rpt->enable(rpt->period_us))
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@
|
|||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRpt::enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
bool BNO08xRpt::rpt_enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
int sh2_res = SH2_OK;
|
||||
|
||||
EventBits_t report_en_bits = xEventGroupGetBits(sync_ctx->evt_grp_rpt_en);
|
||||
int16_t idx = -1;
|
||||
|
||||
sensor_cfg.reportInterval_us = time_between_reports;
|
||||
|
||||
|
|
@ -32,15 +31,28 @@ bool BNO08xRpt::enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_
|
|||
}
|
||||
else
|
||||
{
|
||||
xEventGroupSetBits(sync_ctx->evt_grp_rpt_en, rpt_bit); // set the event group bit
|
||||
|
||||
vTaskDelay(30UL / portTICK_PERIOD_MS); // delay a bit to allow command to execute
|
||||
period_us = time_between_reports; // update the period
|
||||
|
||||
// if not already enabled (ie user called this, not re_enable_reports())
|
||||
if (!(report_en_bits & rpt_bit))
|
||||
lock_user_data();
|
||||
for (int i = 0; i < sync_ctx->en_report_ids.size(); i++)
|
||||
{
|
||||
sync_ctx->en_report_ids.push_back(ID); // add report ID to enabled report IDs
|
||||
xEventGroupSetBits(sync_ctx->evt_grp_rpt_en, rpt_bit); // set the event group bit
|
||||
if (sync_ctx->en_report_ids[i] == ID)
|
||||
{
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if not already enabled (ie user called this, not re_enable_reports())
|
||||
if (idx == -1)
|
||||
{
|
||||
ESP_LOGI(TAG, "ADDED: %d", ID);
|
||||
sync_ctx->en_report_ids.push_back(ID); // add report ID to enabled report IDs
|
||||
}
|
||||
unlock_user_data();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -57,14 +69,26 @@ bool BNO08xRpt::enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_
|
|||
*/
|
||||
bool BNO08xRpt::disable(sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
int sh2_res = SH2_OK;
|
||||
int16_t idx = -1;
|
||||
|
||||
if (!enable(0UL, sensor_cfg))
|
||||
sensor_cfg.reportInterval_us = 0UL;
|
||||
|
||||
lock_sh2_HAL();
|
||||
sh2_res = sh2_setSensorConfig(ID, &sensor_cfg);
|
||||
unlock_sh2_HAL();
|
||||
|
||||
if (sh2_res != SH2_OK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the event group bit (this is redundant if called from BNO08x::disable_all_reports())
|
||||
xEventGroupClearBits(sync_ctx->evt_grp_rpt_en, rpt_bit);
|
||||
|
||||
// remove report ID from enabled report IDs
|
||||
lock_user_data();
|
||||
for (int i = 0; i < sync_ctx->en_report_ids.size(); i++)
|
||||
{
|
||||
if (sync_ctx->en_report_ids[i] == ID)
|
||||
|
|
@ -78,9 +102,11 @@ bool BNO08xRpt::disable(sh2_SensorConfig_t sensor_cfg)
|
|||
period_us = 0UL; // update the period
|
||||
|
||||
if (idx != -1)
|
||||
{
|
||||
ESP_LOGW(TAG, "ERASED: %d", ID);
|
||||
sync_ctx->en_report_ids.erase(sync_ctx->en_report_ids.begin() + idx);
|
||||
|
||||
xEventGroupClearBits(sync_ctx->evt_grp_rpt_en, rpt_bit); // Set the event group bit
|
||||
}
|
||||
unlock_user_data();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptAcceleration::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables acceleration reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptAcceleration::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent acceleration data (including gravity), units are in m/s^2.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,25 +5,6 @@
|
|||
|
||||
#include "BNO08xRptActivityClassifier.hpp"
|
||||
|
||||
/**
|
||||
* @brief Enables activity classifier reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param time_between_reports The period/interval of the report in microseconds.
|
||||
* @param activities_to_enable Which activities to enable.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptActivityClassifier::enable(
|
||||
uint32_t time_between_reports, BNO08xActivityEnable activities_to_enable, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
sensor_cfg.sensorSpecific = static_cast<uint8_t>(activities_to_enable); // this must be set regardless of user cfg
|
||||
// or no reports will be received
|
||||
|
||||
return BNO08xRpt::enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates activity classifier data from decoded sensor event.
|
||||
*
|
||||
|
|
@ -42,6 +23,23 @@ void BNO08xRptActivityClassifier::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables activity classifier reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptActivityClassifier::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
sensor_cfg.sensorSpecific = static_cast<uint8_t>(activities_to_enable); // this must be set regardless of user cfg
|
||||
// or no reports will be received
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent activity classifier data.
|
||||
*
|
||||
|
|
@ -67,3 +65,15 @@ BNO08xActivity BNO08xRptActivityClassifier::get_most_likely_activity()
|
|||
unlock_user_data();
|
||||
return rqdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the activities to be monitored for with ActivityClassifier reports, all enable after setting.
|
||||
*
|
||||
* @param activities_to_enable The activities to be monitored with sent reports.
|
||||
*
|
||||
* @return void, nothing to return
|
||||
*/
|
||||
void BNO08xRptActivityClassifier::set_activities_to_enable(BNO08xActivityEnable activities_to_enable)
|
||||
{
|
||||
this->activities_to_enable = activities_to_enable;
|
||||
}
|
||||
|
|
@ -23,6 +23,21 @@ void BNO08xRptCalGyro::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables calibrated gyro reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptCalGyro::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent gyroscope data (velocity), units are in rad/s.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptCalMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables calibrated magnetometer reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptCalMagnetometer::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent calibrated magnetometer data, units are in uTesla.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* @file BNO08xRptCircleDetector.cpp
|
||||
* @author Myles Parfeniuk
|
||||
*/
|
||||
|
||||
#define SCALE_Q(n) (1.0f / (1 << n))
|
||||
|
||||
#include "BNO08xRptCircleDetector.hpp"
|
||||
#include "esp_log.h"
|
||||
#include "math.h"
|
||||
|
||||
/**
|
||||
* @brief Enables circle detector reports such that the BNO08x begins sending them (only sends reports
|
||||
* when a circle gesture is detected).
|
||||
*
|
||||
* @param time_between_reports The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptCircleDetector::enable(uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
static bool configured = false;
|
||||
|
||||
sensor_cfg.changeSensitivity = 0U;
|
||||
sensor_cfg.changeSensitivityRelative = true;
|
||||
sensor_cfg.changeSensitivityEnabled = true;
|
||||
int op_success = SH2_ERR;
|
||||
|
||||
uint32_t settings[3] = {static_cast<uint32_t>(4.0f / SCALE_Q(24)), static_cast<uint32_t>(0.1f / SCALE_Q(30)),
|
||||
static_cast<uint32_t>((3.0f * M_PI) / SCALE_Q(25))};
|
||||
|
||||
if (!configured)
|
||||
{
|
||||
lock_sh2_HAL();
|
||||
op_success = sh2_setFrs(CIRCLE_DETECTOR_CONFIG, settings, 0U);
|
||||
unlock_sh2_HAL();
|
||||
|
||||
if (op_success != SH2_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "%d", op_success);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGE(TAG, "erased");
|
||||
}
|
||||
|
||||
lock_sh2_HAL();
|
||||
op_success = sh2_setFrs(CIRCLE_DETECTOR_CONFIG, settings, 3U);
|
||||
unlock_sh2_HAL();
|
||||
|
||||
if (op_success != SH2_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "%d", op_success);
|
||||
return false;
|
||||
}
|
||||
|
||||
configured = true;
|
||||
}
|
||||
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates circle detector data from decoded sensor event.
|
||||
*
|
||||
* @param sensor_val The sh2_SensorValue_t struct used in sh2_decodeSensorEvent() call.
|
||||
*
|
||||
* @return void, nothing to return
|
||||
*/
|
||||
void BNO08xRptCircleDetector::update_data(sh2_SensorValue_t* sensor_val)
|
||||
{
|
||||
lock_user_data();
|
||||
data += sensor_val->un.circleDetector.circle;
|
||||
unlock_user_data();
|
||||
|
||||
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))
|
||||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent circle detector detector data.
|
||||
*
|
||||
* @return Struct containing requested data;
|
||||
*/
|
||||
uint16_t BNO08xRptCircleDetector::get()
|
||||
{
|
||||
lock_user_data();
|
||||
uint16_t rqdata = data;
|
||||
unlock_user_data();
|
||||
return rqdata;
|
||||
}
|
||||
|
|
@ -23,6 +23,21 @@ void BNO08xRptGravity::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables gravity reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptGravity::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent gravity data, units are in m/s^2.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptLinearAcceleration::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables linear acceleration reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptLinearAcceleration::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent acceleration data (including gravity), units are in m/s^2.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,6 +5,21 @@
|
|||
|
||||
#include "BNO08xRptRVGeneric.hpp"
|
||||
|
||||
/**
|
||||
* @brief Enables a rotation vector report such that the BNO08x begins it.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptRVGeneric::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent rotation vector data in form of unit quaternion, rad accuracy units in
|
||||
* radians (if available, else constant 0.0f).
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptRawMEMSAccelerometer::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables raw accelerometer reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptRawMEMSAccelerometer::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent raw accelerometer data, units are ADC counts, time_stamp in
|
||||
* microseconds.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptRawMEMSGyro::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables raw gyro reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptRawMEMSGyro::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent raw mems gyro report (units in ADC counts, time_stamp in microseconds)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptRawMEMSMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables raw magnetometer such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptRawMEMSMagnetometer::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent raw magnetometer data, units are ADC counts, time_stamp in microseconds.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptShakeDetector::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables shake detector reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptShakeDetector::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent shake detector detector data.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -23,6 +23,21 @@ void BNO08xRptStabilityClassifier::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables stability classifier reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptStabilityClassifier::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent stability classifier data.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -35,16 +35,18 @@ void BNO08xRptStepCounter::update_data(sh2_SensorValue_t* sensor_val)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs the total step count since boot, accounts for rollover in report data.
|
||||
* @brief Enables step counter reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @return Total steps since boot.
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
uint32_t BNO08xRptStepCounter::get_total_steps()
|
||||
bool BNO08xRptStepCounter::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
lock_user_data();
|
||||
uint32_t total_steps = step_accumulator + data.steps;
|
||||
unlock_user_data();
|
||||
return total_steps;
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,3 +62,16 @@ bno08x_step_counter_t BNO08xRptStepCounter::get()
|
|||
unlock_user_data();
|
||||
return rqdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs the total step count since boot, accounts for rollover in report data.
|
||||
*
|
||||
* @return Total steps since boot.
|
||||
*/
|
||||
uint32_t BNO08xRptStepCounter::get_total_steps()
|
||||
{
|
||||
lock_user_data();
|
||||
uint32_t total_steps = step_accumulator + data.steps;
|
||||
unlock_user_data();
|
||||
return total_steps;
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ bool BNO08xRptTapDetector::enable(uint32_t time_between_reports, sh2_SensorConfi
|
|||
sensor_cfg.changeSensitivityEnabled = true; // this must be set regardless of user cfg or no reports will be received
|
||||
sensor_cfg.changeSensitivity = 0U; // this must be set regardless of user cfg or no reports will be received
|
||||
|
||||
return BNO08xRpt::enable(time_between_reports, sensor_cfg);
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,6 +24,21 @@ void BNO08xRptUncalGyro::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables uncalibrated gyro reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptUncalGyro::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent uncalibrated gyroscope data, units are in rad/s.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,6 +24,21 @@ void BNO08xRptUncalMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
|
|||
signal_data_available();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables uncalibrated magnetometer reports such that the BNO08x begins sending them.
|
||||
*
|
||||
* @param report_period_us The period/interval of the report in microseconds.
|
||||
* @param sensor_cfg Sensor special configuration (optional, see
|
||||
* BNO08xPrivateTypes::default_sensor_cfg for defaults).
|
||||
*
|
||||
* @return True if report was successfully enabled.
|
||||
*/
|
||||
bool BNO08xRptUncalMagnetometer::enable(
|
||||
uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg)
|
||||
{
|
||||
return BNO08xRpt::rpt_enable(time_between_reports, sensor_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Grabs most recent uncalibrated magnetometer data, units are in uTesla.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -153,14 +153,7 @@ TEST_CASE("Void Input Param Flavor Cb", "[CallbackAllReportVoidInputParam]")
|
|||
}
|
||||
else if (test_running)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.linear_accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.gravity.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_gyro.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_magnetometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_game.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_geomagnetic.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
test_running = false;
|
||||
}
|
||||
});
|
||||
|
|
@ -352,14 +345,7 @@ TEST_CASE("Report ID Input Param Flavor Cb", "[CallbackAllReportIDInputParam]")
|
|||
}
|
||||
else if (test_running)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.linear_accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.gravity.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_gyro.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_magnetometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_game.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_geomagnetic.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
test_running = false;
|
||||
}
|
||||
});
|
||||
|
|
@ -453,7 +439,7 @@ TEST_CASE("Single Report Void Input Param Flavor Cb", "[CallbackSingleReportVoid
|
|||
}
|
||||
else if (test_running)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
test_running = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ TEST_CASE("Hard Reset", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ TEST_CASE("Soft Reset", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ TEST_CASE("Sleep", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ TEST_CASE("Get Metadata", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
|
@ -269,7 +269,7 @@ TEST_CASE("Get Sample Counts", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
|
@ -421,7 +421,7 @@ TEST_CASE("Clear Dynamic Calibration", "[FeatureTests]")
|
|||
BNO08xTestHelper::print_test_msg(TEST_TAG, msg_buff);
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
}
|
||||
|
||||
TEST_CASE("BNO08x Driver Cleanup for [FeatureTests] Tests", "[FeatureTests]")
|
||||
|
|
|
|||
|
|
@ -77,8 +77,7 @@ TEST_CASE("Enable/Disable Dual Report", "[MultiReportEnableDisable]")
|
|||
}
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.linear_accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
TEST_ASSERT_EQUAL(true, data_available_accel);
|
||||
TEST_ASSERT_EQUAL(true, data_available_lin_accel);
|
||||
|
|
@ -163,10 +162,7 @@ TEST_CASE("Enable/Disable Quad Report", "[MultiReportEnableDisable]")
|
|||
}
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.linear_accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.gravity.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_gyro.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
TEST_ASSERT_EQUAL(true, data_available_accel);
|
||||
TEST_ASSERT_EQUAL(true, data_available_lin_accel);
|
||||
|
|
@ -307,14 +303,7 @@ TEST_CASE("Enable/Disable Octo Report", "[MultiReportEnableDisable]")
|
|||
}
|
||||
}
|
||||
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.linear_accelerometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.gravity.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_gyro.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.cal_magnetometer.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_game.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->rpt.rv_geomagnetic.disable());
|
||||
TEST_ASSERT_EQUAL(true, imu->disable_all_reports());
|
||||
|
||||
TEST_ASSERT_EQUAL(true, data_available_accel);
|
||||
TEST_ASSERT_EQUAL(true, data_available_lin_accel);
|
||||
|
|
|
|||
Loading…
Reference in New Issue