forked from airgradienthq/arduino
Add logging for abcDays
This commit is contained in:
@@ -305,7 +305,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return int days, -1 if invalid.
|
* @return int days, -1 if invalid.
|
||||||
*/
|
*/
|
||||||
int getCo2Abccalib(void) { return co2AbcCalib; }
|
int getCo2AbcDaysConfig(void) { return co2AbcCalib; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get device configuration model name
|
* @brief Get device configuration model name
|
||||||
@@ -562,9 +562,15 @@ static void serverConfigPoll(void) {
|
|||||||
if (agServer.isCo2Calib()) {
|
if (agServer.isCo2Calib()) {
|
||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
if (agServer.getCo2Abccalib() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
if (ag.s8.setAutoCalib(agServer.getCo2Abccalib() * 24) == false) {
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
Serial.println("Set S8 auto calib failed");
|
agServer.getCo2AbcDaysConfig(),
|
||||||
|
agServer.getCo2AbcDaysConfig() * 24);
|
||||||
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
||||||
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
|
} else {
|
||||||
|
Serial.println("Set S8 abcDays period calib success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -372,7 +372,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return int days, -1 if invalid.
|
* @return int days, -1 if invalid.
|
||||||
*/
|
*/
|
||||||
int getCo2Abccalib(void) { return co2AbcCalib; }
|
int getCo2AbcDaysConfig(void) { return co2AbcCalib; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get device configuration model name
|
* @brief Get device configuration model name
|
||||||
@@ -1086,9 +1086,15 @@ static void serverConfigPoll(void) {
|
|||||||
if (agServer.isCo2Calib()) {
|
if (agServer.isCo2Calib()) {
|
||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
if (agServer.getCo2Abccalib() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
if (ag.s8.setAutoCalib(agServer.getCo2Abccalib() * 24) == false) {
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
Serial.println("Set S8 auto calib failed");
|
agServer.getCo2AbcDaysConfig(),
|
||||||
|
agServer.getCo2AbcDaysConfig() * 24);
|
||||||
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
||||||
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
|
} else {
|
||||||
|
Serial.println("Set S8 abcDays period calib success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (agServer.isLedBarTestRequested()) {
|
if (agServer.isLedBarTestRequested()) {
|
||||||
|
@@ -347,7 +347,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return int days, -1 if invalid.
|
* @return int days, -1 if invalid.
|
||||||
*/
|
*/
|
||||||
int getCo2Abccalib(void) { return co2AbcCalib; }
|
int getCo2AbcDaysConfig(void) { return co2AbcCalib; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get device configuration model name
|
* @brief Get device configuration model name
|
||||||
@@ -373,7 +373,7 @@ public:
|
|||||||
Serial.printf(" useRGBLedBar: %d\r\n", (int)ledBarMode);
|
Serial.printf(" useRGBLedBar: %d\r\n", (int)ledBarMode);
|
||||||
Serial.printf(" Model: %s\r\n", models);
|
Serial.printf(" Model: %s\r\n", models);
|
||||||
Serial.printf(" Mqtt Broker: %s\r\n", mqttBroker);
|
Serial.printf(" Mqtt Broker: %s\r\n", mqttBroker);
|
||||||
Serial.printf(" S8 calib period: %d\r\n", co2AbcCalib);
|
Serial.printf(" abcDays period: %d\r\n", co2AbcCalib);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -847,9 +847,15 @@ static void serverConfigPoll(void) {
|
|||||||
if (agServer.isCo2Calib()) {
|
if (agServer.isCo2Calib()) {
|
||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
if (agServer.getCo2Abccalib() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
if (ag.s8.setAutoCalib(agServer.getCo2Abccalib() * 24) == false) {
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
Serial.println("Set S8 auto calib failed");
|
agServer.getCo2AbcDaysConfig(),
|
||||||
|
agServer.getCo2AbcDaysConfig() * 24);
|
||||||
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
||||||
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
|
} else {
|
||||||
|
Serial.println("Set S8 abcDays period calib success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -801,7 +801,7 @@ void S8::sendCommand(uint8_t func, uint16_t reg, uint16_t value) {
|
|||||||
* @return true Success
|
* @return true Success
|
||||||
* @return false Failure
|
* @return false Failure
|
||||||
*/
|
*/
|
||||||
bool S8::setAutoCalib(int hours) {
|
bool S8::setAbcPeriod(int hours) {
|
||||||
if (isBegin() == false) {
|
if (isBegin() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -813,3 +813,10 @@ bool S8::setAutoCalib(int hours) {
|
|||||||
|
|
||||||
return setCalibPeriodABC(hours);
|
return setCalibPeriodABC(hours);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get current 'ABC' calib period
|
||||||
|
*
|
||||||
|
* @return int Hour
|
||||||
|
*/
|
||||||
|
int S8::getAbcPeriod(void) { return getCalibPeriodABC(); }
|
||||||
|
@@ -78,7 +78,8 @@ public:
|
|||||||
int16_t getCo2(void);
|
int16_t getCo2(void);
|
||||||
bool setBaselineCalibration(void);
|
bool setBaselineCalibration(void);
|
||||||
bool isBaseLineCalibrationDone(void);
|
bool isBaseLineCalibrationDone(void);
|
||||||
bool setAutoCalib(int hours);
|
bool setAbcPeriod(int hours);
|
||||||
|
int getAbcPeriod(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Variables */
|
/** Variables */
|
||||||
|
Reference in New Issue
Block a user