Fix incorrect sensor selection due to reorder sensors in SensorListWidget

This commit is contained in:
Carl Philipp Klemm 2025-10-05 23:29:23 +02:00
parent 271330d5fd
commit 0c5603ca44
7 changed files with 47 additions and 15 deletions

View file

@ -127,11 +127,16 @@ std::shared_ptr<Relay> Microcontroller::processRelayLine(const QString& buffer)
if(bufferList.size() >= 9 && buffer.startsWith("ITEM NUMBER:"))
{
QString name;
for(int i = 10; i < bufferList.size(); i++) name.append(bufferList[i] + ' ');
if(name.size() > 1)name.remove(name.size()-1, 1);
else name = "Relay " + QString::number(bufferList[1].toInt(nullptr, 2));
return std::shared_ptr<Relay>( new Relay(bufferList[2].toInt(), name, bufferList[4].toInt(nullptr, 2),
bufferList[8].toInt()));
for(int i = 10; i < bufferList.size(); i++)
name.append(bufferList[i] + ' ');
if(name.size() > 1)
name.remove(name.size()-1, 1);
else
name = "Relay " + QString::number(bufferList[1].toInt(nullptr, 2));
return std::shared_ptr<Relay>(new Relay(bufferList[2].toInt(),
name,
bufferList[6].toInt(nullptr, 2),
bufferList[8].toInt()));
}
return nullptr;
}