anymodbus 0.2.0
Adds Modbus-ASCII framing, FC08 diagnostic loopback, FC04
input-register typed reads, and RS485 cold-start ergonomics — the
capabilities requested by servomexlib for its [modbus-ascii] / AUTO
milestone. The public API is additive and backwards-compatible; the internal
framing layer was restructured behind a narrow Framer strategy seam so
RTU / ASCII / (future) TCP share one response interpreter.
Added
- Modbus-ASCII framing —
Bus(stream, framing=Framing.ASCII), the
Framingenum, and anopen_modbus_ascii(path, *, baudrate, parity, data_bits=8)opener (data_bits=7for the classic 7E1 wire). Sync mirrors
included. - Pure LRC primitives at
anymodbus.lrc:lrc8,lrc8_bytes,
verify_lrc(mirroringanymodbus.crc). - FC08 diagnostic loopback —
Slave.diagnostic_loopback(data=b"\x00\x00")
(FC 0x08 sub-0x0000, Return Query Data), a side-effect-free liveness probe. - FC04 input registers in the typed reads —
read_float/read_int32/
read_stringacceptsource=RegisterSource.INPUT(defaultHOLDING). TimingConfig.startup_settle— one-shot pre-first-transaction settle for
USB-RS485 adapter warm-up.ChecksumErrorbase exception (parent ofCRCErrorand newLRCError).MockSlaveparity — answers FC08 sub-0 and speaks ASCII
(MockSlave(framing=…),client_slave_pair(framing=…)).
Changed
- Default
RetryPolicy.retry_onwidened to{ChecksumError, FrameTimeoutError}so ASCIILRCErrorretries by default (RTU unchanged —
CRCError ⊂ ChecksumError). - FC 0x08 reclassified from known-unsupported to supported (sub-0 only).
CRCErrorreparented underChecksumError(still aProtocolError).
No breaking changes to the documented public API. Full changelog in
CHANGELOG.md.