bozza gestione FANUC

This commit is contained in:
Samuele E. Locatelli
2019-08-09 07:45:34 +02:00
parent 56b6333428
commit 285191d4b5
2 changed files with 51 additions and 1 deletions
+12
View File
@@ -86,6 +86,18 @@ namespace MTC
#region area manipolazione bit/byte
/// <summary>
/// verifica se un dato bit sia alzato (come flag di strobe)
/// </summary>
/// <param name="currByte">valore da testare</param>
/// <param name="bitNum">valore cercato come INDICE base 0 del byte (b0..b7)</param>
/// <returns></returns>
public static bool IsSetBit(byte currByte, int bitNum)
{
return ((currByte & (1 << bitNum)) != 0);
}
/// <summary>
/// verifica se un dato bit sia alzato (come flag di strobe)
/// </summary>
+39 -1
View File
@@ -1298,6 +1298,44 @@ namespace SCMA
int[] axis2pathBase = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
int[] axis2pathTransf = new int[] { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
// processo le assegnazioni, partendo da quelle configurate "teoriche"
int[] assegnazioni = new int[] { 1, 1, 1, 2, 2, 2, 1, 1, 1 };
// per iniziare: devo capire quante siano le assegnazioni in ballo (conto i "2")
int numAxComp = 0;
int firstComp = -1;
foreach (var item in assegnazioni)
{
if (item == 1)
{
// solo se NON HO ancora assi COMP... incremento
if (numAxComp == 0) firstComp++;
}
else
{
numAxComp++;
}
}
// verificare: dovrei avere numAxComp = 3 e firstComp = 3
// ora scorro il vettore iniziale e verifico dai bit le effettive assegnazioni...
int bitIdx = 0;
for (int i = 0; i < numAxComp; i++)
{
// controllo il bit...
if (baseUtils.IsSetBit(assegnazioni[firstComp + i], bitIdx))
{
// in questo caso "azzero" l'assegnazione relativa successiva
assegnazioni[firstComp + i + numAxComp] = 0;
}
else
{
// tolgo assegnazione "corrente"
assegnazioni[firstComp + i] = 0;
}
bitIdx++;
}
byte bmapG1128 = 0;
FanucMemRW(R, FANUC.MemType.G, 1128, ref bmapG1128);
@@ -1307,7 +1345,7 @@ namespace SCMA
// SE ho bit alzati --> effettivamente sul processo 2...
for (int i = 0; i < 8; i++)
{
if ((bmapG1128 & (1 << i)) != 0)
if ((0 & (1 << i)) != 0)
{
}
}