API Reference
gas_index_algorithm
Pure-Python port of Sensirion’s Gas Index Algorithm (fixpoint reference) used by the SGP41 to convert raw VOC and NOx tick values into the 0..500 gas index signals described in the SGP41 datasheet.
Ported from: https://github.com/Sensirion/gas-index-algorithm (v3.2.0, BSD-3-Clause).
Author(s): Sensirion AG (original C), Adafruit Industries (Python port)
- class adafruit_sgp41.gas_index_algorithm.GasIndexAlgorithm(algorithm_type: int = ALGORITHM_TYPE_VOC)
Gas Index Algorithm for Sensirion SGP4x sensors.
- Parameters:
algorithm_type (int) –
ALGORITHM_TYPE_VOC(0, default) for the VOC index orALGORITHM_TYPE_NOX(1) for the NOx index.
Call
process()exactly once per second with the raw tick value from the sensor. During the first 45 seconds the algorithm returns0while it warms up; after that it returns the gas index in the range1..500.- process(sraw: int) int
Compute the gas index for a raw sensor tick value.
- Parameters:
sraw (int) – Raw VOC or NOx tick from the SGP41.
- Returns:
0 during the initial 45 s blackout, otherwise 1..500.
- set_states(state0: int, state1: int) None
Restore internal states from a prior
get_states()call. VOC only.