diff --git a/DocBuilder/Docs/plctypes.md b/DocBuilder/Docs/plctypes.md index 72e0eb9..6bd3ce1 100644 --- a/DocBuilder/Docs/plctypes.md +++ b/DocBuilder/Docs/plctypes.md @@ -101,7 +101,7 @@ All supported PLC types for auto recognition are listed in this table. Other one ❌ -📟 FP1 +📟 FP1, FP-M C14, C16 @@ -143,19 +143,37 @@ All supported PLC types for auto recognition are listed in this table. Other one C56, C72 5k 0x06 -FP1_5k__C56_C72 +FP1_5k__C56_C72_OR_FPdM_5k__C20RC_C20TC_C32TC ⚠️ ❌ ❌ -📟 FP10 + C20RC, C20TC, C32TC + 5k +0x06 +FP1_5k__C56_C72_OR_FPdM_5k__C20RC_C20TC_C32TC +⚠️ + ❌ + ❌ + + +📟 FP10, FP10S - 30k 0x20 -FP10_30k_OR_FP10S_30k +FP10_30k_OR_FP10_60k_OR_FP10S_30k +⚠️ + ❌ + ❌ + + + - + 60k +0x20 +FP10_30k_OR_FP10_60k_OR_FP10S_30k ⚠️ ❌ ❌ @@ -164,7 +182,7 @@ All supported PLC types for auto recognition are listed in this table. Other one - 30k 0x20 -FP10_30k_OR_FP10S_30k +FP10_30k_OR_FP10_60k_OR_FP10S_30k ⚠️ ❌ ❌ @@ -176,7 +194,25 @@ All supported PLC types for auto recognition are listed in this table. Other one - 30k 0x30 -FP10SH_30k +FP10SH_30k_OR_FP10SH_60k_OR_FP10SH_120k +⚠️ + ❌ + ❌ + + + - + 60k +0x30 +FP10SH_30k_OR_FP10SH_60k_OR_FP10SH_120k +⚠️ + ❌ + ❌ + + + - + 120k +0x30 +FP10SH_30k_OR_FP10SH_60k_OR_FP10SH_120k ⚠️ ❌ ❌ @@ -245,6 +281,9 @@ All supported PLC types for auto recognition are listed in this table. Other one ❌ +📟 FP3, FP-C + + - 16k 0x13 @@ -320,7 +359,16 @@ All supported PLC types for auto recognition are listed in this table. Other one - 16k 0xE1 -FPdSIGMA_16k +FPdSIGMA_16k_OR_FPdSIGMA_40k +⚠️ + ✅ + ❌ + + + - + 40k +0xE1 +FPdSIGMA_16k_OR_FPdSIGMA_40k ⚠️ ✅ ❌ diff --git a/DocBuilder/Program.cs b/DocBuilder/Program.cs index c5333ea..d2dddfb 100644 --- a/DocBuilder/Program.cs +++ b/DocBuilder/Program.cs @@ -28,7 +28,12 @@ void WritePlcTypeTable(IEnumerable vals) { var groups = vals.GroupBy(x => x.ToNameDecompose()[0].Group) .SelectMany(grouping => grouping.OrderBy(b => (int)b)) - .GroupBy(x => x.ToNameDecompose()[0].Group); + .GroupBy( + x => string.Join(", ", + x.ToNameDecompose() + .DistinctBy(y => y.Group) + .Select(y => y.Group)) + ); markdownBuilder.AppendLine(""); diff --git a/MewtocolNet/MewtocolInterface.cs b/MewtocolNet/MewtocolInterface.cs index da8e69b..eec4492 100644 --- a/MewtocolNet/MewtocolInterface.cs +++ b/MewtocolNet/MewtocolInterface.cs @@ -210,6 +210,8 @@ namespace MewtocolNet { try { + if (stream == null) return new MewtocolFrameResponse(405, "PLC not initialized"); + if (useBcc) frame = $"{frame.BuildBCCFrame()}"; diff --git a/MewtocolNet/MewtocolInterfaceRequests.cs b/MewtocolNet/MewtocolInterfaceRequests.cs index e9506fa..9775b1d 100644 --- a/MewtocolNet/MewtocolInterfaceRequests.cs +++ b/MewtocolNet/MewtocolInterfaceRequests.cs @@ -21,34 +21,15 @@ namespace MewtocolNet { /// A PLCInfo class public async Task GetPLCInfoAsync(int timeout = -1) { - //var resu = await SendCommandAsync("%01#RT", true, timeout); - //if (!resu.Success) return null; + var regexRT = new Regex(@"\%EE\$RT(?..)(?..)(?..)(?..)..(?..)(?....).*", RegexOptions.IgnoreCase); + + var regexEXRT = new Regex(@"\%EE\$EX00RT00(?..)(?..)..(?..)(?..)..(?..)(?....)(?..)(?..)(?.)(?....)(?....)(?....).*", RegexOptions.IgnoreCase); - //var reg = new Regex(@"\%([0-9]{2})\$RT([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{4})..", RegexOptions.IgnoreCase); - //Match m = reg.Match(resu.Response); + var resRT = await SendCommandAsync("%EE#RT", timeoutMs: timeout); + if (!resRT.Success) return null; - //if (m.Success) { + var resEXRT = await SendCommandAsync("%EE#EX00RT00", timeoutMs: timeout); - // string station = m.Groups[1].Value; - // string cpu = m.Groups[2].Value; - // string version = m.Groups[3].Value; - // string capacity = m.Groups[4].Value; - // string operation = m.Groups[5].Value; - - // string errorflag = m.Groups[7].Value; - // string error = m.Groups[8].Value; - - // PLCInfo retInfo = new PLCInfo { - // CpuInformation = CpuInfo.BuildFromHexString(cpu, version, capacity), - // OperationMode = PLCMode.BuildFromHex(operation), - // ErrorCode = error, - // StationNumber = int.Parse(station ?? "0"), - // }; - - // PlcInfo = retInfo; - // return retInfo; - - //} return null; diff --git a/MewtocolNet/PublicEnums/PlcType.cs b/MewtocolNet/PublicEnums/PlcType.cs index 66e01ca..b1e2cbf 100644 --- a/MewtocolNet/PublicEnums/PlcType.cs +++ b/MewtocolNet/PublicEnums/PlcType.cs @@ -5,6 +5,8 @@ namespace MewtocolNet { //this overwrites the CPU code and only comes with EXRT //special chars: (d = -) (c = .) (s = /) + //MISSING! FP7 and EcoLogix + /// /// The type of the PLC /// @@ -66,20 +68,20 @@ namespace MewtocolNet { [PlcLegacy] FP1_2c7k__C24_C40_OR_FPdM_2c7k__C20R_C20T_C32T = 0x05, /// - /// FP1 5.0k C56,C72 + /// FP1 5.0k C56,C72 or FPM 5k C20RC,C20TC,C32TC /// [PlcLegacy] - FP1_5k__C56_C72 = 0x06, + FP1_5k__C56_C72_OR_FPdM_5k__C20RC_C20TC_C32TC = 0x06, #endregion #region FP10 Family (Legacy) /// - /// FP10 OR FP10S 30k + /// FP10 30k,60k OR FP10S 30k /// [PlcLegacy] - FP10_30k_OR_FP10S_30k = 0x20, + FP10_30k_OR_FP10_60k_OR_FP10S_30k = 0x20, //misses entry FP10 60k @@ -88,13 +90,10 @@ namespace MewtocolNet { #region FP10SH Family (Legacy) /// - /// FP10SH 30k + /// FP10SH 30k, 60k, 120k /// [PlcLegacy] - FP10SH_30k = 0x30, - - //misses entry FP10SH 60k - //misses entry FP10SH 120k + FP10SH_30k_OR_FP10SH_60k_OR_FP10SH_120k = 0x30, #endregion @@ -121,20 +120,20 @@ namespace MewtocolNet { #region FP-Sigma Family (Legacy) /// - /// FP-Sigma 12k + /// FP-SIGMA 12k /// [PlcLegacy, PlcEXRT] FPdSIGMA_12k = 0x43, /// - /// FP-Sigma 32k + /// FP-SIGMA 32k /// [PlcLegacy, PlcEXRT] FPdSIGMA_32k = 0x44, /// - /// FP-SIGMA 16k + /// FP-SIGMA 16k or FP-SIGMA 40k /// [PlcLegacy, PlcEXRT] - FPdSIGMA_16k = 0xE1, + FPdSIGMA_16k_OR_FPdSIGMA_40k = 0xE1, #endregion