Fixed issue #

This commit is contained in:
Lucio Maranta
2019-03-12 16:42:41 +00:00
parent 49e8286710
commit 9ec6bd9ad2
6 changed files with 72 additions and 48 deletions
+1 -1
View File
@@ -690,7 +690,7 @@ namespace CMS_CORE_Library.Demo
Id = (uint)i + 1,
Process = readValues[headOffset],
Override = readValues[headOffset + 1],
Load_Abrasive = BitConverter.ToUInt16(readValues.ToArray(), headOffset + 2), // Uint16 = 2 byte
Load_Abrasive = BitConverter.ToInt16(readValues.ToArray(), headOffset + 2), // Uint16 = 2 byte
ActualSpeed_Pressure = BitConverter.ToInt32(readValues.ToArray(), headOffset + 4), // Int32 = 4byte
MountedTool_Vacum = BitConverter.ToInt16(readValues.ToArray(), headOffset + 8), // Uint 16 = 2byte
IsActive = (readValues[headOffset + 10] & 1) != 0, // bit 0
+1 -2
View File
@@ -811,7 +811,7 @@ namespace CMS_CORE_Library.Fanuc
Id = (uint)i + 1,
Process = readValues[headOffset],
Override = readValues[headOffset + 1],
Load_Abrasive = BitConverter.ToUInt16(readValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
Load_Abrasive = BitConverter.ToInt16(readValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
MountedTool_Vacum = BitConverter.ToInt16(readValues.ToArray(), headOffset + 4), // Uint 16 = 2byte
ActualSpeed_Pressure = BitConverter.ToInt32(readValues.ToArray(), headOffset + 6), // Int32 = 4byte
IsActive = (readValues[headOffset + 10] & 1) != 0, // bit 0
@@ -1162,7 +1162,6 @@ namespace CMS_CORE_Library.Fanuc
// Set action
ASSISTED_TOOLING_ACTION action = ASSISTED_TOOLING_ACTION.NONE;
if (GetBitValue(procFinalValue, 2))
action = ASSISTED_TOOLING_ACTION.UNLOAD;
+1 -1
View File
@@ -338,7 +338,7 @@ namespace CMS_CORE_Library.Models
public uint Id;
public byte Process;
public byte Override;
public ushort Load_Abrasive;
public short Load_Abrasive;
public int ActualSpeed_Pressure;
public short MountedTool_Vacum;
+13 -9
View File
@@ -778,7 +778,7 @@ namespace CMS_CORE_Library.Osai
Id = (uint)i + 1,
Process = readValues[headOffset],
Override = readValues[headOffset + 1],
Load_Abrasive = BitConverter.ToUInt16(readValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
Load_Abrasive = BitConverter.ToInt16(readValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
MountedTool_Vacum = BitConverter.ToInt16(readValues.ToArray(), headOffset + 4), // Uint 16 = 2byte
ActualSpeed_Pressure = BitConverter.ToInt32(readValues.ToArray(), headOffset + 6), // Int32 = 4byte
IsActive = (readValues[headOffset + 10] & 1) != 0, // bit 0
@@ -856,7 +856,7 @@ namespace CMS_CORE_Library.Osai
{
// Skip first parameter because it's the message string
// Set button with -> id = 1..5 -> value = parameter value
Dictionary<byte, string> buttons = parameters.Skip(2)?.ToDictionary(x => i++, x => x);
Dictionary<byte, string> buttons = parameters.Skip(1)?.ToDictionary(x => i++, x => x);
value.Add(new M155InputIsNeededModel()
{
@@ -890,13 +890,13 @@ namespace CMS_CORE_Library.Osai
if (cmsError.IsError())
return cmsError;
byte val = 0;
cmsError = MEM_RWByte(R, 0, M154_STROBE.MemType, M154_STROBE.Address, 0, ref val);
ushort val = 0;
cmsError = MEM_RWWord(R, 0, M154_STROBE.MemType, M154_STROBE.Address, ref val);
if (cmsError.IsError())
return cmsError;
// Convert a byte to an array of booleans
bool[] bits = ByteToBits(val);
bool[] bits = ByteToBits(Convert.ToByte(val));
string[] parameters;
string tmpStr = "";
@@ -1370,7 +1370,9 @@ namespace CMS_CORE_Library.Osai
try
{
// Execute the method
nReturn = OpenNC.GetActivePartProgramFullPath(ProcNumber, out Level, out MainName, out SubName, out uint errorClass, out uint errorNum);
// nReturn = OpenNC.GetActivePartProgramFullPath(ProcNumber, out Level, out MainName, out SubName, out uint errorClass, out uint errorNum);
// WAITING OSAI FIX
nReturn = OpenNC.GetActivePartProgram(ProcNumber, out Level, out MainName, out SubName, out uint errorClass, out uint errorNum);
// If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -3915,7 +3917,9 @@ namespace CMS_CORE_Library.Osai
try
{
//Execute the method
nReturn = OpenNC.GetActivePartProgramFullPath(procNumber, out Level, out mainPath, out SubPath, out errorClass, out errorNum);
// nReturn = OpenNC.GetActivePartProgramFullPath(procNumber, out Level, out mainPath, out SubPath, out errorClass, out errorNum);
// WAIT
nReturn = OpenNC.GetActivePartProgram(procNumber, out Level, out mainPath, out SubPath, out errorClass, out errorNum);
//If there's an error launch exception\
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -4214,8 +4218,8 @@ namespace CMS_CORE_Library.Osai
internal static MEMORY_CELL M155_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4310, 1);
internal static MEMORY_CELL M154_SWITCH_ONOFF = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4000, 1, 2);
internal static MEMORY_CELL M154_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4312, 1);
internal static MEMORY_CELL M154_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4314, 1);
internal static MEMORY_CELL M154_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4314, 1);
internal static MEMORY_CELL M154_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4312, 1);
internal static MEMORY_CELL AXES_BUTTON_VISIBLE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4320, 16);
+55 -34
View File
@@ -257,21 +257,33 @@ namespace CMS_CORE_Library.Siemens
private void ManageAxes(Guid guid, Item[] item, DataSvcStatus[] status)
{
MachineAxesPosition.Clear();
ProgrammedAxisPosition.Clear();
InterpAxesPosition.Clear();
ToGoAxesPosition.Clear();
for (int i = 0; i < AxesData.Count(); i++)
lock (MachineAxesPosition)
{
if(status[i * 4].Ok)
MachineAxesPosition.Add(item[i * 4].SymbolicName, Convert.ToDouble(item[i * 4].Value));
if(status[i * 4 + 1].Ok)
ProgrammedAxisPosition.Add(item[i * 4 + 1].SymbolicName, Convert.ToDouble(item[i * 4 + 1].Value));
if (status[i * 4 + 2].Ok)
InterpAxesPosition.Add(item[i * 4 + 2].SymbolicName, Convert.ToDouble(item[i * 4 + 2].Value));
if (status[i * 4 + 3].Ok)
ToGoAxesPosition.Add(item[i * 4 + 3].SymbolicName, Convert.ToDouble(item[i * 4 + 3].Value));
lock(ProgrammedAxisPosition)
{
lock (InterpAxesPosition)
{
lock (ToGoAxesPosition)
{
MachineAxesPosition.Clear();
ProgrammedAxisPosition.Clear();
InterpAxesPosition.Clear();
ToGoAxesPosition.Clear();
for (int i = 0; i < AxesData.Count(); i++)
{
if (status[i * 4].Ok)
MachineAxesPosition.Add(item[i * 4].SymbolicName, Convert.ToDouble(item[i * 4].Value));
if (status[i * 4 + 1].Ok)
ProgrammedAxisPosition.Add(item[i * 4 + 1].SymbolicName, Convert.ToDouble(item[i * 4 + 1].Value));
if (status[i * 4 + 2].Ok)
InterpAxesPosition.Add(item[i * 4 + 2].SymbolicName, Convert.ToDouble(item[i * 4 + 2].Value));
if (status[i * 4 + 3].Ok)
ToGoAxesPosition.Add(item[i * 4 + 3].SymbolicName, Convert.ToDouble(item[i * 4 + 3].Value));
}
}
}
}
}
}
@@ -1003,7 +1015,7 @@ namespace CMS_CORE_Library.Siemens
Id = (uint)i + 1,
Process = readValues[headOffset],
Override = readValues[headOffset + 1],
Load_Abrasive = SwapShortEndianFormat(BitConverter.ToUInt16(readValues.ToArray(), headOffset + 2)), // Uint 16 = 2byte
Load_Abrasive = SwapShortEndianFormat(BitConverter.ToInt16(readValues.ToArray(), headOffset + 2)), // Uint 16 = 2byte
MountedTool_Vacum = toolId, // Uint 16 = 2byte
ActualSpeed_Pressure = SwapIntEndianFormat(BitConverter.ToInt32(readValues.ToArray(), headOffset + 6)), // Int32 = 4byte
IsActive = (readValues[headOffset + 10] & 1) != 0, // bit 0
@@ -1804,11 +1816,14 @@ namespace CMS_CORE_Library.Siemens
{
axes = new Dictionary<string, double>();
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in MachineAxesPosition.ToList())
lock (MachineAxesPosition)
{
axes.Add(axis.Key, axis.Value);
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in MachineAxesPosition.ToList())
{
axes.Add(axis.Key, axis.Value);
}
}
}
catch (Exception ex)
@@ -1824,12 +1839,14 @@ namespace CMS_CORE_Library.Siemens
try
{
axes = new Dictionary<string, double>();
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in ProgrammedAxisPosition.ToList())
lock (ProgrammedAxisPosition)
{
axes.Add(axis.Key, axis.Value);
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in ProgrammedAxisPosition.ToList())
{
axes.Add(axis.Key, axis.Value);
}
}
}
catch (Exception ex)
@@ -1845,12 +1862,14 @@ namespace CMS_CORE_Library.Siemens
try
{
axes = new Dictionary<string, double>();
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in InterpAxesPosition.ToList())
lock (InterpAxesPosition)
{
axes.Add(axis.Key, axis.Value);
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in InterpAxesPosition.ToList())
{
axes.Add(axis.Key, axis.Value);
}
}
}
catch (Exception ex)
@@ -1866,12 +1885,14 @@ namespace CMS_CORE_Library.Siemens
try
{
axes = new Dictionary<string, double>();
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in ToGoAxesPosition.ToList())
lock (ToGoAxesPosition)
{
axes.Add(axis.Key, axis.Value);
// Cycle between axes
// The dictionary is written asynchronously so i have to create a copy of the dictionary with .ToList() to avoid exceptions
foreach (var axis in ToGoAxesPosition.ToList())
{
axes.Add(axis.Key, axis.Value);
}
}
}
catch (Exception ex)
+1 -1
View File
@@ -238,7 +238,7 @@ namespace CMS_CORE_Library.Utils
{
string tmpString = codeLine;
if (endPos != -1)
tmpString = codeLine.Substring(startPos, endPos - startPos - 1);
tmpString = codeLine.Substring(startPos + 1 , endPos - startPos - 1);
returnVal = tmpString.Trim(';').Split(',');