Fix writing empty tablet status code

Changed axes "IsSelectable" bit to "IsVisible"
This commit is contained in:
luciomaranta
2020-06-05 13:03:26 +02:00
parent 7017ffd382
commit e77dd7b293
6 changed files with 57 additions and 38 deletions
+1 -1
View File
@@ -932,7 +932,7 @@ namespace CMS_CORE_Library.Demo
return NO_ERROR;
}
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
public override CmsError PLC_RM157Data(ref List<M157DataModel> value)
{
return NO_ERROR;
}
+19 -10
View File
@@ -1146,7 +1146,7 @@ namespace CMS_CORE_Library.Fanuc
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
}
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
public override CmsError PLC_RM157Data(ref List<M157DataModel> value)
{
return NO_ERROR;
}
@@ -2363,18 +2363,27 @@ namespace CMS_CORE_Library.Fanuc
if (cmsError.IsError())
return cmsError;
// Parse the data readed from PLC
foreach (byte id in ids)
// Remove not visible axes
axesData = axesData.Where(x => ids.Contains((byte)x.Id)).ToList();
// Set to true (old compatibility)
foreach (var axis in axesData)
{
if (id != 0)
{
// If axis exists, set it as selectable
var tmpAxis = axesData.Where(x => x.Id == id).FirstOrDefault();
if (tmpAxis != null)
tmpAxis.IsSelectable = true;
}
axis.IsSelectable = true;
}
//// Parse the data readed from PLC
//foreach (byte id in ids)
//{
// if (id != 0)
// {
// // If axis exists, set it as selectable
// var tmpAxis = axesData.Where(x => x.Id == id).FirstOrDefault();
// if (tmpAxis != null)
// tmpAxis.IsSelectable = true;
// }
//}
return NO_ERROR;
}
+1 -1
View File
@@ -330,7 +330,7 @@ namespace CMS_CORE_Library.Models
public double Value;
}
public class M157InputModel
public class M157DataModel
{
public uint Process;
public ushort Timer;
+1 -1
View File
@@ -583,7 +583,7 @@ namespace CMS_CORE_Library
public abstract CmsError PLC_WM156Response(int process, double responseVal);
public abstract CmsError PLC_RM157Data(ref List<M157InputModel> value);
public abstract CmsError PLC_RM157Data(ref List<M157DataModel> value);
public abstract CmsError PLC_WM157Timer(int process, ushort timerVal);
+15 -14
View File
@@ -1146,7 +1146,7 @@ namespace CMS_CORE_Library.Osai
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
public override CmsError PLC_RM157Data(ref List<M157DataModel> value)
{
byte dataAreNeeded = 0;
CmsError cmsError = MEM_RWByte(R, 0, M157_INPUT_NEEDED.MemType, M157_INPUT_NEEDED.Address, 0, ref dataAreNeeded);
@@ -1172,18 +1172,18 @@ namespace CMS_CORE_Library.Osai
// check if modal to choose date has to be shown
if (dataNeededArray[processId - 1])
{
value.Add(new M157InputModel()
value.Add(new M157DataModel()
{
Process = (uint)processId,
TimerInputNeeded = true,
CountdownIsActive = false,
Timer = 0
}); ;
});
}
else if (countdownActiveNeeded[processId - 1])
{
// check if timeout modal has to be shown
value.Add(new M157InputModel()
value.Add(new M157DataModel()
{
Process = (uint)processId,
TimerInputNeeded = false,
@@ -1199,7 +1199,7 @@ namespace CMS_CORE_Library.Osai
public override CmsError PLC_WM157Timer(int process, ushort timerVal)
{
CmsError cmsError = MEM_RWWord(W, 0, MEMORY_TYPE.Osai_GD, M156_RESPONSE_MEMORY + (process - 1), ref timerVal);
CmsError cmsError = MEM_RWWord(W, 0, M157_TIMER.MemType, M157_TIMER.Address + (process - 1), ref timerVal);
if (cmsError.IsError())
return cmsError;
@@ -2461,13 +2461,14 @@ namespace CMS_CORE_Library.Osai
if ((charName < 'a' || charName > 'z') && charName != 'S' && charName != '\0' && axesProcess[i] == process)
{
var isVisible = ids.Where(x => x == i + 1)?.FirstOrDefault() == 0 ? false : true;
// Add to returned value
axesData.Add(new AxisModel()
{
Id = i + 1,
Name = charName.ToString(),
IsSelectable = true
});
if(isVisible)
// Add to returned value
axesData.Add(new AxisModel()
{
Id = i + 1,
Name = charName.ToString(),
IsSelectable = true
});
}
}
@@ -5153,8 +5154,8 @@ namespace CMS_CORE_Library.Osai
internal static MEMORY_CELL M157_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4343, 1);
internal static MEMORY_CELL M157_INPUT_COUNTDOWN_ACTIVE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4345, 1);
internal static MEMORY_CELL M157_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4347, 1);
internal static MEMORY_CELL M157_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4337, 1);
internal static MEMORY_CELL M157_TIMER = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4338, 8);
internal static MEMORY_CELL M157_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4349, 1);
internal static MEMORY_CELL M157_TIMER = new MEMORY_CELL(MEMORY_TYPE.Osai_GW, 310, 8);
internal static int M156_RESPONSE_MEMORY = 910;
+20 -11
View File
@@ -1573,7 +1573,7 @@ namespace CMS_CORE_Library.Siemens
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
}
public override CmsError PLC_RM157Data(ref List<M157InputModel> value)
public override CmsError PLC_RM157Data(ref List<M157DataModel> value)
{
return NO_ERROR;
}
@@ -2750,18 +2750,27 @@ namespace CMS_CORE_Library.Siemens
if (cmsError.IsError())
return cmsError;
// Parse the data readed from PLC
foreach (byte id in ids)
// Remove not visible axes
axesData = axesData.Where(x => ids.Contains((byte)x.Id)).ToList();
// Set to true (old compatibility)
foreach (var axis in axesData)
{
if (id != 0)
{
// If axis exists, set it as selectable
var tmpAxis = AxesData.Where(x => x.Id == id).FirstOrDefault();
if (tmpAxis != null)
tmpAxis.IsSelectable = true;
}
axis.IsSelectable = true;
}
//// Parse the data readed from PLC
//foreach (byte id in ids)
//{
// if (id != 0)
// {
// // If axis exists, set it as selectable
// var tmpAxis = AxesData.Where(x => x.Id == id).FirstOrDefault();
// if (tmpAxis != null)
// tmpAxis.IsSelectable = true;
// }
//}
axesData = AxesData;
}
catch (Exception ex)
@@ -4835,7 +4844,7 @@ namespace CMS_CORE_Library.Siemens
return ManageException(ex);
}
return WBallufAction(SIEMENS_TDI_ACTION.ABORT);
return WBallufAction(SIEMENS_TDI_ACTION.NEW_DATA);
}
public override CmsError TOOLS_WAbortBallufTablet()