From fbae1a4ce1210ce36068829ffb4ac5e431cb4572 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 17 Jun 2026 08:42:41 +0200 Subject: [PATCH] Corretta preselezione in caso di testa in lavoro troppo vicina a quella che sta preselezionando --- Common_ONE-PF.NUM.mlpe | 60 ++++++++++++++++++++++++++++++------------ UpdateLog.txt | 3 +++ Version.lua | 2 +- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/Common_ONE-PF.NUM.mlpe b/Common_ONE-PF.NUM.mlpe index dceac1c..f10efcc 100644 --- a/Common_ONE-PF.NUM.mlpe +++ b/Common_ONE-PF.NUM.mlpe @@ -422,6 +422,14 @@ function OnToolSelect() if EMT.TDIST and abs( EMT.TDIST) < 0.1 then EMT.TDIST = nil end EMT.TUSERNOTES = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) EMT.ISPROBING = HeadIsProbe( EMT.HEAD) + + -- gruppo della testa + local nHSet = GetHeadSet( EMT.HEAD) + if nHSet == 1 and EMT.PRESEL_H1 then + EMT.PRESEL_H1 = nil + elseif nHSet == 2 and EMT.PRESEL_H2 then + EMT.PRESEL_H2 = nil + end end end @@ -3382,12 +3390,14 @@ function PreselectNextDiffHead( nMchId, sHead) local nHSet = GetHeadSet( sHead) local bVerifyPresel = true - -- se lavorazione con testa 1 e sotto al limite massimo di preselezione della testa 2, allora non si fa preselezione - if nHSet == 1 and Limit_T1_Presel_T2 and EMT.MAXMIN[2] < Limit_T1_Presel_T2 then - bVerifyPresel = false - -- se lavorazione con testa 1 e sopra al limite minimo di preselezione della testa 1, allora non si fa preselezione - elseif nHSet == 2 and Limit_T2_Presel_T1 and EMT.MAXMIN[2] > Limit_T2_Presel_T1 then - bVerifyPresel = false + if not EMT.LOAD then + -- se lavorazione con testa 1 e sotto al limite massimo di preselezione della testa 2, allora non si fa preselezione + if nHSet == 1 and Limit_T1_Presel_T2 and EMT.MAXMIN[2] < Limit_T1_Presel_T2 then + bVerifyPresel = false + -- se lavorazione con testa 1 e sopra al limite minimo di preselezione della testa 1, allora non si fa preselezione + elseif nHSet == 2 and Limit_T2_Presel_T1 and EMT.MAXMIN[2] > Limit_T2_Presel_T1 then + bVerifyPresel = false + end end -- flag preselezione eseguita @@ -3456,20 +3466,36 @@ function PreselectNextDiffHead( nMchId, sHead) end -- se non eseguita preselezione if not bPresel then - -- mi assicuro che l'altra testa sia in parcheggio - if nHSet == 1 then - -- non può essere la sega a catena - if EMT.PREVHEAD_H2 ~= 'H23' then - EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H2)}) - EmitMoveStartHead( 2) - end + -- se era stato preselezionato un utensile e adesso non posso preselezionare, attendo la testa + if EMT.PRESEL_H2 then + EmitMoveWaitHead( 2) + EMT.PRESEL_H2 = nil + elseif EMT.PRESEL_H1 then + EmitMoveWaitHead( 1) + EMT.PRESEL_H1 = nil + -- se non era stato preselezionato nulla else - -- non può essere la sega a catena - if EMT.PREVHEAD_H1 ~= 'H13' and EMT.PREVHEAD_H1 ~= 'H15' then - EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H1)}) - EmitMoveStartHead( 1) + -- mi assicuro che l'altra testa sia in parcheggio + if nHSet == 1 then + -- non può essere la sega a catena + if EMT.PREVHEAD_H2 ~= 'H23' then + EmitMoveDataHead( 2, { X=-ParkX2, Z=MaxZ2, B=ParkB2, C=ParkC2, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H2)}) + EmitMoveStartHead( 2) + end + else + -- non può essere la sega a catena + if EMT.PREVHEAD_H1 ~= 'H13' and EMT.PREVHEAD_H1 ~= 'H15' then + EmitMoveDataHead( 1, { X=-ParkX1, Z=MaxZ1, B=ParkB1, C=ParkC1, TPos=AdjustTcPos( false, EMT.PREVTCPOS_H1)}) + EmitMoveStartHead( 1) + end end end + else + if nHSet == 1 then + EMT.PRESEL_H2 = true + elseif nHSet == 1 then + EMT.PRESEL_H2 = true + end end end diff --git a/UpdateLog.txt b/UpdateLog.txt index 786ad53..4758a8e 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,8 @@ ==== Common_ONE-PF Update Log ==== +Versione 3.1f4 (17/06/2026) +- (MLDE-GEN) Corretta preselezione in caso di testa in lavoro troppo vicina a quella che sta preselezionando. Da aggiungere in MLDE parametri 'Limit_T1_Presel_T2' e 'Limit_T2_Presel_T1' + Versione 3.1f3 (08/06/2026) - (GEN) M77 viene ora eseguita, prima era commentata. diff --git a/Version.lua b/Version.lua index 480e487..72474b2 100644 --- a/Version.lua +++ b/Version.lua @@ -3,7 +3,7 @@ local InfoCommon_STD_PP = { NAME = 'Common_ONE-PF', -- nome script PP standard - VERSION = '3.1f3', -- versione script + VERSION = '3.1f4', -- versione script MIN_MACH_VER_PP_COMMON = '3.1b2' -- versione minima kernel }