e9fc24778a
Wiki: two new pages - canny-5-3-pico-gauge-drive (why the CANNY's 12V negative output moved the needles and 3.3V push-pull could not; 2SK3069 low-side stage) and patrol-instrument-cluster (tach 2 ppr + trim -13 calibration, NTC temp sender curve, 20 kHz PWM flutter fix, and the four-layer steppy-needle diagnosis ending at the cluster's ~150 rpm count quantization, defeated with adaptive dither on B). Tools: serial_logger.py (multi-port capture to wiki/raw), serial_cmd.py (one-shot cfg commands to A), dual_serial_capture.py (bench snapshots), tach_ramp.py / tach_ramp2.py (synthetic rpm sweeps via cfg override). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
24 lines
506 B
Python
24 lines
506 B
Python
"""Send a command line to a serial port and print the reply.
|
|
|
|
Usage: python tools/serial_cmd.py COM10 "cfg show" [read_seconds]
|
|
"""
|
|
import sys
|
|
import time
|
|
|
|
import serial
|
|
|
|
port = sys.argv[1]
|
|
cmd = sys.argv[2]
|
|
secs = float(sys.argv[3]) if len(sys.argv) > 3 else 3.0
|
|
|
|
s = serial.Serial(port, 115200, timeout=0.5)
|
|
s.reset_input_buffer()
|
|
s.write((cmd + "\n").encode())
|
|
s.flush()
|
|
end = time.time() + secs
|
|
buf = b""
|
|
while time.time() < end:
|
|
buf += s.read(4096)
|
|
s.close()
|
|
print(buf.decode("utf-8", "replace"))
|