Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_core_library into feature/S7Net

This commit is contained in:
Samuele Locatelli
2020-06-11 14:34:57 +02:00
+14 -2
View File
@@ -1521,6 +1521,7 @@ namespace CMS_CORE_Library.Siemens
public override CmsError PLC_RM156Data(ref List<M156InputIsNeededModel> value)
{
return NO_ERROR;
byte val = 0;
List<byte> vals = new List<byte>();
CmsError cmsError = MEM_RWByte(R, 0, M156_INPUT_NEEDED.MemType, M156_INPUT_NEEDED.Address, M156_INPUT_NEEDED.SubAddress, 0, ref val);
@@ -4762,6 +4763,9 @@ namespace CMS_CORE_Library.Siemens
// Setup dimensions byte ( byte is formed by nibble => left_size right_size 0001 0001 )
ushort dimensions = (ushort)((((tool.LeftSize << 4) + tool.RightSize) << 8) + 17); // 17 = 0001 0001 ->
var maxSpeed = GetSiemensFormattedDouble(tool.MaxSpeed);
DataSvc dataSvc = new DataSvc();
// Main data
byte[] familyName = Encoding.ASCII.GetBytes(tool.FamilyName);
@@ -4772,7 +4776,7 @@ namespace CMS_CORE_Library.Siemens
new Item(){ Path = string.Format("DB{0}.DBW36", BALLUF_EMPTY_TABLE.Address), Value = tool.MagazinePositionType },
new Item(){ Path = string.Format("DB{0}.DBW38", BALLUF_EMPTY_TABLE.Address), Value = statusArray[0] },
new Item(){ Path = string.Format("DB{0}.DBW40", BALLUF_EMPTY_TABLE.Address), Value = (int)tool.LifeType },
new Item(){ Path = string.Format("DB{0}.DBD42", BALLUF_EMPTY_TABLE.Address), Value = tool.MaxSpeed },
new Item(){ Path = string.Format("DB{0}.DBD42", BALLUF_EMPTY_TABLE.Address), Value = maxSpeed},
new Item(){ Path = string.Format("DB{0}.DBD46", BALLUF_EMPTY_TABLE.Address), Value = tool.Load },
new Item(){ Path = string.Format("DB{0}.DBD50", BALLUF_EMPTY_TABLE.Address), Value = tool.Gamma },
new Item(){ Path = string.Format("DB{0}.DBD54", BALLUF_EMPTY_TABLE.Address), Value = tool.MaxLoadPctAutoload },
@@ -4797,9 +4801,10 @@ namespace CMS_CORE_Library.Siemens
{
if (edge.EdgeAdditionalParams.ContainsKey(conf.Name) && toolEdgesConfig.TDIEdgeFields.ContainsKey(conf.Path))
{
var formattedValue = GetSiemensFormattedDouble(edge.EdgeAdditionalParams[conf.Name]);
items.Add(new Item() {
Path = string.Format(toolEdgesConfig.TDIEdgeFields[conf.Path], BALLUF_EMPTY_TABLE.Address),
Value = edge.EdgeAdditionalParams[conf.Name]
Value = formattedValue
});
}
}
@@ -4846,6 +4851,13 @@ namespace CMS_CORE_Library.Siemens
return WBallufAction(SIEMENS_TDI_ACTION.NEW_DATA);
}
private uint GetSiemensFormattedDouble(double value)
{
var byteVal = BitConverter.GetBytes((Single)value);
return BitConverter.ToUInt32(byteVal, 0);
}
public override CmsError TOOLS_WAbortBallufTablet()
{