|
85 | 85 | OVERSCAN_X8 = const(0x04)
|
86 | 86 | OVERSCAN_X16 = const(0x05)
|
87 | 87 |
|
88 |
| -_BME280_OVERSCANS = frozenset((OVERSCAN_DISABLE, OVERSCAN_X1, OVERSCAN_X2, |
89 |
| - OVERSCAN_X4, OVERSCAN_X8, OVERSCAN_X16)) |
| 88 | +_BME280_OVERSCANS = {OVERSCAN_DISABLE:0, OVERSCAN_X1:1, OVERSCAN_X2:2, |
| 89 | + OVERSCAN_X4:4, OVERSCAN_X8:8, OVERSCAN_X16:16} |
90 | 90 |
|
91 | 91 | """mode values"""
|
92 | 92 | MODE_SLEEP = const(0x00)
|
@@ -300,6 +300,30 @@ def _ctrl_meas(self):
|
300 | 300 | ctrl_meas += self.mode
|
301 | 301 | return ctrl_meas
|
302 | 302 |
|
| 303 | + @property |
| 304 | + def measurement_time_typical(self): |
| 305 | + """Typical time in milliseconds required to complete a measurement in normal mode""" |
| 306 | + meas_time_ms = 1.0 |
| 307 | + if self.overscan_temperature != OVERSCAN_DISABLE: |
| 308 | + meas_time_ms += (2 * _BME280_OVERSCANS.get(self.overscan_temperature)) |
| 309 | + if self.overscan_pressure != OVERSCAN_DISABLE: |
| 310 | + meas_time_ms += (2 * _BME280_OVERSCANS.get(self.overscan_pressure) + 0.5) |
| 311 | + if self.overscan_humidity != OVERSCAN_DISABLE: |
| 312 | + meas_time_ms += (2 * _BME280_OVERSCANS.get(self.overscan_humidity) + 0.5) |
| 313 | + return meas_time_ms |
| 314 | + |
| 315 | + @property |
| 316 | + def measurement_time_max(self): |
| 317 | + """Maximum time in milliseconds required to complete a measurement in normal mode""" |
| 318 | + meas_time_ms = 1.25 |
| 319 | + if self.overscan_temperature != OVERSCAN_DISABLE: |
| 320 | + meas_time_ms += (2.3 * _BME280_OVERSCANS.get(self.overscan_temperature)) |
| 321 | + if self.overscan_pressure != OVERSCAN_DISABLE: |
| 322 | + meas_time_ms += (2.3 * _BME280_OVERSCANS.get(self.overscan_pressure) + 0.575) |
| 323 | + if self.overscan_humidity != OVERSCAN_DISABLE: |
| 324 | + meas_time_ms += (2.3 * _BME280_OVERSCANS.get(self.overscan_humidity) + 0.575) |
| 325 | + return meas_time_ms |
| 326 | + |
303 | 327 | @property
|
304 | 328 | def temperature(self):
|
305 | 329 | """The compensated temperature in degrees celsius."""
|
|
0 commit comments