Skip to content

Comments

fix bmi08a_set_meas_conf to also set acceleration range#23

Open
Scoeerg wants to merge 1 commit intoboschsensortec:masterfrom
Scoeerg:fix_bmi08a_set_meas_conf
Open

fix bmi08a_set_meas_conf to also set acceleration range#23
Scoeerg wants to merge 1 commit intoboschsensortec:masterfrom
Scoeerg:fix_bmi08a_set_meas_conf

Conversation

@Scoeerg
Copy link

@Scoeerg Scoeerg commented Oct 27, 2025

Function bmi08a_get_meas_conf() reads

/*!

  • @brief This API reads the accel config value i.e. odr, band width and range from the sensor,
  • store it in the bmi08_dev structure instance passed by the user.

*/
int8_t bmi08a_get_meas_conf(struct bmi08_dev *dev)

while bmi08a_set_meas_conf() only does ODR and bandwidth.

/*!

  • @brief This API sets the output data rate and bandwidth
  • of accel sensor.
    */
    int8_t bmi08a_set_meas_conf(struct bmi08_dev *dev)

To fix this, I added acceleration range setting to bmi08a_set_meas_conf(). To not break other code, one might alternatively consider a new function

/*!
 * @brief This API sets the acceleration range
 * of accel sensor.
 */
int8_t bmi08a_set_range_conf(struct bmi08_dev *dev){

int8_t rslt;
uint8_t range;
is_range_invalid = FALSE;
rslt = dev_null_ptr_check(dev);
/* Proceed if null check is fine */
    if (rslt == BMI08_OK)
    {
       range = dev->accel_cfg.range;
       if(range > BMI088_ACCEL_RANGE_24G)
       {
            /* Updating the status */
            is_range_invalid = TRUE;
        }
       if (!is_range_invalid)
       {
          rslt = bmi08a_get_set_regs(BMI08_REG_ACCEL_RANGE, &range, BMI08_REG_ACCEL_RANGE_LENGTH, dev, SET_FUNC);
          if (rslt == BMI08_OK)
          {
             /* Delay required to set accel configurations */
             dev->delay_us(BMI08_SET_ACCEL_CONF_DELAY * 1000, dev->intf_ptr_accel);
          }
       }
       else
       {
           /* Invalid configuration present in RANGE */
           rslt = BMI08_E_INVALID_CONFIG;
       }
   }
return rslt;
}

@Scoeerg
Copy link
Author

Scoeerg commented Nov 6, 2025

https://community.bosch-sensortec.com/mems-sensors-forum-jrmujtaw/post/pull-request-to-fix-asymmetric-bmi08a-get-meas-conf-and-bmi08a-set-meas-YeDesIrYKsA8OHg

tl;dr

Hi EricSchoeneberg,

I think your idea is great, but BST github isn't open source. Therefore, unfortunately, we don't allow users to do pull request. Maybe next release will fix the issue.

Thanks

I will leave the merge-request open for others to find the fix who might encounter similar issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant