Auto: abcip-4.2 — write deadband / write-on-change

Closes #239
This commit is contained in:
Joseph Doherty
2026-04-26 02:31:50 -04:00
parent 9202ebe5ef
commit da9936f7f0
9 changed files with 855 additions and 5 deletions

View File

@@ -86,7 +86,11 @@ public static class AbCipDriverFactoryExtensions
: null,
SafetyTag: t.SafetyTag ?? false,
// PR abcip-4.1 — per-tag scan rate override; null means "use subscription default".
ScanRateMs: t.ScanRateMs);
ScanRateMs: t.ScanRateMs,
// PR abcip-4.2 — per-tag write-deadband + write-on-change. Both default to "off"
// when absent so back-compat deployments behave exactly as before.
WriteDeadband: t.WriteDeadband,
WriteOnChange: t.WriteOnChange ?? false);
private static T ParseEnum<T>(string? raw, string? tagName, string driverInstanceId, string field,
T? fallback = null) where T : struct, Enum
@@ -180,6 +184,22 @@ public static class AbCipDriverFactoryExtensions
/// that don't set the knob. Mirrors Kepware's "scan classes" model.
/// </summary>
public int? ScanRateMs { get; init; }
/// <summary>
/// PR abcip-4.2 — optional numeric write deadband. When set, the driver skips a
/// wire write whose absolute difference from the previous successfully-written
/// value falls below this threshold. Suppressed writes still return <c>Good</c>.
/// <c>null</c> = no numeric suppression (back-compat default).
/// </summary>
public double? WriteDeadband { get; init; }
/// <summary>
/// PR abcip-4.2 — optional write-on-change gate. When <c>true</c>, the driver
/// skips a wire write whose value equals the previous successfully-written value.
/// Combines with <see cref="WriteDeadband"/> on numeric tags (deadband path takes
/// priority for numerics). Default <c>false</c> — every write reaches the wire.
/// </summary>
public bool? WriteOnChange { get; init; }
}
internal sealed class AbCipMemberDto