mirror of
https://github.com/fbarresi/Sharp7.git
synced 2026-02-04 08:42:51 +00:00
solved all warnings
replaces obsoleted constants solutionwide
This commit is contained in:
21
Sharp7/S7.cs
21
Sharp7/S7.cs
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
#pragma warning disable 618
|
||||
|
||||
namespace Sharp7
|
||||
{
|
||||
@@ -26,16 +25,16 @@ namespace Sharp7
|
||||
{
|
||||
switch (wordLength)
|
||||
{
|
||||
case S7Consts.S7WLBit: return 1; // S7 sends 1 byte per bit
|
||||
case S7Consts.S7WLByte: return 1;
|
||||
case S7Consts.S7WLChar: return 1;
|
||||
case S7Consts.S7WLWord: return 2;
|
||||
case S7Consts.S7WLDWord: return 4;
|
||||
case S7Consts.S7WLInt: return 2;
|
||||
case S7Consts.S7WLDInt: return 4;
|
||||
case S7Consts.S7WLReal: return 4;
|
||||
case S7Consts.S7WLCounter: return 2;
|
||||
case S7Consts.S7WLTimer: return 2;
|
||||
case (int)S7WordLength.Bit: return 1; // S7 sends 1 byte per bit
|
||||
case (int)S7WordLength.Byte: return 1;
|
||||
case (int)S7WordLength.Char: return 1;
|
||||
case (int)S7WordLength.Word: return 2;
|
||||
case (int)S7WordLength.DWord: return 4;
|
||||
case (int)S7WordLength.Int: return 2;
|
||||
case (int)S7WordLength.DInt: return 4;
|
||||
case (int)S7WordLength.Real: return 4;
|
||||
case (int)S7WordLength.Counter: return 2;
|
||||
case (int)S7WordLength.Timer: return 2;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma warning disable 618
|
||||
|
||||
namespace Sharp7
|
||||
{
|
||||
@@ -23,20 +22,20 @@ namespace Sharp7
|
||||
if (WordSize == 0)
|
||||
return false;
|
||||
|
||||
if (Area == S7Consts.S7AreaCT)
|
||||
WordLen = S7Consts.S7WLCounter;
|
||||
if (Area == S7Consts.S7AreaTM)
|
||||
WordLen = S7Consts.S7WLTimer;
|
||||
if (Area == (int)S7Area.CT)
|
||||
WordLen = (int)S7WordLength.Counter;
|
||||
if (Area == (int)S7Area.TM)
|
||||
WordLen = (int)S7WordLength.Timer;
|
||||
|
||||
if (WordLen == S7Consts.S7WLBit)
|
||||
if (WordLen == (int)S7WordLength.Bit)
|
||||
Amount = 1; // Only 1 bit can be transferred at time
|
||||
else
|
||||
{
|
||||
if ((WordLen != S7Consts.S7WLCounter) && (WordLen != S7Consts.S7WLTimer))
|
||||
if ((WordLen != (int)S7WordLength.Counter) && (WordLen != (int)S7WordLength.Timer))
|
||||
{
|
||||
Amount = Amount * WordSize;
|
||||
Start = Start * 8;
|
||||
WordLen = S7Consts.S7WLByte;
|
||||
WordLen = (int)S7WordLength.Byte;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user