Merge pull request #223 from airgradienthq/hotfix/print-log-wrong-format

Fix print log message number format
This commit is contained in:
AirGradient
2024-09-02 12:11:43 +07:00
committed by GitHub
5 changed files with 42 additions and 26 deletions

View File

@ -114,7 +114,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
if (utils::isValidTemperature(this->temp_1) && utils::isValidTemperature(this->temp_1)) {
root["atmp"] = ag->round2((this->temp_1 + this->temp_2) / 2.0f);
if (localServer) {
val = ag->pms5003t_2.temperatureCompensated((this->temp_1 + this->temp_2) / 2.0f);
val = ag->pms5003t_2.compensateTemp((this->temp_1 + this->temp_2) / 2.0f);
if (utils::isValidTemperature(val)) {
root["atmpCompensated"] = ag->round2(val);
}
@ -123,7 +123,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
if (utils::isValidHumidity(this->hum_1) && utils::isValidHumidity(this->hum_1)) {
root["rhum"] = ag->round2((this->hum_1 + this->hum_2) / 2.0f);
if (localServer) {
val = ag->pms5003t_2.humidityCompensated((this->hum_1 + this->hum_2) / 2.0f);
val = ag->pms5003t_2.compensateHum((this->hum_1 + this->hum_2) / 2.0f);
if (utils::isValidHumidity(val)) {
root["rhumCompensated"] = (int)val;
}
@ -155,7 +155,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["atmp"] = ag->round2(this->temp_1);
if (localServer) {
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
val = ag->pms5003t_1.compensateTemp(this->temp_1);
if (utils::isValidTemperature(val)) {
root["atmpCompensated"] = ag->round2(val);
}
@ -165,7 +165,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["rhum"] = this->hum_1;
if (localServer) {
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
val = ag->pms5003t_1.compensateHum(this->hum_1);
if (utils::isValidHumidity(val)) {
root["rhumCompensated"] = (int)val;
}
@ -196,7 +196,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["atmp"] = ag->round2(this->temp_2);
if (localServer) {
val = ag->pms5003t_2.temperatureCompensated(this->temp_2);
val = ag->pms5003t_2.compensateTemp(this->temp_2);
if (utils::isValidTemperature(val)) {
root["atmpCompensated"] = ag->round2(val);
}
@ -206,7 +206,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["rhum"] = this->hum_2;
if (localServer) {
val = ag->pms5003t_2.humidityCompensated(this->hum_2);
val = ag->pms5003t_2.compensateHum(this->hum_2);
if (utils::isValidHumidity(val)) {
root["rhumCompensated"] = (int)val;
}
@ -238,7 +238,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["atmp"] = ag->round2(this->temp_1);
if (localServer) {
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
val = ag->pms5003t_1.compensateTemp(this->temp_1);
if (utils::isValidTemperature(val)) {
root["atmpCompensated"] = ag->round2(val);
}
@ -247,7 +247,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
if (utils::isValidHumidity(this->hum_1)) {
root["rhum"] = this->hum_1;
if(localServer) {
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
val = ag->pms5003t_1.compensateHum(this->hum_1);
if(utils::isValidHumidity(val)) {
root["rhumCompensated"] = (int)val;
}
@ -275,7 +275,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["atmp"] = ag->round2(this->temp_2);
if (localServer) {
val = ag->pms5003t_1.temperatureCompensated(this->temp_2);
val = ag->pms5003t_1.compensateTemp(this->temp_2);
if (utils::isValidTemperature(val)) {
root["atmpCompensated"] = ag->round2(val);
}
@ -285,7 +285,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["rhum"] = this->hum_2;
if(localServer) {
val = ag->pms5003t_1.humidityCompensated(this->hum_2);
val = ag->pms5003t_1.compensateHum(this->hum_2);
if(utils::isValidHumidity(val)) {
root["rhumCompensated"] = (int)val;
}
@ -316,7 +316,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["channels"]["1"]["atmp"] = ag->round2(this->temp_1);
if (localServer) {
val = ag->pms5003t_1.temperatureCompensated(this->temp_1);
val = ag->pms5003t_1.compensateTemp(this->temp_1);
if (utils::isValidTemperature(val)) {
root["channels"]["1"]["atmpCompensated"] = ag->round2(val);
}
@ -326,7 +326,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["channels"]["1"]["rhum"] = this->hum_1;
if (localServer) {
val = ag->pms5003t_1.humidityCompensated(this->hum_1);
val = ag->pms5003t_1.compensateHum(this->hum_1);
if (utils::isValidHumidity(val)) {
root["channels"]["1"]["rhumCompensated"] = (int)val;
}
@ -358,7 +358,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["channels"]["2"]["atmp"] = ag->round2(this->temp_2);
if (localServer) {
val = ag->pms5003t_1.temperatureCompensated(this->temp_2);
val = ag->pms5003t_1.compensateTemp(this->temp_2);
if (utils::isValidTemperature(val)) {
root["channels"]["2"]["atmpCompensated"] = ag->round2(val);
}
@ -368,7 +368,7 @@ String Measurements::toString(bool localServer, AgFirmwareMode fwMode, int rssi,
root["channels"]["2"]["rhum"] = this->hum_2;
if (localServer) {
val = ag->pms5003t_1.humidityCompensated(this->hum_2);
val = ag->pms5003t_1.compensateHum(this->hum_2);
if (utils::isValidHumidity(val)) {
root["channels"]["2"]["rhumCompensated"] = (int)val;
}