diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index f0588c826..4290f1d1f 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -4,13 +4,15 @@ ## Added -- Translations in Web UI and all device entity names to German. [#22](https://github.com/emsesp/EMS-ESP32/issues/22) +- Translations in Web UI and all device entity names (DE, NL, SE, PL, NO, ...) [#22](https://github.com/emsesp/EMS-ESP32/issues/22) - Add support for Lolin C3 mini [#620](https://github.com/emsesp/EMS-ESP32/pull/620) -- Add Greenstar 30Ri boiler +- Add support for ESP32-S2 [#667](https://github.com/emsesp/EMS-ESP32/pull/667) +- Add devices: Greenstar 30Ri boiler, Junkers FW500 thermostat, Buderus BC30 controller - Add program memory info +- Add mqtt queue and connection infos - Add min/max setting to customizations - Adapt min/max if ems-value is not in this range -- Add heatpump settings for inputs and limits +- Add heat pump settings for inputs and limits ## Fixed @@ -20,6 +22,8 @@ - Discovery in HomeAssistant don't work with custom base topic. [#596](https://github.com/emsesp/EMS-ESP32/issues/596) Base topic containing `/` are changed to `_` - RF room temperature sensor are shown as thermostat +- render mqtt float json values with trailing zero +- removed flash strings ## **BREAKING CHANGES:** diff --git a/interface/src/SignIn.tsx b/interface/src/SignIn.tsx index 3467a48d0..38c3b8e09 100644 --- a/interface/src/SignIn.tsx +++ b/interface/src/SignIn.tsx @@ -22,6 +22,8 @@ import { ReactComponent as NLflag } from './i18n/NL.svg'; import { ReactComponent as DEflag } from './i18n/DE.svg'; import { ReactComponent as GBflag } from './i18n/GB.svg'; import { ReactComponent as SEflag } from './i18n/SE.svg'; +import { ReactComponent as PLflag } from './i18n/PL.svg'; +import { ReactComponent as NOflag } from './i18n/NO.svg'; const SignIn: FC = () => { const authenticationContext = useContext(AuthenticationContext); @@ -123,6 +125,19 @@ const SignIn: FC = () => {  SE + + #endif +#endif #include diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index ce619d9a1..a22ff566f 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -360,14 +360,15 @@ bool DallasSensor::command_info(const char * value, const int8_t id, JsonObject } for (const auto & sensor : sensors_) { + char val[10]; if (id == -1) { // show number and id JsonObject dataSensor = output.createNestedObject(sensor.name()); dataSensor["id"] = sensor.id(); if (Helpers::hasValue(sensor.temperature_c)) { - dataSensor["temp"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + dataSensor["temp"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } else if (Helpers::hasValue(sensor.temperature_c)) { - output[sensor.name()] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + output[sensor.name()] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } @@ -392,14 +393,18 @@ bool DallasSensor::get_value_info(JsonObject & output, const char * cmd, const i if (strcmp(command_s, sensor.name().c_str()) == 0) { output["id"] = sensor.id(); output["name"] = sensor.name(); + char val[10]; + if (Helpers::hasValue(sensor.temperature_c)) { - output["value"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + output["value"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } + output["type"] = F_(number); - output["min"] = Helpers::transformNumFloat(-55, 0, EMSESP::system_.fahrenheit() ? 2 : 0); - output["max"] = Helpers::transformNumFloat(125, 0, EMSESP::system_.fahrenheit() ? 2 : 0); + output["min"] = serialized(Helpers::render_value(val, -55, 0, EMSESP::system_.fahrenheit() ? 2 : 0)); + output["max"] = serialized(Helpers::render_value(val, 125, 0, EMSESP::system_.fahrenheit() ? 2 : 0)); output["uom"] = EMSdevice::uom_to_string(DeviceValueUOM::DEGREES); output["writeable"] = false; + // if we're filtering on an attribute, go find it if (attribute_s) { if (output.containsKey(attribute_s)) { @@ -469,14 +474,15 @@ void DallasSensor::publish_values(const bool force) { for (auto & sensor : sensors_) { bool has_value = Helpers::hasValue(sensor.temperature_c); + char val[10]; if (Mqtt::is_nested()) { JsonObject dataSensor = doc.createNestedObject(sensor.id()); dataSensor["name"] = sensor.name(); if (has_value) { - dataSensor["temp"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + dataSensor["temp"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } else if (has_value) { - doc[sensor.name()] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + doc[sensor.name()] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } // create the HA MQTT config diff --git a/src/device_library.h b/src/device_library.h index 13e019991..356353f78 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -110,6 +110,7 @@ {109, DeviceType::THERMOSTAT, "FB10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {110, DeviceType::THERMOSTAT, "FB100", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {111, DeviceType::THERMOSTAT, "FR10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{116, DeviceType::THERMOSTAT, "FW500", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {147, DeviceType::THERMOSTAT, "FR50", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, {191, DeviceType::THERMOSTAT, "FR120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model {192, DeviceType::THERMOSTAT, "FW120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index ed9661696..243ba52b3 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -680,13 +680,19 @@ void Thermostat::process_JunkersSet(std::shared_ptr telegram) { return; } - has_update(telegram, hc->daytemp, 17); // is * 2 - has_update(telegram, hc->nighttemp, 16); // is * 2 - has_update(telegram, hc->nofrosttemp, 15); // is * 2 - has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 - has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... - has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto - has_update(telegram, hc->roomsensor, 9); // 1-intern, 2-extern, 3-autoselect the lower value + has_update(telegram, hc->daytemp, 17); // is * 2 + has_update(telegram, hc->nighttemp, 16); // is * 2 + has_update(telegram, hc->nofrosttemp, 15); // is * 2 + has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 + has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... + has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto + has_update(telegram, hc->daytemp, 17); // is * 2 + has_update(telegram, hc->nighttemp, 16); // is * 2 + has_update(telegram, hc->nofrosttemp, 15); // is * 2 + has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 + has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... + has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto + has_enumupdate(telegram, hc->roomsensor, 9, 1); // 1-intern, 2-extern, 3-autoselect the lower value } // type 0x0179, ff @@ -1364,10 +1370,12 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { strftime(newdatetime, sizeof(dateTime_), "%d.%m.%G %H:%M", tm_); has_update(dateTime_, newdatetime, sizeof(dateTime_)); - bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 - time_t ttime = mktime(tm_); // thermostat time + bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 + bool junkersclock = model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS; + time_t ttime = mktime(tm_); // thermostat time + // correct thermostat clock if we have valid ntp time, and could write the command - if (!ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { + if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { double difference = difftime(now, ttime); if (difference > 15 || difference < -15) { set_datetime("ntp", -1); // set from NTP @@ -1717,7 +1725,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) { uint8_t ctrl = 0; if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) { if (Helpers::value2enum(value, ctrl, FL_(enum_roomsensor))) { - write_command(set_typeids[hc->hc()], 9, ctrl); + write_command(set_typeids[hc->hc()], 9, ctrl + 1); return true; } } @@ -2165,6 +2173,10 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[5] = tm_->tm_sec; data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock + if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { + data[6]++; // Junkers use 1-7; + data[7] = 0; + } } else if (dt.length() == 23) { data[0] = (dt[7] - '0') * 100 + (dt[8] - '0') * 10 + (dt[9] - '0'); // year data[1] = (dt[3] - '0') * 10 + (dt[4] - '0'); // month @@ -2174,6 +2186,9 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[5] = (dt[17] - '0') * 10 + (dt[18] - '0'); // sec data[6] = (dt[20] - '0'); // day of week, Mo:0 data[7] = (dt[22] - '0') + 2; // DST and flag + if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { + data[7] = 0; + } } else { LOG_WARNING("Set date: invalid data, wrong length"); return false; @@ -3846,8 +3861,9 @@ void Thermostat::register_device_values() { MAKE_CF_CB(set_wwVacation)); break; case EMS_DEVICE_FLAG_JUNKERS: + // FR100 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/536 + // FW500 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/666 if (has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) { - // FR100 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/536 register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(tpl_datetime), FL_(dateTime), DeviceValueUOM::NONE); } else { register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index fd79b764b..6ae24786e 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -790,9 +790,9 @@ void EMSdevice::generate_values_web(JsonObject & output) { } else if ((dv.type == DeviceValueType::USHORT) && Helpers::hasValue(*(uint16_t *)(dv.value_p))) { obj["v"] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if ((dv.type == DeviceValueType::ULONG) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator, fahrenheit); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else if ((dv.type == DeviceValueType::TIME) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - obj["v"] = dv.numeric_operator ? (*(uint32_t *)(dv.value_p) / dv.numeric_operator) : *(uint32_t *)(dv.value_p); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else { obj["v"] = ""; // must have a value for sorting to work } @@ -891,40 +891,18 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { // handle Integers and Floats else { - int8_t num_op = dv.numeric_operator; - bool make_float; - if (num_op == 0) { - // no changes to number - make_float = false; - num_op = 1; // so it gets *1 - } else if (num_op < 0) { - // negative numbers, convert to a positive multiplier - make_float = false; - num_op *= -1; - } else { - // has a divider, make it a float - make_float = true; - } - - // always convert temperatures to floats with 1 decimal place - if ((dv.uom == DeviceValueUOM::DEGREES) || (dv.uom == DeviceValueUOM::DEGREES_R)) { - make_float = true; - } - if (dv.type == DeviceValueType::INT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit) : *(int8_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::UINT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit) : *(uint8_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::SHORT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit) : *(int16_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::USHORT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit) : *(uint16_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::ULONG) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op) : *(uint32_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else if (dv.type == DeviceValueType::TIME) { - // sometimes we need to divide by 60 - obj["v"] = (num_op == DeviceValueNumOp::DV_NUMOP_DIV60) ? (uint32_t)Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op) - : *(uint32_t *)(dv.value_p); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } } } @@ -1091,8 +1069,6 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // search device value with this tag for (auto & dv : devicevalues_) { if (!strcmp(command_s, dv.short_name) && (tag <= 0 || tag == dv.tag)) { - int8_t num_op = dv.numeric_operator; - uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; const char * type = "type"; @@ -1113,6 +1089,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 json["circuit"] = tag_to_mqtt(dv.tag); } + char val[10]; switch (dv.type) { case DeviceValueType::ENUM: { if (*(uint8_t *)(dv.value_p) < dv.options_size) { @@ -1132,35 +1109,35 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 case DeviceValueType::USHORT: if (Helpers::hasValue(*(uint16_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::UINT: if (Helpers::hasValue(*(uint8_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::SHORT: if (Helpers::hasValue(*(int16_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::INT: if (Helpers::hasValue(*(int8_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::ULONG: if (Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); + json[value] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } json[type] = F_(number); break; @@ -1182,7 +1159,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 case DeviceValueType::TIME: if (Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); + json[value] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } json[type] = F_(number); break; @@ -1364,64 +1341,22 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; - - int8_t num_op = dv.numeric_operator; - bool make_float; - if (num_op == 0) { - // no changes to number - make_float = false; - num_op = 1; // so it gets *1 - } else if (num_op < 0) { - // negative numbers, convert to a positive multiplier - make_float = false; - num_op *= -1; - } else { - // has a divider, make it a float - make_float = true; - } - - // always convert temperatures to floats with 1 decimal place - if ((dv.uom == DeviceValueUOM::DEGREES) || (dv.uom == DeviceValueUOM::DEGREES_R)) { - make_float = true; - } + char val[10]; if (dv.type == DeviceValueType::INT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(int8_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::UINT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint8_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::SHORT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(int16_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::USHORT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint16_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::ULONG) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint32_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } else if ((dv.type == DeviceValueType::TIME) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - uint32_t time_value; - if (num_op == DeviceValueNumOp::DV_NUMOP_DIV60) { - // sometimes we need to divide by 60 - time_value = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); - } else { - time_value = *(uint32_t *)(dv.value_p); + uint32_t time_value = *(uint32_t *)(dv.value_p); + if (dv.numeric_operator == DeviceValueNumOp::DV_NUMOP_DIV60) { + time_value /= 60; // sometimes we need to divide by 60 } if (output_target == OUTPUT_TARGET::API_VERBOSE || output_target == OUTPUT_TARGET::CONSOLE) { char time_s[60]; diff --git a/src/system.h b/src/system.h index 0c8330e67..df26f7920 100644 --- a/src/system.h +++ b/src/system.h @@ -29,7 +29,9 @@ #ifndef EMSESP_STANDALONE #include +#ifndef ARDUINO_LOLIN_S2_MINI #include +#endif #include #include #endif diff --git a/src/uart/emsuart_esp32.h b/src/uart/emsuart_esp32.h index a882d6727..b902a38eb 100644 --- a/src/uart/emsuart_esp32.h +++ b/src/uart/emsuart_esp32.h @@ -26,8 +26,8 @@ #define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK -#ifdef ARDUINO_LOLIN_C3_MINI -#define EMSUART_NUM UART_NUM_1 // on C3 mini we're using UART1 +#if (defined(ARDUINO_LOLIN_C3_MINI)) || (defined(ARDUINO_LOLIN_S2_MINI)) +#define EMSUART_NUM UART_NUM_1 // on C3 and S2 we're using UART1 #else #define EMSUART_NUM UART_NUM_2 // on the ESP32 we're using UART2 #endif