Revert "timestamp feature"

This reverts commit 3422227f32.
This commit is contained in:
myles 2025-04-06 13:22:19 -07:00
parent 3422227f32
commit 72042763bf
25 changed files with 38 additions and 86 deletions

View File

@ -27,6 +27,9 @@ SpaceAfterCStyleCast: true
CommentPragmas: '^[/!]<'
ColumnLimit: 130
WrapComments: true
AllowShortCommentsOnASingleLine: true
AlignConsecutiveComments: true
BreakBeforeBraces: Allman
IndentAccessModifiers: true

View File

@ -197,11 +197,11 @@ extern "C" void app_main(void)
imu.rpt.rv_game.enable(100000UL); // 100,000us == 100ms report interval
imu.rpt.cal_gyro.enable(100000UL); // 100,000us == 100ms report interval
// There are 3 different flavors of callbacks available:
// 1) register a callback to execute when new data is received for any report
imu.register_cb(
[]()
imu.register_cb([&imu]()
{
// check for game rotation vector report
if (imu.rpt.rv_game.has_new_data())
@ -214,8 +214,7 @@ extern "C" void app_main(void)
});
// 2) register a callback that is only executed for a specific report
imu.rpt.cal_gyro.register_cb(
[]()
imu.rpt.cal_gyro.register_cb([&imu]()
{
// get angular velocity in rad/s
bno08x_gyro_t velocity = imu.rpt.cal_gyro.get();
@ -223,9 +222,8 @@ extern "C" void app_main(void)
ESP_LOGI(TAG, "Velocity: x: %.2f y: %.2f z: %.2f", velocity.x, velocity.y, velocity.z);
});
// 3) register a callback that is passed report ID of report that asserted callback
imu.register_cb(
[](uint8_t rpt_ID)
// 3) register a callback this passed report ID of report that asserted callback
imu.register_cb([](uint8_t rpt_ID)
{
switch (rpt_ID)
{

View File

@ -29,7 +29,6 @@ class BNO08xRpt
bool register_cb(std::function<void(void)> cb_fxn);
bool has_new_data();
bool flush();
uint64_t get_timestamp_us();
bool get_sample_counts(bno08x_sample_counts_t& sample_counts);
bool clear_sample_counts();
bool get_meta_data(bno08x_meta_data_t& meta_data);
@ -40,12 +39,10 @@ class BNO08xRpt
uint8_t ID; ///< Report ID, ex. SH2_ACCELERATION.
EventBits_t rpt_bit; ///< Respective enable and data bit for report in evt_grp_rpt_en and evt_grp_rpt_data
uint32_t period_us; ///< The period/interval of the report in microseconds.
uint64_t time_stamp_us; ///< Timestamp sent in SHTP header, updated with each respective resport rx'd.
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;
void update_timestamp(sh2_SensorValue_t* sensor_val);
/**
* @brief BNO08xRpt report constructor.
@ -63,7 +60,6 @@ class BNO08xRpt
: ID(ID)
, rpt_bit(rpt_bit)
, period_us(0UL)
, time_stamp_us(0ULL)
, sync_ctx(sync_ctx)
{

View File

@ -125,20 +125,6 @@ bool BNO08xRpt::register_cb(std::function<void(void)> cb_fxn)
return false;
}
/**
* @brief Updates timestamp of data of respective report.
*
* @note User data should be locked when this fxn is called.
*
* @param sensor_val The sh2_SensorValue_t struct used in sh2_decodeSensorEvent() call.
*
* @return void, nothing to return
*/
void BNO08xRpt::update_timestamp(sh2_SensorValue_t* sensor_val)
{
time_stamp_us = sensor_val->timestamp;
}
/**
* @brief Checks if a new report has been received since the last time this function was called.
*
@ -174,16 +160,6 @@ bool BNO08xRpt::flush()
return (success != SH2_OK) ? false : true;
}
/**
* @brief Returns timestamp of most recently received report for this type.
*
* @return Timestamp of most recently received report.
*/
uint64_t BNO08xRpt::get_timestamp_us()
{
return time_stamp_us;
}
/**
* @brief Gets sample counts for this sensor (see SH-2 ref manual 6.4.3.1)
*

View File

@ -17,7 +17,6 @@ void BNO08xRptARVRStabilizedGameRV::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.arvrStabilizedGRV;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptARVRStabilizedRV::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.arvrStabilizedRV;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptAcceleration::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.accelerometer;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptActivityClassifier::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.personalActivityClassifier;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptCalGyro::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.gyroscope;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptCalMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.magneticField;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptGameRV::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.gameRotationVector;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptGravity::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.gravity;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -18,7 +18,6 @@ void BNO08xRptIGyroRV::update_data(sh2_SensorValue_t* sensor_val)
data = sensor_val->un.gyroIntegratedRV;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
data_vel = sensor_val->un.gyroIntegratedRV;
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptLinearAcceleration::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.linearAcceleration;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptRV::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.rotationVector;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptRVGeomag::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.geoMagRotationVector;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptRawMEMSAccelerometer::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.rawAccelerometer;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptRawMEMSGyro::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.rawGyroscope;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptRawMEMSMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.rawMagnetometer;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptShakeDetector::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.shakeDetector;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -17,7 +17,6 @@ void BNO08xRptStabilityClassifier::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.stabilityClassifier;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -28,7 +28,6 @@ void BNO08xRptStepCounter::update_data(sh2_SensorValue_t* sensor_val)
prev_steps = data.steps;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -35,7 +35,6 @@ void BNO08xRptTapDetector::update_data(sh2_SensorValue_t* sensor_val)
lock_user_data();
data = sensor_val->un.tapDetector;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -18,7 +18,6 @@ void BNO08xRptUncalGyro::update_data(sh2_SensorValue_t* sensor_val)
data = sensor_val->un.gyroscopeUncal;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
bias_data = sensor_val->un.gyroscopeUncal;
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))

View File

@ -18,7 +18,6 @@ void BNO08xRptUncalMagnetometer::update_data(sh2_SensorValue_t* sensor_val)
data = sensor_val->un.magneticFieldUncal;
data.accuracy = static_cast<BNO08xAccuracy>(sensor_val->status);
bias_data = sensor_val->un.magneticFieldUncal;
update_timestamp(sensor_val);
unlock_user_data();
if (rpt_bit & xEventGroupGetBits(sync_ctx->evt_grp_rpt_en))