Agregada funcion de analizar la matriz de exportacion de tags. Creada un submenu para cargar los ultimos directorios ustilizados. Cambiado intercambio de datos para los Motores simulados a DINT
This commit is contained in:
parent
5208ae54b3
commit
72256a214c
|
@ -60,7 +60,7 @@ namespace LibS7Adv
|
|||
|
||||
public PLCViewModel()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ucLoaded()
|
||||
|
@ -85,9 +85,9 @@ namespace LibS7Adv
|
|||
[property: JsonIgnore]
|
||||
public void ConnectButton()
|
||||
{
|
||||
if (isConnected)
|
||||
if (isConnected)
|
||||
Disconnect();
|
||||
else
|
||||
else
|
||||
Connect();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace LibS7Adv
|
|||
return false;
|
||||
}
|
||||
if (sTag == null)
|
||||
{ return false; }
|
||||
{ return false; }
|
||||
var tag = ParseTagAddress(sTag);
|
||||
if (tag.tagType == EDataType.Unknown) // Normal Tag?
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ namespace LibS7Adv
|
|||
{
|
||||
var val = Instance?.MarkerArea.ReadByte(tag.word_offset);
|
||||
if (Signed)
|
||||
return val > 127 ? (val-256).ToString() : val.ToString();
|
||||
return val > 127 ? (val - 256).ToString() : val.ToString();
|
||||
return val.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ namespace LibS7Adv
|
|||
stopwatch.Restart();
|
||||
bool result = Instance?.ReadBool(pTag) ?? false;
|
||||
stopwatch.Stop();
|
||||
Debug.WriteLine($" LeerTagBool took {stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
Debug.WriteLine($" LeerTagBool took {stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -394,11 +394,42 @@ namespace LibS7Adv
|
|||
}
|
||||
}
|
||||
|
||||
public int? LeerTagDInt(string pTag)
|
||||
{
|
||||
try
|
||||
{
|
||||
stopwatch.Restart();
|
||||
int? result = Instance?.ReadInt32(pTag);
|
||||
stopwatch.Stop();
|
||||
Debug.WriteLine($" LeerTagDInt took {stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PlcData.LastError = pTag + ":" + ex.Message;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void EscribirTagDInt(string pTag, int pValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
stopwatch.Restart();
|
||||
Instance?.WriteInt32(pTag, pValue);
|
||||
stopwatch.Stop();
|
||||
Debug.WriteLine($" EscribirTagDInt took {stopwatch.Elapsed.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PlcData.LastError = pTag + ":" + ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
public static TagAddress ParseTagAddress(string tag)
|
||||
{
|
||||
TagAddress tagAddress = new TagAddress();
|
||||
if (tag==null)
|
||||
if (tag == null)
|
||||
return null;
|
||||
if (tag.StartsWith("%"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue