diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index ce20c2f80..f47f825d9 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -13,7 +13,7 @@ For more details go to [emsesp.org](https://emsesp.org/). - signed value for solarInfuence [#3077](https://github.com/emsesp/EMS-ESP32/issues/3077) - set bin file upload limit to 1M again [3086](https://github.com/emsesp/EMS-ESP32/issues/3086) - check arithmetric operations on strings [#3127](https://github.com/emsesp/EMS-ESP32/discussions/3127) -- Prevent system crash during WiFi network discovery on ESP32-S3 hardware [#3128](https://github.com/emsesp/EMS-ESP32/pull/3128) +- Fix: Prevent system crash during WiFi network discovery on ESP32-S3 hardware [#3128](https://github.com/emsesp/EMS-ESP32/pull/3128) ## Changed diff --git a/src/ESP32React/WiFiScanner.cpp b/src/ESP32React/WiFiScanner.cpp index d959dde05..425992f98 100644 --- a/src/ESP32React/WiFiScanner.cpp +++ b/src/ESP32React/WiFiScanner.cpp @@ -38,9 +38,9 @@ void WiFiScanner::listNetworks(AsyncWebServerRequest * request) { } else if (numNetworks == -1) { request->send(202); // special code to indicate scan in progress } else { - auto * response = new AsyncJsonResponse(false); - JsonObject root = response->getRoot(); - JsonArray networks = root["networks"].to(); + auto * response = new AsyncJsonResponse(false); + JsonObject root = response->getRoot(); + root["networks"].to(); response->setLength(); request->send(response); } diff --git a/src/core/roomcontrol.cpp b/src/core/roomcontrol.cpp index a2c0c5098..b047c4755 100644 --- a/src/core/roomcontrol.cpp +++ b/src/core/roomcontrol.cpp @@ -377,19 +377,23 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) { // send telegram 0x047B only for RC100H void Roomctrl::humidity(uint8_t addr, uint8_t dst, uint8_t hc) { + int16_t dew = calc_dew(remotetemp_[hc], remotehum_[hc]); + int8_t dew8 = EMS_VALUE_INT8_NOTSET; + if (dew != EMS_VALUE_INT16_NOTSET) { + dew8 = static_cast((dew >= 0 ? dew + 5 : dew - 5) / 10); + } uint8_t data[11]; - data[0] = addr | EMSbus::ems_mask(); - data[1] = dst & 0x7F; - uint16_t dew = calc_dew(remotetemp_[hc], remotehum_[hc]); - data[2] = 0xFF; - data[3] = 0; - data[4] = 3; - data[5] = 0x7B + hc; - data[6] = dew == EMS_VALUE_INT16_NOTSET ? EMS_VALUE_INT8_NOTSET : (uint8_t)((dew + 5) / 10); - data[7] = remotehum_[hc]; - data[8] = (uint8_t)(dew << 8); - data[9] = (uint8_t)(dew & 0xFF); - data[10] = EMSbus::calculate_crc(data, 10); // append CRC + data[0] = addr | EMSbus::ems_mask(); + data[1] = dst & 0x7F; + data[2] = 0xFF; + data[3] = 0; + data[4] = 3; + data[5] = 0x7B + hc; + data[6] = static_cast(dew8); + data[7] = remotehum_[hc]; + data[8] = static_cast(static_cast(dew) >> 8); + data[9] = static_cast(static_cast(dew) & 0xFF); + data[10] = EMSbus::calculate_crc(data, 10); // append CRC EMSuart::transmit(data, 11); }