Fix: missing handle serverConfig ledBarTestRequested test

This commit is contained in:
Phat Nguyen
2024-02-06 10:52:01 +07:00
parent 4df0fc5d5c
commit ac9efccd94

View File

@ -215,6 +215,8 @@ public:
/** Get "co2CalibrationRequested" */ /** Get "co2CalibrationRequested" */
if (JSON.typeof_(root["co2CalibrationRequested"]) == "boolean") { if (JSON.typeof_(root["co2CalibrationRequested"]) == "boolean") {
co2Calib = root["co2CalibrationRequested"]; co2Calib = root["co2CalibrationRequested"];
} else {
co2Calib = false;
} }
/** Get "ledBarMode" */ /** Get "ledBarMode" */
@ -260,6 +262,13 @@ public:
co2AbcCalib = -1; co2AbcCalib = -1;
} }
/** Get "ledBarTestRequested" */
if (JSON.typeof_(root["ledBarTestRequested"]) == "boolean") {
ledBarTestRequested = root["ledBarTestRequested"];
} else {
ledBarTestRequested = false;
}
/** Show configuration */ /** Show configuration */
showServerConfig(); showServerConfig();
@ -342,6 +351,20 @@ public:
return ret; return ret;
} }
/**
* @brief Get request LedBar test
*
* @return true Requested. If result = true, it's clear after function call
* @return false Not-requested
*/
bool isLedBarTestRequested(void) {
bool ret = ledBarTestRequested;
if (ret) {
ledBarTestRequested = false;
}
return ret;
}
/** /**
* @brief Get the Co2 auto calib period * @brief Get the Co2 auto calib period
* *
@ -384,12 +407,13 @@ public:
UseLedBar getLedBarMode(void) { return ledBarMode; } UseLedBar getLedBarMode(void) { return ledBarMode; }
private: private:
bool inF; /** Temperature unit, true: F, false: C */ bool inF; /** Temperature unit, true: F, false: C */
bool inUSAQI; /** PMS unit, true: USAQI, false: ugm3 */ bool inUSAQI; /** PMS unit, true: USAQI, false: ugm3 */
bool configFailed; /** Flag indicate get server configuration failed */ bool configFailed; /** Flag indicate get server configuration failed */
bool serverFailed; /** Flag indicate post data to server failed */ bool serverFailed; /** Flag indicate post data to server failed */
bool co2Calib; /** Is co2Ppmcalibration requset */ bool co2Calib; /** Is co2Ppmcalibration requset */
int co2AbcCalib = -1; /** update auto calibration number of day */ bool ledBarTestRequested; /** */
int co2AbcCalib = -1; /** update auto calibration number of day */
UseLedBar ledBarMode = UseLedBarCO2; /** */ UseLedBar ledBarMode = UseLedBarCO2; /** */
char models[20]; /** */ char models[20]; /** */
char mqttBroker[256]; /** */ char mqttBroker[256]; /** */
@ -943,6 +967,9 @@ static void serverConfigPoll(void) {
Serial.println("Set S8 auto calib failed"); Serial.println("Set S8 auto calib failed");
} }
} }
if (agServer.isLedBarTestRequested()) {
ledTest();
}
} }
} }