Add weight limit to scale

This commit is contained in:
2023-04-26 19:17:35 +02:00
parent 0621716636
commit ee5bda2fe3
4 changed files with 15 additions and 3 deletions

View File

@ -29,8 +29,9 @@ namespace Elwig.Helpers.Weighing {
public int ScaleNr { get; private set; }
public bool IsReady { get; private set; }
public bool HasFillingClearance { get; private set; }
public int? WeightLimit { get; private set; }
public SystecScale(int scaleNr, string model, string connection, string? empty = null, string? fill = null) {
public SystecScale(int scaleNr, string model, string connection, string? empty = null, string? fill = null, int? limit = null) {
ScaleNr = scaleNr;
Model = model;
IsReady = true;
@ -81,6 +82,9 @@ namespace Elwig.Helpers.Weighing {
EmptyDelay = int.Parse(parts[1]);
}
FillingClearanceMode = ConvertOutput(fill);
WeightLimit = limit;
if (FillingClearanceMode != null && WeightLimit == null)
throw new ArgumentException("Weight limit has to be set, if filling clearance supervision is enalbed");
Writer = new(stream, Encoding.ASCII, -1, true);
Reader = new(stream, Encoding.ASCII, false, -1, true);