Merge branch 'feature/S7Net' into develop

This commit is contained in:
Samuele Locatelli
2020-06-25 18:10:39 +02:00
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -620,16 +620,24 @@ namespace CMS_CORE_Library.S7Net
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
int readValue = 0;
// Read pre power on and post power on data from memory
CmsError libraryError = MEM_RWInteger(R, 0, PRE_POST_POWER_ON.MemType, PRE_POST_POWER_ON.Address, PRE_POST_POWER_ON.SubAddress, ref readValue);
//int readValue = 0;
//// Read pre power on and post power on data from memory
//CmsError libraryError = MEM_RWInteger(R, 0, PRE_POST_POWER_ON.MemType, PRE_POST_POWER_ON.Address, PRE_POST_POWER_ON.SubAddress, ref readValue);
CmsError libraryError = NO_ERROR;
List<byte> currMem = new List<byte>();
libraryError = MEM_RWByteList(R, 0, PRE_POST_POWER_ON.MemType, PRE_POST_POWER_ON.Address, PRE_POST_POWER_ON.SubAddress,0, 4, ref currMem);
if (libraryError.IsError())
return libraryError;
bool[] bits = new bool[32];
// Convert int into to true/false array
bits = IntToBits(readValue);
//bits = IntToBits(readValue);
var bArray = new BitArray(currMem.ToArray());
bArray.CopyTo(bits, 0);
// Create adn set pre power on object
PrePowerOnModel prePowerOn = new PrePowerOnModel()
{
+1 -1
View File
@@ -179,7 +179,7 @@ namespace CMS_CORE_Library.Utils
.Cast<bool>()
.ToArray();
}
// Convert a byte into an array of bools
public static bool[] ByteToBits(byte val)
{