mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-30 10:13:04 +05:00
refactor: simplify conditions and standardize formatting
This commit is contained in:
1 parent
d1a44de0df
commit
1d1a57ecad
9 files changed
+212
-187
No files matched your search
+9
-12
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user