diff --git a/IOB-UT/baseUtils.cs b/IOB-UT/baseUtils.cs index eedce30f..6af1dada 100644 --- a/IOB-UT/baseUtils.cs +++ b/IOB-UT/baseUtils.cs @@ -1130,6 +1130,10 @@ namespace IOB_UT /// ND = 0, /// + /// AUTOMATICO + /// + AUTO, + /// /// EDIT (MEMORY EDIT) /// EDIT, @@ -1146,10 +1150,30 @@ namespace IOB_UT /// HANDLE_INC, /// + /// HOME + /// + HOME, + /// /// JOG (MANUAL CONTINUOUS FEED) /// JOG, /// + /// JOG MAN + /// + JOG_MAN, + /// + /// JOG_INC + /// + JOG_INC, + /// + /// PROFILE + /// + PROFILE, + /// + /// SEMI + /// + SEMI, + /// /// THND (TEACH IN HANDLE) /// THND, diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs index c0c19347..199e768f 100644 --- a/IOB-WIN/IobOSAI.cs +++ b/IOB-WIN/IobOSAI.cs @@ -556,12 +556,20 @@ namespace IOB_WIN parentForm.sIN = Semaforo.SV; + stopwatch.Restart(); // possiamo leggere tutto da qui che contiene status, mode e last_nc_error //oData = new Cndex.GETINFO1DATA(); var ncInfo = OSAI_ref.NcInfo1(ref oData); + // time rec + if (utils.CRB("recTime")) + { + TimingData.addResult(currIobConf.codIOB, "GETINFO1DATA", stopwatch.ElapsedTicks); + } + stopwatch.Stop(); - lgInfo(string.Format("Lettura completa NCINFO1DATA{0} lastNcError={1}{0}status={2}{0}substatus={9}{0}mode_select={3}{0}main_progr_name={4}{0}speed_ov={5}{0}progr_speed={6}{0}real_speed={7}{0}real_feed={8}{0}", Environment.NewLine, oData.last_nc_error, oData.status, oData.mode_select, oData.main_progr_name, oData.speed_ov, oData.progr_speed, oData.real_speed, oData.real_feed, oData.substatus)); - +#if false + lgInfo(string.Format("Lettura completa NCINFO1DATA{0} lastNcError={1}{0}status={2}{0}substatus={9}{0}mode_select={3}{0}main_progr_name={4}{0}speed_ov={5}{0}progr_speed={6}{0}real_speed={7}{0}real_feed={8}{0}", Environment.NewLine, oData.last_nc_error, oData.status, oData.mode_select, oData.main_progr_name, oData.speed_ov, oData.progr_speed, oData.real_speed, oData.real_feed, oData.substatus)); +#endif #if false @@ -988,22 +996,11 @@ namespace IOB_WIN { try { - // leggo tutto da 0 a 43... - int memIndex = 0; - // controllo modalità lettura memoria - stopwatch.Restart(); -#if false - OsaiMemRW(R, FANUC.MemType.G, memIndex, ref MemBlockG); - if (utils.CRB("recTime")) - { - TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-G-AREA", MemBlockG.Length), stopwatch.ElapsedTicks); - } -#endif - - stopwatch.Stop(); // verifico modo con valore corrente, se cambia aggiorno... -#if false - CNC_MODE newMode = decodeG43(MemBlockG[43]); + + +#if true + CNC_MODE newMode = decodeModeOsai(oData.mode_select); if (newMode != currMode) { // aggiorno! @@ -1014,7 +1011,7 @@ namespace IOB_WIN string sVal = string.Format("[CNC_MODE]{0}", descrMode); // chiamo accodamento... accodaFLog(sVal, qEncodeFLog("CNC_MODE", descrMode)); - } + } #endif } catch (Exception exc) @@ -1025,6 +1022,46 @@ namespace IOB_WIN } } } + /// + /// Decodifica del MODE selezionato + /// + /// + /// + protected CNC_MODE decodeModeOsai(int mode) + { + CNC_MODE answ = CNC_MODE.ND; + switch (mode) + { + case 1: + answ = CNC_MODE.MDI; + break; + case 2: + answ = CNC_MODE.AUTO; + break; + case 3: + answ = CNC_MODE.SEMI; + break; + case 4: + answ = CNC_MODE.JOG_MAN; + break; + case 5: + answ = CNC_MODE.JOG_INC; + break; + case 6: + answ = CNC_MODE.PROFILE; + break; + case 7: + answ = CNC_MODE.HOME; + break; + case 8: + answ = CNC_MODE.HANDLE_INC; + break; + default: + break; + } + return answ; + } + #if false /// /// decodifica il modo dai valori del byte G43 @@ -1078,40 +1115,24 @@ namespace IOB_WIN { Dictionary outVal = new Dictionary(); stopwatch.Restart(); -#if false - CncLib.Focas1.ODBDY2_1 answ = OSAI_ref.getAllDynData(); -#endif - if (utils.CRB("recTime")) - { - TimingData.addResult(currIobConf.codIOB, string.Format("PROC-DYN-DATA"), stopwatch.ElapsedTicks); - } - try { -#if false - string actf = answ.actf.ToString(); - string acts = answ.acts.ToString(); + string actf = oData.real_feed.ToString(); + string acts = oData.real_speed.ToString(); outVal.Add("DYNDATA", string.Format("FEED {0}#SPEED_RPM {1}", actf, acts)); + if (utils.CRB("SendFeedSpeed")) { outVal.Add("FEED", actf); outVal.Add("SPEED_RPM", acts); - //outVal.Add("NUM_ALARM", numAlarm); + //outVal.Add("NUM_ALARM", numAlarm); + outVal.Add("ACT_TOOL", oData.actual_tool.ToString()); } -#endif if (utils.CRB("SendAxPos")) { - // salvo le posizioni... -#if false - CncLib.Focas1.FAXIS posAx = answ.pos; - int[] currPosAbs = posAx.absolute; - int i = 0; - foreach (var item in currPosAbs) - { - i++; - outVal.Add(string.Format("POS_{0:00}", i), item.ToString()); - } -#endif + // salvo info assi... + outVal.Add("AX_SEL", oData.ax_sel.ToString()); + outVal.Add("NUM_AX_SEL", oData.num_ax_sel.ToString()); } } catch (Exception exc)