corretto conteggio inversioni (non + solo sommatoria...)
This commit is contained in:
@@ -368,12 +368,12 @@ namespace MTC_Adapter
|
||||
if (newDir != prevDirAxis[i])
|
||||
{
|
||||
// salvo "+1" come cambi direzione
|
||||
vettAxis[i].mAxInvDDone.Value = 1;
|
||||
vettAxis[i].mAxInvDDone.Value=incrNumInvAssi(i,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// salvo "0"...
|
||||
vettAxis[i].mAxInvDDone.Value = 0;
|
||||
// salvo "0" come aumento...
|
||||
vettAxis[i].mAxInvDDone.Value = incrNumInvAssi(i, 0);
|
||||
}
|
||||
|
||||
// salvo valori vettore prec...
|
||||
|
||||
@@ -1792,6 +1792,35 @@ namespace MTC_Adapter
|
||||
return needSave;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Incrementa valore salvato del numero inversioni assi effettuate
|
||||
/// </summary>
|
||||
/// <param name="idxAsse"></param>
|
||||
/// <param name="valInc"></param>
|
||||
/// <returns>restituisce nuovo numero inversioni</returns>
|
||||
public int incrNumInvAssi(int idxAsse, int valInc)
|
||||
{
|
||||
// leggo tutti i dati...
|
||||
List<DataRefItem<string, string>> listaDR = currAdpConf.Axis[idxAsse].dataRefList;
|
||||
// punto all'item
|
||||
DataRefItem<string, string> riContDist = listaDR.Find(x => x.Key == string.Format("Axis_{0:00}_InvDDone", idxAsse + 1));
|
||||
// recupero valore giri...
|
||||
int contInvers = Convert.ToInt32(riContDist.Value);
|
||||
// aggiungo giri...
|
||||
contInvers += valInc;
|
||||
// tolgo vecchio item
|
||||
listaDR.Remove(riContDist);
|
||||
// lo aggiorno...
|
||||
riContDist.Value = contInvers.ToString();
|
||||
// riaggiungo item
|
||||
listaDR.Add(riContDist);
|
||||
|
||||
// salvo in adapter!
|
||||
currAdpConf.Axis[idxAsse].dataRefList = listaDR;
|
||||
|
||||
return contInvers;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
+276
-1025
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 145 KiB |
Reference in New Issue
Block a user