2 Commits

Author SHA1 Message Date
Yurii
6a9bd9673a fix: `Sensors::cleanDallasInstances()` fixed 2024-11-10 01:32:42 +03:00
Yurii
5aea80e630 fix: fix typos 2024-11-10 01:30:28 +03:00
2 changed files with 10 additions and 5 deletions

View File

@@ -119,7 +119,10 @@ protected:
}
void cleanDallasInstances() {
for (auto& [gpio, instance] : this->dallasInstances) {
// for (auto& [gpio, instance] : this->dallasInstances) {
auto it = this->dallasInstances.begin();
while (it != this->dallasInstances.end()) {
auto gpio = it->first;
bool instanceUsed = false;
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
@@ -135,8 +138,8 @@ protected:
}
}
if (!instanceUsed) {;
this->dallasInstances.erase(gpio);
if (!instanceUsed) {
it = this->dallasInstances.erase(it);
this->owInstances.erase(gpio);
this->dallasSearchTime.erase(gpio);
this->dallasPolling.erase(gpio);
@@ -145,6 +148,8 @@ protected:
Log.sinfoln(FPSTR(L_SENSORS_DALLAS), F("Stopped on GPIO %hhu"), gpio);
continue;
}
it++;
}
}

View File

@@ -152,14 +152,14 @@ struct Settings {
Sensors::Settings sensorsSettings[SENSORS_AMOUNT] = {
{
false,
"Indoor temp",
"Outdoor temp",
Sensors::Purpose::OUTDOOR_TEMP,
Sensors::Type::DALLAS_TEMP,
DEFAULT_SENSOR_OUTDOOR_GPIO
},
{
false,
"Outdoor temp",
"Indoor temp",
Sensors::Purpose::INDOOR_TEMP,
Sensors::Type::DALLAS_TEMP,
DEFAULT_SENSOR_INDOOR_GPIO