fix parsing of binary train proparties
This commit is contained in:
parent
7a61dc9368
commit
57edc50b6b
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user