Skip to content

Commit ae1a338

Browse files
authored
Use correct value to compute gas resistance
This code is supposed to be a 1:1 translation from Bosch C library https://github.com/boschsensortec/BME68x-Sensor-API/blob/6dab330cb5727006d5046f9eebf357f8909c0ef6/bme68x.c#L971. There they do: ```C /* multiplying 10000 then dividing then multiplying by 100 instead of multiplying by 1000000 to prevent overflow */ calc_gas_res = (UINT32_C(10000) * var1) / (uint32_t)var2; calc_gas_res = calc_gas_res * 100; ``` With the current code resistance is off by a factor of 10
1 parent 84f9166 commit ae1a338

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_bme680.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def gas(self) -> int:
312312
var2 = self._adc_gas - 512
313313
var2 *= 3
314314
var2 = 4096 + var2
315-
calc_gas_res = (1000 * var1) / var2
315+
calc_gas_res = (10000 * var1) / var2
316316
calc_gas_res = calc_gas_res * 100
317317
else:
318318
var1 = (

0 commit comments

Comments
 (0)