Files
ESP32-S3-Touch-LCD-5B/tools/tach_ramp2.py
T
julian e9fc24778a Gauge drive day: CANNY comparison, cluster signal research, serial tools
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>
2026-09-23 11:12:20 +02:00

41 lines
1.0 KiB
Python

"""Ramp tach override 800 -> 6000 rpm, hold 5 s, ramp back down, override off.
Usage: python tools/tach_ramp2.py COM10 [step_rpm] [step_ms]
"""
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 25
dwell = (int(sys.argv[3]) if len(sys.argv) > 3 else 40) / 1000.0
s = serial.Serial(port, 115200, timeout=0.1)
time.sleep(4) # native-USB reset on port open
s.reset_input_buffer()
def send(cmd):
s.write((cmd + "\n").encode())
s.flush()
try:
up = list(range(800, 6001, step))
down = list(range(6000, 799, -step))
print("up %d pts, hold 5 s at 6000, down %d pts" % (len(up), len(down)))
for rpm in up:
send("cfg override rpm %d" % rpm)
time.sleep(dwell)
send("cfg override rpm 6000")
time.sleep(5)
for rpm in down:
send("cfg override rpm %d" % rpm)
time.sleep(dwell)
finally:
send("cfg override off")
time.sleep(0.5)
s.close()
print("done, override off")