mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-06 04:36:31 +02:00
Better server configure for abcDays
debug message
This commit is contained in:
@ -569,14 +569,19 @@ static void serverConfigPoll(void) {
|
|||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
if (agServer.getCo2AbcDaysConfig() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
|
int newHour = agServer.getCo2AbcDaysConfig() * 24;
|
||||||
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
agServer.getCo2AbcDaysConfig(),
|
agServer.getCo2AbcDaysConfig(), newHour);
|
||||||
agServer.getCo2AbcDaysConfig() * 24);
|
int curHour = ag.s8.getAbcPeriod();
|
||||||
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
if (curHour == newHour) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("set 'abcDays' ignored");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Set S8 abcDays period calib success");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -774,7 +774,7 @@ void webServerMeasureCurrentGet(void) {
|
|||||||
webServer.send(200, "application/json", getServerSyncData());
|
webServer.send(200, "application/json", getServerSyncData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void webServerHandler(void* param) {
|
void webServerHandler(void *param) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
webServer.handleClient();
|
webServer.handleClient();
|
||||||
}
|
}
|
||||||
@ -1269,17 +1269,24 @@ static void serverConfigPoll(void) {
|
|||||||
if (agServer.isCo2Calib()) {
|
if (agServer.isCo2Calib()) {
|
||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (agServer.getCo2AbcDaysConfig() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
|
int newHour = agServer.getCo2AbcDaysConfig() * 24;
|
||||||
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
agServer.getCo2AbcDaysConfig(),
|
agServer.getCo2AbcDaysConfig(), newHour);
|
||||||
agServer.getCo2AbcDaysConfig() * 24);
|
int curHour = ag.s8.getAbcPeriod();
|
||||||
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
if (curHour == newHour) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("set 'abcDays' ignored");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Set S8 abcDays period calib success");
|
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()) {
|
||||||
if (agServer.getCountry() == "TH") {
|
if (agServer.getCountry() == "TH") {
|
||||||
ledTest2Min();
|
ledTest2Min();
|
||||||
|
@ -444,10 +444,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Register event */
|
/** Register event */
|
||||||
if (esp_mqtt_client_register_event(
|
if (esp_mqtt_client_register_event(client, MQTT_EVENT_ANY,
|
||||||
client, MQTT_EVENT_ANY,
|
mqtt_event_handler, NULL) != ESP_OK) {
|
||||||
mqtt_event_handler,
|
|
||||||
NULL) != ESP_OK) {
|
|
||||||
Serial.println("mqtt client register event failed");
|
Serial.println("mqtt client register event failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -980,15 +978,22 @@ static void serverConfigPoll(void) {
|
|||||||
if (agServer.isCo2Calib()) {
|
if (agServer.isCo2Calib()) {
|
||||||
co2Calibration();
|
co2Calibration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (agServer.getCo2AbcDaysConfig() > 0) {
|
if (agServer.getCo2AbcDaysConfig() > 0) {
|
||||||
|
int newHour = agServer.getCo2AbcDaysConfig() * 24;
|
||||||
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
Serial.printf("abcDays config: %d days(%d hours)\r\n",
|
||||||
agServer.getCo2AbcDaysConfig(),
|
agServer.getCo2AbcDaysConfig(), newHour);
|
||||||
agServer.getCo2AbcDaysConfig() * 24);
|
int curHour = ag.s8.getAbcPeriod();
|
||||||
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
Serial.printf("Current config: %d (hours)\r\n", ag.s8.getAbcPeriod());
|
||||||
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
if (curHour == newHour) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("set 'abcDays' ignored");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Set S8 abcDays period calib success");
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user