dev modbus

This commit is contained in:
zonetest
2017-08-25 14:47:08 -04:00
parent 8a5f0fc92e
commit 69ca721ef7
4 changed files with 73 additions and 32 deletions
+28 -2
View File
@@ -242,8 +242,13 @@ qint16 CModbusCCMgr::GetZT1TrainType()
{
Type = TRAIN_TYPE_MPM10;
}
else if(Reg == 0)
{
Type = TRAIN_TYPE_MAINTENANCE_VEHICLE;
}
else
{
CEngLog::instance()->AddLogString(QString("MODBUS: Réception d'un type de train ZT1 invalide du SACL [%1]").arg(Reg));
Type = TRAIN_TYPE_UNKNOWN;
}
}
@@ -254,9 +259,30 @@ qint16 CModbusCCMgr::GetZT2TrainType()
{
bool OK = false;
qint16 Reg = mModbusRepo->GetSingleReg(MODBUS_CC_ZT2_TRAIN_TYPE_REG_ADD,&OK);
int Type = TRAIN_TYPE_UNKNOWN;
if(OK)
{
return Reg;
if(Reg == 63)
{
Type = TRAIN_TYPE_MR63;
}
else if(Reg == 73)
{
Type = TRAIN_TYPE_MR73;
}
else if(Reg == 10)
{
Type = TRAIN_TYPE_MPM10;
}
else if(Reg == 0)
{
Type = TRAIN_TYPE_MAINTENANCE_VEHICLE;
}
else
{
CEngLog::instance()->AddLogString(QString("MODBUS: Réception d'un type de train ZT2 invalide du SACL [%1]").arg(Reg));
Type = TRAIN_TYPE_UNKNOWN;
}
}
return 0;
return Type;
}