refactor: optimized polling of unused OT IDs

This commit is contained in:
Yurii
2024-11-16 22:57:52 +03:00
parent 2bb771a4a7
commit 2589020428
2 changed files with 21 additions and 21 deletions

View File

@@ -122,14 +122,14 @@ public:
return true;
}
static uint8_t getAmountByType(Type type) {
static uint8_t getAmountByType(Type type, bool onlyEnabled = false) {
if (settings == nullptr) {
return 0;
}
uint8_t amount = 0;
for (uint8_t id = 0; id < getMaxSensorId(); id++) {
if (settings[id].type == type) {
if (settings[id].type == type && (!onlyEnabled || settings[id].enabled)) {
amount++;
}
}