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>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Sweep the tach via A's override: 800 -> 3500 -> 800 rpm, then override off.
|
|
|
|
Usage: python tools/tach_ramp.py COM10 [step_rpm] [step_ms]
|
|
Sends 'cfg override rpm N' lines over A's console; A pushes each as a CONFIG
|
|
frame to B. Ctrl+C aborts and switches the override off.
|
|
"""
|
|
import sys
|
|
import time
|
|
|
|
import serial
|
|
|
|
port = sys.argv[1] if len(sys.argv) > 1 else "COM10"
|
|
step = int(sys.argv[2]) if len(sys.argv) > 2 else 50
|
|
dwell = (int(sys.argv[3]) if len(sys.argv) > 3 else 150) / 1000.0
|
|
|
|
s = serial.Serial(port, 115200, timeout=0.1)
|
|
# Native-USB boards reset when the port opens - give A time to boot.
|
|
time.sleep(4)
|
|
s.reset_input_buffer()
|
|
|
|
|
|
def send(cmd):
|
|
s.write((cmd + "\n").encode())
|
|
s.flush()
|
|
|
|
|
|
try:
|
|
points = list(range(800, 3501, step)) + list(range(3500, 799, -step))
|
|
print("ramp: %d points, %d ms each (~%.0f s total)" % (len(points), dwell * 1000, len(points) * dwell))
|
|
for rpm in points:
|
|
send("cfg override rpm %d" % rpm)
|
|
time.sleep(dwell)
|
|
finally:
|
|
send("cfg override off")
|
|
time.sleep(0.5)
|
|
s.close()
|
|
print("done, override off")
|