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
+1 -1
View File
@@ -163,4 +163,4 @@ Examples:
5. Add config backup/restore. 5. Add config backup/restore.
6. Improve BMS out-of-range behavior without changing NimBLE connect timeout. 6. Improve BMS out-of-range behavior without changing NimBLE connect timeout.
- Fixed WebUI temperature probe scan by registering `/temps/scan`, `/temps/assign`, and `/temps/clear` firmware routes.\n\n- Added per-temperature-sensor `weather` flag and WebUI outside temperature badge with emoji thresholds: below 50°F ice, 50-74°F happy, 75-84°F sun, and 85°F+ fire.\n\n- Improved WebUI temperature sensor config checkbox layout with compact On/Weather controls.\n - Fixed WebUI temperature probe scan by registering `/temps/scan`, `/temps/assign`, and `/temps/clear` firmware routes.\n\n- Added per-temperature-sensor `weather` flag and WebUI outside temperature badge with emoji thresholds: below 50°F ice, 50-74°F happy, 75-84°F sun, and 85°F+ fire.\n\n- Improved WebUI temperature sensor config checkbox layout with compact On/Weather controls.\n\n- Temperature probe assignment now enforces one logical slot per physical DS18B20 address; assigning a probe to a new slot clears the old slot mapping.\n
+16 -1
View File
@@ -168,7 +168,22 @@ bool assignTempSensorByIndex(int configIndex, int scanIndex) {
return false; 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; appConfig.tempSensors[configIndex].enabled = true;
return true; return true;