fix parsing of binary train proparties
This commit is contained in:
@ -46,8 +46,6 @@ void ItemStore::jsReqNewItem()
|
|||||||
if(items_.empty())
|
if(items_.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qDebug()<<__func__<<"new item requested";
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<TrainJs>> joysticks = TrainJs::getJsDevices();
|
std::vector<std::shared_ptr<TrainJs>> joysticks = TrainJs::getJsDevices();
|
||||||
for(auto joystick: joysticks)
|
for(auto joystick: joysticks)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ std::shared_ptr<Item> Microcontroller::processTrainLine(const QString& buffer)
|
|||||||
QStringList bufferList = buffer.split(' ');
|
QStringList bufferList = buffer.split(' ');
|
||||||
if(bufferList.size() >= 14 && buffer.startsWith("TRAIN NUMBER:"))
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ std::shared_ptr<Item> Microcontroller::processTurnoutLine(const QString& buffer)
|
|||||||
QStringList bufferList = buffer.split(' ');
|
QStringList bufferList = buffer.split(' ');
|
||||||
if(bufferList.size() >= 11 && buffer.startsWith("TURNOUT NUMBER:"))
|
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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ ItemWidget::ItemWidget(std::weak_ptr<Item> item, QWidget *parent) :
|
|||||||
ui->radioButton_left->hide();
|
ui->radioButton_left->hide();
|
||||||
ui->radioButton_right->hide();
|
ui->radioButton_right->hide();
|
||||||
uint8_t functionMask = train->getFunctionMask();
|
uint8_t functionMask = train->getFunctionMask();
|
||||||
|
qDebug()<<"functionMask: "<<(int)functionMask;
|
||||||
if(!(functionMask & (1 << 0)))
|
if(!(functionMask & (1 << 0)))
|
||||||
ui->checkBox_f1->hide();
|
ui->checkBox_f1->hide();
|
||||||
if(!(functionMask & (1 << 1)))
|
if(!(functionMask & (1 << 1)))
|
||||||
|
Reference in New Issue
Block a user