nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Public Member Functions | Data Fields
nrfcxx::sensor::ccs811::threshold_s Struct Reference

Thresholds for detecting significant changes in readings. More...

#include <nrfcxx/sensor/ccs811.hpp>

Public Member Functions

int env_data_changed (uint32_t ed1, uint32_t ed2) const
 Compare two encoded environmental values for closeness. More...
 
int observation_beacon_changed (const observation_beacon_type &ob1, const observation_beacon_type &ob2) const
 Assess whether two observations differ significantly. More...
 

Data Fields

uint16_t eCO2_ppm = 20
 Threshold for changes in observations_type::eCO2.
 
uint16_t eTVOC_ppb = 5
 Threshold for changes in observations_type::eTVOC.
 
uint8_t temperature_Cel = 1
 Threshold for changes to the temperature value in env_data().
 
uint8_t humidity_pph = 2
 Threshold for changes to the relative humidity value in env_data().
 

Detailed Description

Thresholds for detecting significant changes in readings.

Note
Thresholds are inclusive of the alerting value. In other words, if a field is zero then readings with the same value are considered to have met the threshold for change. This allows trivial configuration to disable transmission limits for mains-powered devices in sparse environments.

Member Function Documentation

◆ env_data_changed()

int nrfcxx::sensor::ccs811::threshold_s::env_data_changed ( uint32_t  ed1,
uint32_t  ed2 
) const

Compare two encoded environmental values for closeness.

The HTS221 sensor on the Thingy:52 has abysmal repeatability and frequently bounces back and forth across half-unit boundaries, resulting in unnecessary updates to the environment setting and possibly contributing to variation in eCO2 estimates.

Determine whether the difference between two values is large enough to warrant doing an update, using the threshold limits specified in temperature_Cel and humidity_pph.

Returns
nonzero if the two encoded environment values differ in at least the threshold value for at least one encoded measurement.

◆ observation_beacon_changed()

int nrfcxx::sensor::ccs811::threshold_s::observation_beacon_changed ( const observation_beacon_type ob1,
const observation_beacon_type ob2 
) const

Assess whether two observations differ significantly.

A change is diagnosed if:

Parameters
froma previous instance against which differences are calculated.
thrthe thresholds for detecting differences.
Returns
zero` iff all measurements are equally present/valid in each instance and the differences are less than the measurement threshold. If a significant change is detected it is indicated by non-zero return value.

The documentation for this struct was generated from the following file: