Fix bug that prevented aquireing new items

Add save button to master that saves json file
Remove autosave on quit
This commit is contained in:
uvos 2021-10-02 14:12:58 +02:00
parent 5fb9ca7cc0
commit 954eec754c
14 changed files with 61 additions and 18 deletions

View file

@ -124,14 +124,13 @@ void Microcontroller::setIODevice(QIODevice *port)
std::shared_ptr<Relay> Microcontroller::processRelayLine(const QString& buffer)
{
QStringList bufferList = buffer.split(' ');
if(bufferList.size() >= 8 && buffer.startsWith("ITEM NUMBER:"))
if(bufferList.size() >= 9 && buffer.startsWith("ITEM NUMBER:"))
{
QString name;
for(int i = 8; i < bufferList.size(); i++) name.append(bufferList[i] + ' ');
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));
qDebug()<<"Relay "<<bufferList[2].toInt()<<"Name "<<name<<" id "<<bufferList[4].toInt(nullptr, 2)<<" state "<<bufferList[6].toInt();
return std::shared_ptr<Relay>( new Relay(bufferList[2].toInt(), name, bufferList[4].toInt(nullptr, 2), bufferList[6].toInt()));
return std::shared_ptr<Relay>( new Relay(bufferList[2].toInt(), name, bufferList[4].toInt(nullptr, 2), bufferList[8].toInt()));
}
return nullptr;
}
@ -170,7 +169,7 @@ void Microcontroller::processMicroReturn()
if(listMode) processList(_buffer);
else
{
if(_buffer.startsWith("Relays:"))
if(_buffer.startsWith("Items:"))
{
listMode = true;
relayList.clear();