feat: NL-42/NL-52 serial control layer (USB/RS-232, dependency-free)
Adds a stdlib-only (termios, no pyserial) control layer for the older RION NL-42/NL-52 meters, which have no Ethernet option and speak the same ASCII command family as the NL-43 over RS-232C or USB (virtual COM port). - nl52/protocol.py: I/O-free parsers for DOD? (14 fields) and DRD? (9 fields), result codes, and level tokens. Handles '--.-' disabled-channel nulls and space-padded fixed-width fields. - nl52/client.py: termios SerialPort + NL52Client. Echo-tolerant result-code reading, buffered multi-line reads, NL-52 rate limits (200ms; 1s for DOD?). is_request = "?" in cmd (NL-52 requests can carry a param after '?', e.g. 'System Version?NL'). - nl52/cli.py: bench tool — probe/status/start/stop/monitor/poll/raw — for testing over USB on the dev server with nothing to install. - test_nl52_protocol.py: 45 parser assertions, host-runnable (no hardware). Client exchange logic separately validated via pty loopback. NL-52 quirks vs NL-43: DOD has no Lpeak and no measurement-state (query Measure? separately); DRD streaming requires the NX-42EX option. Not yet: SLMM integration (async transport / serial->TCP bridge for the RX55 PAD-mode path), DB model, validation against real hardware. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
RION NL-42 / NL-52 serial control layer.
|
||||
|
||||
The NL-52 has no Ethernet option (unlike the NL-43's NX-43EX LAN card); it
|
||||
speaks the same ASCII command family over RS-232C or USB (virtual COM port).
|
||||
This package provides a dependency-free serial client + parser so the meter
|
||||
can be driven directly over USB on the bench, and later bridged onto the
|
||||
network via the RX55's serial PAD mode (or a ser2net host).
|
||||
|
||||
Modules:
|
||||
protocol — pure command/response parsing (no I/O, unit-testable)
|
||||
client — termios-based serial transport + NL52Client command methods
|
||||
cli — command-line tool for bench testing over USB
|
||||
"""
|
||||
|
||||
from nl52.protocol import ( # noqa: F401
|
||||
DODSnapshot,
|
||||
DRDSample,
|
||||
ResultError,
|
||||
parse_dod,
|
||||
parse_drd,
|
||||
RESULT_CODES,
|
||||
)
|
||||
Reference in New Issue
Block a user