Enforce unique temperature probe assignments

This commit is contained in:
2026-06-05 02:18:58 -06:00
parent 1ee73ad00d
commit 47dd9a7b8b
2 changed files with 17 additions and 2 deletions
+16 -1
View File
@@ -168,7 +168,22 @@ bool assignTempSensorByIndex(int configIndex, int scanIndex) {
return false;
}
appConfig.tempSensors[configIndex].address = sensorAddressStrings[scanIndex];
String selectedAddress = sensorAddressStrings[scanIndex];
for (int i = 0; i < MAX_TEMP_SENSORS; i++) {
if (i == configIndex) {
continue;
}
if (appConfig.tempSensors[i].address == selectedAddress) {
appConfig.tempSensors[i].address = "";
appConfig.tempSensors[i].enabled = false;
sensors.tempsF[i] = -127.0;
sensors.online[i] = false;
}
}
appConfig.tempSensors[configIndex].address = selectedAddress;
appConfig.tempSensors[configIndex].enabled = true;
return true;