Weighing: Fix Baden scale

This commit is contained in:
2024-02-23 17:46:32 +01:00
parent 96c9890b90
commit 092c5788a4
3 changed files with 7 additions and 7 deletions

View File

@ -6,9 +6,9 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace Elwig.Helpers.Weighing { namespace Elwig.Helpers.Weighing {
public class SchemberEventScale : Scale, IEventScale, IDisposable { public class AveryEventScale : Scale, IEventScale, IDisposable {
public string Manufacturer => "Schember"; public string Manufacturer => "Avery";
public int InternalScaleNr => 1; public int InternalScaleNr => 1;
public string Model { get; private set; } public string Model { get; private set; }
public string ScaleId { get; private set; } public string ScaleId { get; private set; }
@ -20,7 +20,7 @@ namespace Elwig.Helpers.Weighing {
private bool IsRunning = true; private bool IsRunning = true;
private readonly Thread BackgroundThread; private readonly Thread BackgroundThread;
public SchemberEventScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) : public AveryEventScale(string id, string model, string cnx, string? empty = null, string? filling = null, int? limit = null, string? log = null) :
base(cnx, empty, filling, limit, log) { base(cnx, empty, filling, limit, log) {
ScaleId = id; ScaleId = id;
Model = model; Model = model;
@ -60,7 +60,7 @@ namespace Elwig.Helpers.Weighing {
line = await reader.ReadLineAsync(); line = await reader.ReadLineAsync();
if (LogPath != null) await File.AppendAllTextAsync(LogPath, $"{line}\r\n"); if (LogPath != null) await File.AppendAllTextAsync(LogPath, $"{line}\r\n");
} }
if (line == null || line.Length != 32 || line[0] != ' ' || line[9] != ' ' || line[15] != ' ' || line[20] != ' ') { if (line == null || line.Length != 33 || line[0] != ' ' || line[9] != ' ' || line[15] != ' ' || line[20] != ' ' || line[32] != ' ') {
throw new IOException($"Invalid event from scale: '{line}'"); throw new IOException($"Invalid event from scale: '{line}'");
} }

View File

@ -24,8 +24,8 @@ namespace Elwig.Helpers.Weighing {
int? limit = config.Limit != null ? int.Parse(config.Limit) : null; int? limit = config.Limit != null ? int.Parse(config.Limit) : null;
if (config.Type == "SysTec-IT") { if (config.Type == "SysTec-IT") {
return new SysTecITScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log); return new SysTecITScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log);
} else if (config.Type == "Schember-Async") { } else if (config.Type == "Avery-Async") {
return new SchemberEventScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log); return new AveryEventScale(config.Id, config.Model!, config.Connection!, config.Empty, config.Filling, limit, config.Log);
} else { } else {
throw new ArgumentException($"Invalid scale type: \"{config.Type}\""); throw new ArgumentException($"Invalid scale type: \"{config.Type}\"");
} }

View File

@ -22,7 +22,7 @@ file = database.sqlite3
;log = waage.log ;log = waage.log
;[scale.B] ;[scale.B]
;type = Schember-Async ;type = Avery-Async
;model = L320 ;model = L320
;connection = tcp://10.0.0.1:1234 ;connection = tcp://10.0.0.1:1234
;empty = OUT1:3000 ;empty = OUT1:3000