diff --git a/src/modules/Bme280.cpp b/src/modules/Bme280.cpp index 0d14e38a..1849c818 100644 --- a/src/modules/Bme280.cpp +++ b/src/modules/Bme280.cpp @@ -24,8 +24,8 @@ class Bme280t : public IoTItem { } void doByInterval() { - float value = _bme->readTemperature(); - if (value < 145) regEvent(value, "Bme280t"); + value.valD = _bme->readTemperature(); + if (value.valD < 145) regEvent(value.valD, "Bme280t"); else SerialPrint("E", "Sensor Bme280t", "Error"); } @@ -43,8 +43,8 @@ class Bme280h : public IoTItem { } void doByInterval() { - float value = _bme->readHumidity(); - if (value < 100) regEvent(value, "Bme280h"); + value.valD = _bme->readHumidity(); + if (value.valD < 100) regEvent(value.valD, "Bme280h"); else SerialPrint("E", "Sensor Bme280h", "Error"); } @@ -62,10 +62,10 @@ class Bme280p : public IoTItem { } void doByInterval() { - float value = _bme->readPressure(); - if (value > 0) { - value = value / 1.333224 / 100; - regEvent(value, "Bme280p"); + value.valD = _bme->readPressure(); + if (value.valD > 0) { + value.valD = value.valD / 1.333224 / 100; + regEvent(value.valD, "Bme280p"); } else SerialPrint("E", "Sensor Bme280p", "Error"); } diff --git a/src/modules/Bmp280.cpp b/src/modules/Bmp280.cpp index d474edc2..c25fe3c3 100644 --- a/src/modules/Bmp280.cpp +++ b/src/modules/Bmp280.cpp @@ -24,8 +24,8 @@ class Bmp280t : public IoTItem { } void doByInterval() { - float value = _bmp->readTemperature(); - if (String(value) != "nan") regEvent(value, "Bmp280t"); + value.valD = _bmp->readTemperature(); + if (String(value.valD) != "nan") regEvent(value.valD, "Bmp280t"); else SerialPrint("E", "Sensor DHTt", "Error"); } @@ -43,10 +43,10 @@ class Bmp280p : public IoTItem { } void doByInterval() { - float value = _bmp->readPressure(); - if (String(value) != "nan") { - value = value / 1.333224 / 100; - regEvent(value, "Bmp280p"); + value.valD = _bmp->readPressure(); + if (String(value.valD) != "nan") { + value.valD = value.valD / 1.333224 / 100; + regEvent(value.valD, "Bmp280p"); } else SerialPrint("E", "Sensor DHTh", "Error"); } diff --git a/src/modules/Dht1122.cpp b/src/modules/Dht1122.cpp index 927861a5..0ff9e134 100644 --- a/src/modules/Dht1122.cpp +++ b/src/modules/Dht1122.cpp @@ -24,8 +24,8 @@ class Dht1122t : public IoTItem { } void doByInterval() { - float value = _dht->getTemperature(); - if (String(value) != "nan") regEvent(value, "Dht1122t"); + value.valD = _dht->getTemperature(); + if (String(value.valD) != "nan") regEvent(value.valD, "Dht1122t"); else SerialPrint("E", "Sensor DHTt", "Error"); } @@ -43,8 +43,8 @@ class Dht1122h : public IoTItem { } void doByInterval() { - float value = _dht->getHumidity(); - if (String(value) != "nan") regEvent(value, "Dht1122h"); + value.valD = _dht->getHumidity(); + if (String(value.valD) != "nan") regEvent(value.valD, "Dht1122h"); else SerialPrint("E", "Sensor DHTh", "Error"); } diff --git a/src/modules/Sht20.cpp b/src/modules/Sht20.cpp index 4381e9b4..70488f43 100644 --- a/src/modules/Sht20.cpp +++ b/src/modules/Sht20.cpp @@ -13,8 +13,8 @@ class Sht20t : public IoTItem { void doByInterval() { sht->read(); - float value = sht->getTemperature(); - if (value > -46.85F) regEvent(value, "Sht20t"); + value.valD = sht->getTemperature(); + if (value.valD > -46.85F) regEvent(value.valD, "Sht20t"); else SerialPrint("E", "Sensor Sht20t", "Error"); } @@ -27,8 +27,8 @@ class Sht20h : public IoTItem { void doByInterval() { sht->read(); - float value = sht->getHumidity(); - if (value != -6) regEvent(value, "Sht20h"); + value.valD = sht->getHumidity(); + if (value.valD != -6) regEvent(value.valD, "Sht20h"); else SerialPrint("E", "Sensor Sht20h", "Error"); } diff --git a/src/modules/ds18b20.cpp b/src/modules/ds18b20.cpp index e51103f6..2e09aa48 100644 --- a/src/modules/ds18b20.cpp +++ b/src/modules/ds18b20.cpp @@ -69,12 +69,12 @@ class Ds18b20 : public IoTItem { string2hex(_addr.c_str(), deviceAddress); } //получаем температуру по адресу - float value = sensors->getTempC(deviceAddress); + value.valD = sensors->getTempC(deviceAddress); char addrStr[20] = ""; hex2string(deviceAddress, 8, addrStr); - if (value != -127) regEvent(value, "addr: " + String(addrStr)); //обязательный вызов для отправки результата работы + if (value.valD != -127) regEvent(value.valD, "addr: " + String(addrStr)); //обязательный вызов для отправки результата работы else SerialPrint("E", "Sensor Ds18b20", "Error"); } //=======================================================================================================