Skip to content

Commit

Permalink
AP_Baro: add soft reset and wait before reading calibration data
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Aug 1, 2024
1 parent e929cc2 commit d3674f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/AP_Baro/AP_Baro_BMP388.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extern const AP_HAL::HAL &hal;
#define BMP388_REG_CAL_P 0x36
#define BMP388_REG_CAL_T 0x31

#define BMP388_SOFT_RESET 0xB6

AP_Baro_BMP388::AP_Baro_BMP388(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> _dev)
: AP_Baro_Backend(baro)
, dev(std::move(_dev))
Expand Down Expand Up @@ -106,7 +108,8 @@ bool AP_Baro_BMP388::init()
default:
return false;
}

dev->write_register(BMP388_REG_CMD, BMP388_SOFT_RESET, true);
hal.scheduler->delay(2);
// read the calibration data
read_registers(BMP388_REG_CAL_P, (uint8_t *)&calib_p, sizeof(calib_p));
read_registers(BMP388_REG_CAL_T, (uint8_t *)&calib_t, sizeof(calib_t));
Expand Down

0 comments on commit d3674f7

Please sign in to comment.