mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-06 12:46:32 +02:00
Better server configure for abcDays
debug message
This commit is contained in:
@ -569,10 +569,14 @@ 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 (curHour == newHour) {
|
||||||
|
Serial.println("set 'abcDays' ignored");
|
||||||
|
} else {
|
||||||
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
} else {
|
} else {
|
||||||
@ -581,6 +585,7 @@ static void serverConfigPoll(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void co2Poll() {
|
static void co2Poll() {
|
||||||
co2Ppm = ag.s8.getCo2();
|
co2Ppm = ag.s8.getCo2();
|
||||||
|
@ -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 (curHour == newHour) {
|
||||||
|
Serial.println("set 'abcDays' ignored");
|
||||||
|
} else {
|
||||||
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) == false) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Set S8 abcDays period calib success");
|
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,18 +978,25 @@ 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 'abcDays' ignored");
|
||||||
|
} else {
|
||||||
|
if (ag.s8.setAbcPeriod(agServer.getCo2AbcDaysConfig() * 24) ==
|
||||||
|
false) {
|
||||||
Serial.println("Set S8 abcDays period calib failed");
|
Serial.println("Set S8 abcDays period calib failed");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Set S8 abcDays period calib success");
|
Serial.println("Set S8 abcDays period calib success");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String mqttUri = agServer.getMqttBroker();
|
String mqttUri = agServer.getMqttBroker();
|
||||||
if (mqttUri != agMqtt.getUri()) {
|
if (mqttUri != agMqtt.getUri()) {
|
||||||
|
Reference in New Issue
Block a user