fix parsing of binary train proparties

This commit is contained in:
uvos 2022-02-03 11:29:29 +01:00
parent 7a61dc9368
commit 57edc50b6b
3 changed files with 3 additions and 4 deletions

View File

@ -46,8 +46,6 @@ void ItemStore::jsReqNewItem()
if(items_.empty())
return;
qDebug()<<__func__<<"new item requested";
std::vector<std::shared_ptr<TrainJs>> joysticks = TrainJs::getJsDevices();
for(auto joystick: joysticks)
{

View File

@ -105,7 +105,7 @@ std::shared_ptr<Item> Microcontroller::processTrainLine(const QString& buffer)
QStringList bufferList = buffer.split(' ');
if(bufferList.size() >= 14 && buffer.startsWith("TRAIN NUMBER:"))
{
return std::shared_ptr<Item>(new Train(bufferList[2].toInt(), bufferList[4].toInt(), bufferList[13].toInt(), bufferList[9].toInt()));
return std::shared_ptr<Item>(new Train(bufferList[2].toInt(), bufferList[4].toInt(), bufferList[13].toInt(nullptr, 2), bufferList[9].toInt()));
}
return nullptr;
}
@ -115,7 +115,7 @@ std::shared_ptr<Item> Microcontroller::processTurnoutLine(const QString& buffer)
QStringList bufferList = buffer.split(' ');
if(bufferList.size() >= 11 && buffer.startsWith("TURNOUT NUMBER:"))
{
return std::shared_ptr<Item>(new Turnout(bufferList[2].toInt(), bufferList[2].toInt(), bufferList[6].toInt(), bufferList[11].toInt()));
return std::shared_ptr<Item>(new Turnout(bufferList[2].toInt(), bufferList[4].toInt(), bufferList[6].toInt(), bufferList[11].toInt()));
}
return nullptr;
}

View File

@ -50,6 +50,7 @@ ItemWidget::ItemWidget(std::weak_ptr<Item> item, QWidget *parent) :
ui->radioButton_left->hide();
ui->radioButton_right->hide();
uint8_t functionMask = train->getFunctionMask();
qDebug()<<"functionMask: "<<(int)functionMask;
if(!(functionMask & (1 << 0)))
ui->checkBox_f1->hide();
if(!(functionMask & (1 << 1)))