fix(modbus): #981 review — MELSEC no longer claims the generic DI<n> discrete-input mnemonic

The S-8 gate (no generic mnemonic fallback once a family grammar claimed the address) made
the MELSEC D-register grammar, which claimed every D prefix, reject DI100 as a malformed
D-register. MELSEC has no DI device, so DI... is no longer claimed; every other D... stays
native and DL205's non-octal C rejection is untouched.
This commit is contained in:
Joseph Doherty
2026-12-03 11:58:15 -05:00
parent b74b5162d2
commit 7374fdd0e4
3 changed files with 39 additions and 1 deletions
@@ -346,6 +346,13 @@ public static class ModbusAddressParser
// The MelsecAddress helpers honour the sub-family (Q hex vs F octal) and use
// bank base 0; users with non-zero assignment bases must use the structured
// tag form to override. The grammar string covers the common base-0 path.
//
// #981 review: MELSEC has no `DI` device, so `DI…` is NOT claimed here — it is the generic
// discrete-input mnemonic, which the S-8 gate (no generic fallback once a family grammar claimed an
// address) would otherwise reject as a malformed D-register. Narrow on purpose: every other `D…`
// stays native, and DL205's non-octal rejection is untouched.
if (text.StartsWith("DI", StringComparison.OrdinalIgnoreCase))
return false;
if (text.StartsWith("D", StringComparison.OrdinalIgnoreCase))
{
offset = MelsecAddress.DRegisterToHolding(text);