Refurbish ReClockI2C API

* Make ReClockI2C API class
* Use new API in AirQualityTelemetry module
* Minor changes on some logs
This commit is contained in:
oscgonfer
2026-06-14 14:48:40 +02:00
parent 0200d45241
commit b7ec5cd35a
15 changed files with 338 additions and 320 deletions
+5 -1
View File
@@ -2,13 +2,14 @@
#if !MESHTASTIC_EXCLUDE_AIR_QUALITY_SENSOR && __has_include(<SensirionI2cScd4x.h>)
#include "../detect/ReClockI2C.h"
#include "../mesh/generated/meshtastic/telemetry.pb.h"
#include "RTC.h"
#include "TelemetrySensor.h"
#include <SensirionI2cScd4x.h>
// Max speed 400kHz
#define SCD4X_I2C_CLOCK_SPEED 100000
#define SCD4X_I2C_CLOCK_SPEED 400000
#define SCD4X_WARMUP_MS 5000
class SCD4XSensor : public TelemetrySensor
@@ -17,7 +18,10 @@ class SCD4XSensor : public TelemetrySensor
SensirionI2cScd4x scd4x;
TwoWire *_bus{};
uint8_t _address{};
#ifdef SCD4X_I2C_CLOCK_SPEED
ScanI2C::I2CPort _port = ScanI2C::I2CPort::NO_I2C;
ReClockI2C reClockI2C;
#endif
bool performFRC(uint32_t targetCO2);
bool setASCBaseline(uint32_t targetCO2);