Add Read Cache and Stats
- baro.cache_ttl_ms avoids multiple reads - by default, cache is off (cache_ttl_ms=0) - stats are updated (similar to how prometheus-sensors does this)
This commit is contained in:
@ -217,6 +217,8 @@ int main() {
|
||||
*/
|
||||
if (!(baro=mgos_barometer_create_i2c(i2c, 0x60, BARO_MPL115))) {
|
||||
LOG(LL_ERROR, ("Cannot create MPL115 barometer"));
|
||||
} else {
|
||||
mgos_barometer_set_cache_ttl(baro, 5000);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
Reference in New Issue
Block a user