Skip to content

Measurement rate instead of oversampling rate used for generation of scaling factor #2

Open
@jadeaffenjaeger

Description

@jadeaffenjaeger

Hi, thank you for your work with this library!
I'm currently building a project based on the DPS310 and am using parts of your code to interface with the sensor.

While connecting my sensor, I noticed that the measurement rate (i.e. the burst length when using the sensor in Background mode) is stored in the variables g_pressure_rate and g_temperature_rate and subsequently used to derive the scale factor.

sensor-dps310/dps310.c

Lines 271 to 298 in e2ee938

switch (rate) {
case DPS310_CFG_RATE_1_MEAS:
*p_factor = 524288;
break;
case DPS310_CFG_RATE_2_MEAS:
*p_factor = 1572864;
break;
case DPS310_CFG_RATE_4_MEAS:
*p_factor = 3670016;
break;
case DPS310_CFG_RATE_8_MEAS:
*p_factor = 7864320;
break;
case DPS310_CFG_RATE_16_MEAS:
*p_factor = 253952;
break;
case DPS310_CFG_RATE_32_MEAS:
*p_factor = 516096;
break;
case DPS310_CFG_RATE_64_MEAS:
*p_factor = 1040384;
break;
case DPS310_CFG_RATE_128_MEAS:
*p_factor = 2088960;
break;
default:
ret = DPS310_UNKNOWN_RATE_ERROR;
}

This leads to wrong results since the relevant parameter for deriving the scale factor is actually the oversampling rate (see Table 9 in the datasheet).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions