Correction of tasmota/xsns_05_ds18x20.ino Ds18x20Name() search.

sizeof(ds18x20_chipids) calculates number of chipids, e.g. 4 chipids + 0
entry it will return 5. So the 1st checked chipid must start at
ds18x20_chipids[4], not at ds18x20_chipids[5].
This commit is contained in:
pharaocurt 2021-04-30 11:36:47 +02:00
parent 1ba8c0d16c
commit 65e1ceec83

View File

@ -420,11 +420,10 @@ bool Ds18x20Read(uint8_t sensor) {
void Ds18x20Name(uint8_t sensor) {
uint8_t index = sizeof(ds18x20_chipids);
while (index) {
while (--index) {
if (ds18x20_sensor[ds18x20_sensor[sensor].index].address[0] == ds18x20_chipids[index]) {
break;
}
index--;
}
GetTextIndexed(DS18X20Data.name, sizeof(DS18X20Data.name), index, kDs18x20Types);
if (DS18X20Data.sensors > 1) {