refactor: simplify conditions and standardize formatting

This commit is contained in:
Yurii committed 2026-11-25 03:37:16 +03:00
1 parent d1a44de0df
commit 1d1a57ecad
9 files changed
+212 -187

No files matched your search

+9 -12
View File
@@ -954,18 +954,16 @@ void initSensors() {
pollDhtSensorsTask.setInterval(1000)
.setEnabledWhen([] {
return canRunSensors() && (
Sensors::getAmountByType(Sensors::Type::DHT11, true) ||
Sensors::getAmountByType(Sensors::Type::DHT22, true)
);
return canRunSensors() &&
(Sensors::getAmountByType(Sensors::Type::DHT11, true) ||
Sensors::getAmountByType(Sensors::Type::DHT22, true));
});
sensorsTaskManager.addTask(pollDhtSensorsTask);
maintainDallasSensorsTask.setEnabledWhen([] {
return canRunSensors() && (
!dallasInstances.empty() ||
Sensors::getAmountByType(Sensors::Type::DALLAS_TEMP, true)
);
return canRunSensors() &&
(!dallasInstances.empty() ||
Sensors::getAmountByType(Sensors::Type::DALLAS_TEMP, true));
})
.resume(15000);
sensorsTaskManager.addTask(maintainDallasSensorsTask);
@@ -978,10 +976,9 @@ void initSensors() {
#if USE_BLE
scanBleSensorsTask.setEnabledWhen([] {
return canRunSensors() && (
NimBLEDevice::isInitialized() ||
Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)
);
return canRunSensors() &&
(NimBLEDevice::isInitialized() ||
Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true));
})
.onDone([](const Task&, uint32_t) {
if (scanBleSensorsTask.interval() != 1000) {