Set S8 Automatic Baseline Period

This commit is contained in:
Phat Nguyen
2024-02-06 10:41:10 +07:00
parent 4c180fedbd
commit 4df0fc5d5c
7 changed files with 145 additions and 43 deletions

View File

@ -1,6 +1,6 @@
#include "AirGradient.h"
#define AG_LIB_VER "2.5.0"
#define AG_LIB_VER "3.0.0"
AirGradient::AirGradient(BoardType type)
: pms5003(type), pms5003t_1(type), pms5003t_2(type), s8(type), sht4x(type),

View File

@ -793,3 +793,23 @@ void S8::sendCommand(uint8_t func, uint16_t reg, uint16_t value) {
uartWriteBytes(8);
}
}
/**
* @brief Set Auto calib baseline period
*
* @param hours Number of hour will trigger auto calib: [0, 4800], 0: disable
* @return true Success
* @return false Failure
*/
bool S8::setAutoCalib(int hours) {
if (isBegin() == false) {
return false;
}
int curCalib = getCalibPeriodABC();
if (curCalib == hours) {
return true;
}
return setCalibPeriodABC(hours);
}

View File

@ -78,6 +78,7 @@ public:
int16_t getCo2(void);
bool setBaselineCalibration(void);
bool isBaseLineCalibrationDone(void);
bool setAutoCalib(int hours);
private:
/** Variables */