5 Commits

Author SHA1 Message Date
Yurii
2e3b38e14f refactor: compatibility with NimBLE-Arduino 2.1.x 2024-12-17 11:24:49 +03:00
Yurii
b6c80f355f Merge branch 'master' of https://github.com/Laxilef/OTGateway 2024-12-17 11:22:13 +03:00
github-actions[bot]
65b2a3c2bd chore: bump NimBLE-Arduino from 1.4.3 to 2.1.0
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-17 11:21:04 +03:00
Yurii
0cb361d243 refactor: OT option `heatingCh2Enabled has been renamed to ch2AlwaysEnabled` 2024-12-17 10:30:06 +03:00
Yurii
c7f54ca4fb chore: bump pioarduino/platform-espressif32 from 3.1.0 rc3 to 3.1.0 2024-12-17 09:45:10 +03:00
9 changed files with 28 additions and 28 deletions

View File

@@ -85,13 +85,13 @@ board_build.ldscript = eagle.flash.4m1m.ld
;platform_packages = ;platform_packages =
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5 ; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip ; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10-rc3/platform-espressif32.zip platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10/platform-espressif32.zip
platform_packages = platform_packages =
board_build.partitions = esp32_partitions.csv board_build.partitions = esp32_partitions.csv
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
laxilef/ESP32Scheduler@^1.0.1 laxilef/ESP32Scheduler@^1.0.1
nimble_lib = h2zero/NimBLE-Arduino@^1.4.2 nimble_lib = h2zero/NimBLE-Arduino@^2.1.0
lib_ignore = lib_ignore =
extra_scripts = extra_scripts =
post:tools/esp32.py post:tools/esp32.py

View File

@@ -157,7 +157,7 @@ protected:
vars.master.dhw.targetTemp = settings.dhw.target; vars.master.dhw.targetTemp = settings.dhw.target;
// CH2 settings // CH2 settings
vars.master.ch2.enabled = settings.opentherm.options.heatingCh2Enabled vars.master.ch2.enabled = settings.opentherm.options.ch2AlwaysEnabled
|| (settings.opentherm.options.heatingToCh2 && vars.master.heating.enabled) || (settings.opentherm.options.heatingToCh2 && vars.master.heating.enabled)
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled); || (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);

View File

@@ -380,7 +380,7 @@ protected:
void pollingBleSensors() { void pollingBleSensors() {
#if USE_BLE #if USE_BLE
if (!NimBLEDevice::getInitialized() && millis() > 5000) { if (!NimBLEDevice::isInitialized() && millis() > 5000) {
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized")); Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
BLEDevice::init(""); BLEDevice::init("");
NimBLEDevice::setPower(ESP_PWR_LVL_P9); NimBLEDevice::setPower(ESP_PWR_LVL_P9);
@@ -445,7 +445,7 @@ protected:
bool connectToBleDevice(const uint8_t sensorId) { bool connectToBleDevice(const uint8_t sensorId) {
#if USE_BLE #if USE_BLE
if (!NimBLEDevice::getInitialized()) { if (!NimBLEDevice::isInitialized()) {
return false; return false;
} }
@@ -460,7 +460,7 @@ protected:
sSensor.address[0], sSensor.address[1], sSensor.address[2], sSensor.address[0], sSensor.address[1], sSensor.address[2],
sSensor.address[3], sSensor.address[4], sSensor.address[5] sSensor.address[3], sSensor.address[4], sSensor.address[5]
}; };
const NimBLEAddress address = NimBLEAddress(addr); const auto address = NimBLEAddress(addr, 0);
NimBLEClient* pClient = nullptr; NimBLEClient* pClient = nullptr;
pClient = NimBLEDevice::getClientByPeerAddress(address); pClient = NimBLEDevice::getClientByPeerAddress(address);
@@ -470,12 +470,13 @@ protected:
} }
if (pClient == nullptr) { if (pClient == nullptr) {
if (NimBLEDevice::getClientListSize() >= NIMBLE_MAX_CONNECTIONS) { if (NimBLEDevice::getCreatedClientCount() >= NIMBLE_MAX_CONNECTIONS) {
return false; return false;
} }
pClient = NimBLEDevice::createClient(); pClient = NimBLEDevice::createClient();
pClient->setConnectTimeout(5); pClient->setConnectTimeout(5000);
pClient->setSelfDelete(false, true);
} }
if(pClient->isConnected()) { if(pClient->isConnected()) {
@@ -492,7 +493,6 @@ protected:
sensorId, sSensor.name, address.toString().c_str() sensorId, sSensor.name, address.toString().c_str()
); );
NimBLEDevice::deleteClient(pClient);
return false; return false;
} }
@@ -536,7 +536,7 @@ protected:
return; return;
} }
NimBLERemoteService* pService = pChar->getRemoteService(); const NimBLERemoteService* pService = pChar->getRemoteService();
if (pService == nullptr) { if (pService == nullptr) {
return; return;
} }
@@ -609,7 +609,7 @@ protected:
return; return;
} }
NimBLERemoteService* pService = pChar->getRemoteService(); const NimBLERemoteService* pService = pChar->getRemoteService();
if (pService == nullptr) { if (pService == nullptr) {
return; return;
} }
@@ -694,7 +694,7 @@ protected:
return; return;
} }
NimBLERemoteService* pService = pChar->getRemoteService(); const NimBLERemoteService* pService = pChar->getRemoteService();
if (pService == nullptr) { if (pService == nullptr) {
return; return;
} }
@@ -793,7 +793,7 @@ protected:
return; return;
} }
NimBLERemoteService* pService = pChar->getRemoteService(); const NimBLERemoteService* pService = pChar->getRemoteService();
if (pService == nullptr) { if (pService == nullptr) {
return; return;
} }

View File

@@ -61,7 +61,7 @@ struct Settings {
bool dhwSupport = true; bool dhwSupport = true;
bool coolingSupport = false; bool coolingSupport = false;
bool summerWinterMode = false; bool summerWinterMode = false;
bool heatingCh2Enabled = true; bool ch2AlwaysEnabled = true;
bool heatingToCh2 = false; bool heatingToCh2 = false;
bool dhwToCh2 = false; bool dhwToCh2 = false;
bool dhwBlocking = false; bool dhwBlocking = false;

View File

@@ -50,6 +50,7 @@ const char S_BSSID[] PROGMEM = "bssid";
const char S_BUILD[] PROGMEM = "build"; const char S_BUILD[] PROGMEM = "build";
const char S_CASCADE_CONTROL[] PROGMEM = "cascadeControl"; const char S_CASCADE_CONTROL[] PROGMEM = "cascadeControl";
const char S_CHANNEL[] PROGMEM = "channel"; const char S_CHANNEL[] PROGMEM = "channel";
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
const char S_CHIP[] PROGMEM = "chip"; const char S_CHIP[] PROGMEM = "chip";
const char S_CODE[] PROGMEM = "code"; const char S_CODE[] PROGMEM = "code";
const char S_CONNECTED[] PROGMEM = "connected"; const char S_CONNECTED[] PROGMEM = "connected";
@@ -91,7 +92,6 @@ const char S_GPIO[] PROGMEM = "gpio";
const char S_HEAP[] PROGMEM = "heap"; const char S_HEAP[] PROGMEM = "heap";
const char S_HEATING[] PROGMEM = "heating"; const char S_HEATING[] PROGMEM = "heating";
const char S_HEATING_TO_CH2[] PROGMEM = "heatingToCh2"; const char S_HEATING_TO_CH2[] PROGMEM = "heatingToCh2";
const char S_HEATING_CH2_ENABLED[] PROGMEM = "heatingCh2Enabled";
const char S_HIDDEN[] PROGMEM = "hidden"; const char S_HIDDEN[] PROGMEM = "hidden";
const char S_HOME_ASSISTANT_DISCOVERY[] PROGMEM = "homeAssistantDiscovery"; const char S_HOME_ASSISTANT_DISCOVERY[] PROGMEM = "homeAssistantDiscovery";
const char S_HOSTNAME[] PROGMEM = "hostname"; const char S_HOSTNAME[] PROGMEM = "hostname";

View File

@@ -382,7 +382,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
otOptions[FPSTR(S_DHW_SUPPORT)] = src.opentherm.options.dhwSupport; otOptions[FPSTR(S_DHW_SUPPORT)] = src.opentherm.options.dhwSupport;
otOptions[FPSTR(S_COOLING_SUPPORT)] = src.opentherm.options.coolingSupport; otOptions[FPSTR(S_COOLING_SUPPORT)] = src.opentherm.options.coolingSupport;
otOptions[FPSTR(S_SUMMER_WINTER_MODE)] = src.opentherm.options.summerWinterMode; otOptions[FPSTR(S_SUMMER_WINTER_MODE)] = src.opentherm.options.summerWinterMode;
otOptions[FPSTR(S_HEATING_CH2_ENABLED)] = src.opentherm.options.heatingCh2Enabled; otOptions[FPSTR(S_CH2_ALWAYS_ENABLED)] = src.opentherm.options.ch2AlwaysEnabled;
otOptions[FPSTR(S_HEATING_TO_CH2)] = src.opentherm.options.heatingToCh2; otOptions[FPSTR(S_HEATING_TO_CH2)] = src.opentherm.options.heatingToCh2;
otOptions[FPSTR(S_DHW_TO_CH2)] = src.opentherm.options.dhwToCh2; otOptions[FPSTR(S_DHW_TO_CH2)] = src.opentherm.options.dhwToCh2;
otOptions[FPSTR(S_DHW_BLOCKING)] = src.opentherm.options.dhwBlocking; otOptions[FPSTR(S_DHW_BLOCKING)] = src.opentherm.options.dhwBlocking;
@@ -748,13 +748,13 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].is<bool>()) { if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].is<bool>()) {
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].as<bool>(); bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_CH2_ALWAYS_ENABLED)].as<bool>();
if (value != dst.opentherm.options.heatingCh2Enabled) { if (value != dst.opentherm.options.ch2AlwaysEnabled) {
dst.opentherm.options.heatingCh2Enabled = value; dst.opentherm.options.ch2AlwaysEnabled = value;
if (dst.opentherm.options.heatingCh2Enabled) { if (dst.opentherm.options.ch2AlwaysEnabled) {
dst.opentherm.options.heatingToCh2 = false; dst.opentherm.options.heatingToCh2 = false;
dst.opentherm.options.dhwToCh2 = false; dst.opentherm.options.dhwToCh2 = false;
} }
@@ -770,7 +770,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
dst.opentherm.options.heatingToCh2 = value; dst.opentherm.options.heatingToCh2 = value;
if (dst.opentherm.options.heatingToCh2) { if (dst.opentherm.options.heatingToCh2) {
dst.opentherm.options.heatingCh2Enabled = false; dst.opentherm.options.ch2AlwaysEnabled = false;
dst.opentherm.options.dhwToCh2 = false; dst.opentherm.options.dhwToCh2 = false;
} }
@@ -785,7 +785,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
dst.opentherm.options.dhwToCh2 = value; dst.opentherm.options.dhwToCh2 = value;
if (dst.opentherm.options.dhwToCh2) { if (dst.opentherm.options.dhwToCh2) {
dst.opentherm.options.heatingCh2Enabled = false; dst.opentherm.options.ch2AlwaysEnabled = false;
dst.opentherm.options.heatingToCh2 = false; dst.opentherm.options.heatingToCh2 = false;
} }

View File

@@ -360,7 +360,7 @@
"dhwSupport": "DHW support", "dhwSupport": "DHW support",
"coolingSupport": "Cooling support", "coolingSupport": "Cooling support",
"summerWinterMode": "Summer/winter mode", "summerWinterMode": "Summer/winter mode",
"heatingCh2Enabled": "Heating CH2 always enabled", "ch2AlwaysEnabled": "CH2 always enabled",
"heatingToCh2": "Duplicate heating to CH2", "heatingToCh2": "Duplicate heating to CH2",
"dhwToCh2": "Duplicate DHW to CH2", "dhwToCh2": "Duplicate DHW to CH2",
"dhwBlocking": "DHW blocking", "dhwBlocking": "DHW blocking",

View File

@@ -360,7 +360,7 @@
"dhwSupport": "Поддержка ГВС", "dhwSupport": "Поддержка ГВС",
"coolingSupport": "Поддержка охлаждения", "coolingSupport": "Поддержка охлаждения",
"summerWinterMode": "Летний/зимний режим", "summerWinterMode": "Летний/зимний режим",
"heatingCh2Enabled": "Канал 2 отопления всегда вкл.", "ch2AlwaysEnabled": "Канал 2 всегда вкл.",
"heatingToCh2": "Дублировать параметры отопления в канал 2", "heatingToCh2": "Дублировать параметры отопления в канал 2",
"dhwToCh2": "Дублировать параметры ГВС в канал 2", "dhwToCh2": "Дублировать параметры ГВС в канал 2",
"dhwBlocking": "DHW blocking", "dhwBlocking": "DHW blocking",

View File

@@ -420,8 +420,8 @@
</label> </label>
<label> <label>
<input type="checkbox" name="opentherm[options][heatingCh2Enabled]" value="true"> <input type="checkbox" name="opentherm[options][ch2AlwaysEnabled]" value="true">
<span data-i18n>settings.ot.options.heatingCh2Enabled</span> <span data-i18n>settings.ot.options.ch2AlwaysEnabled</span>
</label> </label>
<label> <label>
@@ -704,7 +704,7 @@
setCheckboxValue("[name='opentherm[options][dhwSupport]']", data.opentherm.options.dhwSupport); setCheckboxValue("[name='opentherm[options][dhwSupport]']", data.opentherm.options.dhwSupport);
setCheckboxValue("[name='opentherm[options][coolingSupport]']", data.opentherm.options.coolingSupport); setCheckboxValue("[name='opentherm[options][coolingSupport]']", data.opentherm.options.coolingSupport);
setCheckboxValue("[name='opentherm[options][summerWinterMode]']", data.opentherm.options.summerWinterMode); setCheckboxValue("[name='opentherm[options][summerWinterMode]']", data.opentherm.options.summerWinterMode);
setCheckboxValue("[name='opentherm[options][heatingCh2Enabled]']", data.opentherm.options.heatingCh2Enabled); setCheckboxValue("[name='opentherm[options][ch2AlwaysEnabled]']", data.opentherm.options.ch2AlwaysEnabled);
setCheckboxValue("[name='opentherm[options][heatingToCh2]']", data.opentherm.options.heatingToCh2); setCheckboxValue("[name='opentherm[options][heatingToCh2]']", data.opentherm.options.heatingToCh2);
setCheckboxValue("[name='opentherm[options][dhwToCh2]']", data.opentherm.options.dhwToCh2); setCheckboxValue("[name='opentherm[options][dhwToCh2]']", data.opentherm.options.dhwToCh2);
setCheckboxValue("[name='opentherm[options][dhwBlocking]']", data.opentherm.options.dhwBlocking); setCheckboxValue("[name='opentherm[options][dhwBlocking]']", data.opentherm.options.dhwBlocking);