fix: harden configuration and runtime state handling

This commit is contained in:
Yurii committed 2026-11-25 03:36:46 +03:00
1 parent f3f8ce5861
commit 65df4b7f5a
9 files changed
+372 -275

No files matched your search

+2 -16
View File
@@ -349,20 +349,6 @@ static NimBLEScan* pBLEScan = nullptr;
static bool activeScanBle = false;
#endif
static bool isEqualAddress(const uint8_t *addr1, const uint8_t *addr2, const uint8_t length = 8) {
return memcmp(addr1, addr2, length) == 0;
/*bool result = true;
for (uint8_t i = 0; i < length; i++) {
if (addr1[i] != addr2[i]) {
result = false;
break;
}
}
return result;*/
}
static bool isEmptyAddress(const uint8_t *addr, const uint8_t length = 8) {
bool result = true;
@@ -437,7 +423,7 @@ static void makeDallasInstances() {
continue;
}
if (!sSensor->enabled || sSensor->type != Sensors::Type::DALLAS_TEMP || sSensor->purpose == Sensors::Purpose::NOT_CONFIGURED) {
if (!sSensor->enabled || sSensor->type != Sensors::Type::DALLAS_TEMP || sSensor->purpose == Sensors::Purpose::NOT_CONFIGURED || !GPIO_IS_VALID_OUTPUT(sSensor->gpio)) {
continue;
} else if (dallasInstances.count(sSensor->gpio)) {
@@ -571,7 +557,7 @@ static void fillingAddressesDallasSensors() {
continue;
}
if (isEqualAddress(sCheckingSensor->address, devAddr)) {
if (Sensors::isEqualAddress(sCheckingSensor->address, devAddr)) {
freeAddress = false;
break;
}