Merge branch 'feature/S7Net' into develop
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user