Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Baro: Fix GCS DPS310 HWID issue #25087

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions libraries/AP_Baro/AP_Baro_DPS280.cpp
Expand Up @@ -60,7 +60,7 @@ AP_Baro_Backend *AP_Baro_DPS280::probe(AP_Baro &baro,
if (sensor) {
sensor->is_dps310 = _is_dps310;
}
if (!sensor || !sensor->init()) {
if (!sensor || !sensor->init(_is_dps310)) {
delete sensor;
return nullptr;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ void AP_Baro_DPS280::set_config_registers(void)
}
}

bool AP_Baro_DPS280::init()
bool AP_Baro_DPS280::init(bool _is_dps310)
{
if (!dev) {
return false;
Expand Down Expand Up @@ -190,8 +190,11 @@ bool AP_Baro_DPS280::init()
set_config_registers();

instance = _frontend.register_sensor();

dev->set_device_type(DEVTYPE_BARO_DPS280);
if(_is_dps310) {
dev->set_device_type(DEVTYPE_BARO_DPS310);
} else {
dev->set_device_type(DEVTYPE_BARO_DPS280);
}
set_bus_id(instance, dev->get_bus_id());

dev->get_semaphore()->give();
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_Baro/AP_Baro_DPS280.h
Expand Up @@ -29,7 +29,7 @@ class AP_Baro_DPS280 : public AP_Baro_Backend {
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev, bool _is_dps310=false);

protected:
bool init(void);
bool init(bool _is_dps310);
bool read_calibration(void);
void timer(void);
void calculate_PT(int32_t UT, int32_t UP, float &pressure, float &temperature);
Expand Down