Disable Autocalibration for MH-Z19C

This commit is contained in:
seiichiro 2021-02-09 18:06:37 +01:00
parent 9ea1abf92f
commit 8007358514
3 changed files with 12 additions and 0 deletions

View file

@ -33,6 +33,14 @@ MHZ19C::MHZ19C(void) {
Serial.setTimeout(MHZ19C_READ_TIMEOUT);
}
void MHZ19C::initialize(void) {
#ifdef MHZ19C_ENABLE_AUTOCAL
setSelfCalibration(1);
#else
setSelfCalibration(0);
#endif
}
void MHZ19C::getSensorData(lora_data &loradata) {
write(MHZ19C_CMD_GET_PPM, 0x00);
delay(50);

View file

@ -51,6 +51,7 @@ class MHZ19C {
public:
MHZ19C(void);
void MHZ19C::initialize(void);
void getSensorData(lora_data &loradata);
void setSelfCalibration(bool state);
};

View file

@ -199,6 +199,9 @@ void setup()
#ifdef HAS_BME280
sensor.getCalData();
#endif
#ifdef HAS_MHZ19C
sensor.initialize();
#endif
// Setup LMIC
DEBUG_PRINT("Initializing LMIC...")