From 8558ac4acc2742a0f9c71f5eaa7e758dccc614dc Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Thu, 7 Feb 2019 16:57:02 +0000 Subject: [PATCH] Fix osai / fanuc minor bug --- CMS_CORE_Library/Fanuc/Nc_Fanuc.cs | 23 +++++++++++++++++------ CMS_CORE_Library/Osai/Nc_Osai.cs | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 03ec101..617c8ec 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -868,7 +868,11 @@ namespace CMS_CORE_Library.Fanuc public override CmsError PLC_WOperatorInputResponse(int process, double responseVal) { - return NO_ERROR; + //CmsError cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, 900 + (process - 1), ref responseVal); + //if (cmsError.IsError()) + // return cmsError; + + return PLC_WStrobe(M155_INPUT_ACK, M155_INPUT_STROBE, (uint)process); } public override CmsError PLC_RM154Data(ref List data, ref bool MTCOnOff) @@ -1251,11 +1255,16 @@ namespace CMS_CORE_Library.Fanuc private CmsError PROC_ReadActiveLine(uint processId, ref string line) { - uint lineL = 1; - uint txtL = 50; - short nReturn = Focas1.cnc_rdprogline2(nLibHandle[(int)processId - 1], 0, 1, line, ref lineL, ref txtL); - if (nReturn != 0) - return GetNcError(nReturn); + //uint lineL = 1; + //uint txtL = 50; + //short nReturn = Focas1.cnc_rdprogline2(nLibHandle[(int)processId - 1], 0, 1, line, ref lineL, ref txtL); + + ActiveProgramDataModel activeProgData = new ActiveProgramDataModel(); + CmsError cmsError = FILES_RActiveProgramData((int)processId, ref activeProgData); + if (cmsError.IsError()) + return cmsError; + + line = activeProgData.IsoLines.FirstOrDefault(); return NO_ERROR; } @@ -4227,6 +4236,8 @@ namespace CMS_CORE_Library.Fanuc internal static MEMORY_CELL COUNTER_IS_RESETTABLE_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3002, 0, 2); internal static MEMORY_CELL M155_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3004, 1); + internal static MEMORY_CELL M155_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3005, 1); + internal static MEMORY_CELL M155_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3006, 1); internal static MEMORY_CELL M154_SWITCH_ONOFF = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS, 2); internal static MEMORY_CELL M154_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3031, 1); diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index 5fbc9b8..1fe0d7f 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -3804,7 +3804,7 @@ 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.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) @@ -4102,7 +4102,7 @@ namespace CMS_CORE_Library.Osai internal static MEMORY_CELL M155_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4308, 1); 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, 2); + 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);